/* --- Buttons --- */
.btn {
    position: relative;
    border-radius: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    padding: 0.75rem 1.75rem;
    transition: all 0.35s ease;
    border: none;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
}

/* Primary button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color-start), var(--primary-color-end));
    color: #a0a0ab !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.4);
}

/* Hover state: pop effect */
.btn-primary:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 10px 25px rgba(0, 123, 255, 0.55);
    color: #ffffff !important;
}

/* Active state (pressed) */
.btn-primary:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    color: #ffffff !important;
}

/* Glassy subtle shine overlay */
.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 40%,
        rgba(255, 255, 255, 0) 60%
    );
    transform: skewX(-25deg);
    transition: 0.6s;
    z-index: 0;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Secondary button style */
.btn-secondary {
    background: linear-gradient(135deg, #3a3a50, #2a2a3e);
    color: #ffffff !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

/* IMS VIEW INVESTIGATION STYLE */
.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bg-primary {
    background-color: #0d6efd !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

.bg-info {
    background-color: #0dcaf0 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

.activity-timeline .activity-item {
    position: relative;
}

.activity-icon {
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rounded-lg {
    border-radius: 0.5rem !important;
}

.border-primary {
    border-color: #0d6efd !important;
}

.border-danger {
    border-color: #dc3545 !important;
}

.bg-primary.bg-opacity-10 {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* ===== MOBILE RESPONSIVENESS ===== */

/* Base responsive settings */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    min-width: 320px;
}

/* Login page specific styles */
.wrapper {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    width: 90%;
    box-sizing: border-box;
}

/* Dashboard cards responsiveness */
.row {
    margin-right: -0.75rem;
    margin-left: -0.75rem;
    width: 100%;
    max-width: 100%;
}

/* Make tables responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure charts are responsive */
.card-body canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Ensure all content fits */
.container-fluid {
    overflow-x: hidden !important;
    padding-left: 15px;
    padding-right: 15px;
    width: 100% !important;
    max-width: 100% !important;
}

/* Form responsiveness */
.form-control {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* ===== DASHBOARD BUTTON GROUP FIX ===== */

/* Target the specific dashboard button group */
.container-fluid .d-flex.justify-content-between .btn-group {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0.5rem !important;
}

/* Force buttons to be responsive */
.container-fluid .d-flex.justify-content-between .btn-group .btn {
    flex: 1 !important;
    min-width: 120px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Mobile-specific adjustments for dashboard button group */
@media (max-width: 768px) {
    /* Force buttons to stack vertically on mobile */
    .container-fluid .d-flex.justify-content-between .btn-group {
        flex-direction: column !important;
        width: 100% !important;
        margin-top: 1rem !important;
    }
    
    .container-fluid .d-flex.justify-content-between .btn-group .btn {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
        min-width: auto !important;
        text-align: left !important;
        justify-content: flex-start !important;
        white-space: normal !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Adjust the header layout */
    .container-fluid .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    /* Ensure no overflow */
    .container-fluid {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* For very small screens */
@media (max-width: 480px) {
    .container-fluid .d-flex.justify-content-between .btn-group .btn {
        font-size: 0.9rem !important;
        padding: 0.6rem 0.8rem !important;
    }
    
    .container-fluid .d-flex.justify-content-between .btn-group .btn i {
        margin-right: 0.5rem !important;
    }
}

/* ===== OTHER MOBILE RESPONSIVENESS ===== */

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 576px) {
    /* Login page adjustments */
    .wrapper {
        margin: 20px auto;
        padding: 15px;
        width: 95%;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    /* Dashboard adjustments */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Table adjustments */
    .table {
        font-size: 0.875rem;
    }
    
    .table th, .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
    
    /* Avatar adjustments */
    .avatar-circle {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    /* Reduce font sizes */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Make statistics cards full width on very small screens */
    .row .col-md-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* Make chart sections full width */
    .row .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (max-width: 768px) {
    /* Make statistics cards stack 2x2 on mobile */
    .row .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 1rem;
    }
    
    /* Make chart sections full width on mobile */
    .row .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem;
    }
    
    /* Ensure proper spacing */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Fix for performance metrics on mobile */
@media (max-width: 768px) {
    .row .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 1rem;
    }
    
    .row .col-md-3 h3 {
        font-size: 1.5rem;
    }
    
    .row .col-md-3 p {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .row .col-md-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* --- FIX BUTTON OVERFLOW ON MOBILE --- */

/* Allow flex items to wrap and shrink properly */
.d-flex.justify-content-between {
    flex-wrap: wrap !important;
}

/* Fix button group overflow by allowing wrapping */
.btn-group {
    flex-wrap: wrap !important;
    gap: 0.5rem;
}

/* Reduce button padding on small screens */
@media (max-width: 768px) {
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem;
    }

    /* Make sure container doesn’t overflow */
    .container-fluid {
        overflow-x: hidden !important;
    }

    /* Ensure mobile buttons stack neatly */
    .mobile-menu-container {
        display: block !important;
    }

    .mobile-btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
        border-radius: 0.6rem;
    }

    .mobile-btn i {
        margin-right: 0.5rem;
    }
}
