/* ===== LAYOUT ===== */
.sidebar {
    background: #ffffff;
    width: 280px;
    height: calc(100vh - 70px);
    position: fixed;
    top: 70px;
    left: 0;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    z-index: 100;
    pointer-events: auto;
}

.main-content {
    margin-left: 280px;
    margin-top: 70px;
    background: #f8f9fa;
    min-height: calc(100vh - 70px);
    pointer-events: auto;
}

.header {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
    pointer-events: auto;
}

/* ===== NAVIGATION ===== */
.nav-item.active {
    background: #3b82f6;
    border-radius: 8px;
    color: white !important;
}

.nav-item.active .nav-link {
    color: white !important;
}

.nav-link {
    color: #6b7280 !important;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #374151 !important;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    margin: 1.5rem 0 0.5rem 0;
    padding: 0 1rem;
}

.user-profile {
    background: #e0e7ff;
    border-radius: 1rem;
    padding: 1rem;
    margin: 1rem;
}

/* ===== BADGES ===== */
.badge-number {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    margin-left: auto;
    min-width: 24px;
    text-align: center;
}

.badge-primary { background: #3b82f6; color: white; }
.badge-success { background: #22c55e; color: white; }
.badge-warning { background: #f59e0b; color: white; }
.badge-danger { background: #ef4444; color: white; }
.badge-info { background: #06b6d4; color: white; }
.badge-purple { background: #8b5cf6; color: white; }

/* ===== HEADER COMPONENTS ===== */
.search-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    width: 400px;
    position: relative;
}

.search-icon-right {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

/* ===== GENERAL STYLES ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 0.5rem 0;
    min-width: 200px;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0 0.5rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.dropdown-toggle::after {
    display: none;
}

.profile-dropdown {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-dropdown:hover {
    transform: scale(1.05);
}

/* ===== BUTTONS - CRITICAL FIX ===== */
/* DO NOT override Bootstrap's .btn class - let Bootstrap handle it */
/* Only add minimal enhancements without breaking functionality */

/* Ensure all buttons are clickable and visible */
button,
a.btn,
input[type="submit"],
input[type="button"],
.btn {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Fix for buttons in tables */
.table .btn {
    position: relative;
    z-index: 2;
}

/* Fix for modal buttons */
.modal .btn {
    position: relative;
    z-index: 1055;
}

/* Ensure buttons are not blocked */
.btn:not(:disabled):not(.disabled) {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Fix any overlay issues */
.btn {
    isolation: isolate;
}

/* ===== ANIMATIONS ===== */
.count-updated {
    animation: countUpdate 0.5s ease-in-out;
}

@keyframes countUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: #3b82f6; color: white; }
    100% { transform: scale(1); }
}

.badge-number.pulse {
    animation: badgePulse 1s ease-in-out;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== DASHBOARD COMPONENTS ===== */
.stats-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    transition: width 0.8s ease;
}

.activity-item {
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease, opacity 0.3s ease;
}

.activity-item:hover {
    background-color: #f8f9fa;
}

.activity-item.fade-in {
    animation: fadeInUp 0.5s ease;
}

.activity-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.activity-content {
    min-width: 0;
}

.activity-text {
    line-height: 1.4;
    word-wrap: break-word;
}

.activity-time {
    font-size: 0.7rem;
    margin-top: 2px;
}

.recent-activity {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 1rem;
}

/* ===== REALTIME INDICATOR ===== */
.realtime-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: none;
}

.realtime-indicator.active {
    display: block;
}

.realtime-indicator i {
    animation: pulse 2s infinite;
}

.realtime-indicator.text-success i {
    animation: none;
}

/* ===== MOBILE RESPONSIVE ===== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: #3b82f6;
    cursor: pointer;
    padding: 8px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    .main-content {
        margin-left: 260px;
    }
    .search-box {
        width: 320px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .header {
        padding: 1rem;
    }
    
    .search-box {
        width: 250px;
    }
    
    .header .flex-grow-1:nth-child(2) {
        display: none !important;
    }
    
    .flex-grow-1:first-child h5 {
        font-size: 16px;
    }
    
    .recent-activity {
        max-height: 150px;
    }
    
    .activity-item {
        padding: 0.375rem;
    }
    
    .activity-text {
        font-size: 0.8rem;
    }
    
    .activity-time {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .search-box {
        width: 180px;
        font-size: 14px;
    }
    
    .header h5 {
        font-size: 18px;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .table td, .table th {
        padding: 0.5rem !important;
        font-size: 12px !important;
    }
    
    .stats-card .card-body {
        padding: 0.75rem !important;
    }
    
    .stats-card h4, .stats-card h3, .stats-card h2 {
        font-size: 18px !important;
    }
    
    .btn-sm {
        font-size: 11px !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    .page-header h2 {
        font-size: 20px !important;
    }
    
    .page-header .btn {
        font-size: 12px !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .pagination .page-link {
        font-size: 12px !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    .activity-item .rounded-circle {
        width: 32px !important;
        height: 32px !important;
    }
    
    .activity-item i {
        font-size: 14px !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.dashboard-error {
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #dc2626;
}

.sidebar-loading {
    opacity: 0.6;
    pointer-events: none;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-indicator.new { background-color: #3b82f6; }
.status-indicator.inreview { background-color: #f59e0b; }
.status-indicator.approved { background-color: #22c55e; }
.status-indicator.declined { background-color: #ef4444; }
.status-indicator.finalized { background-color: #8b5cf6; }


/* ===== CRITICAL BUTTON FIX - OVERRIDE ALL CONFLICTS ===== */
/* This ensures buttons work regardless of other CSS */

/* Force all buttons to be clickable */
.btn,
button,
a.btn,
input[type="submit"],
input[type="button"],
[role="button"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Ensure button content is clickable */
.btn *,
button *,
a.btn * {
    pointer-events: none !important;
}

/* Fix for d-flex containers with buttons */
.d-flex .btn,
.d-flex button,
.d-flex a.btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Fix for gap-3 containers */
.gap-3 .btn,
.gap-3 button,
.gap-3 a.btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Fix for card buttons */
.card .btn,
.card button,
.card a.btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Fix for form buttons */
form .btn,
form button,
form input[type="submit"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 100 !important;
}

/* Ensure no parent container blocks buttons */
.card,
.card-body,
.card-header,
.card-footer,
.container,
.container-fluid,
.row,
.col,
[class*="col-"],
.d-flex,
.flex-column,
.flex-row {
    pointer-events: auto !important;
}

/* But allow their children to be clickable */
.card *,
.card-body *,
.container *,
.row *,
.d-flex * {
    pointer-events: auto;
}

/* Specific fix for primary buttons */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-light,
.btn-dark,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Ensure disabled buttons don't interfere */
.btn:disabled,
.btn.disabled,
button:disabled,
button.disabled {
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* Fix for buttons with icons */
.btn i,
.btn .fas,
.btn .far,
.btn .fab,
button i,
button .fas,
button .far,
button .fab {
    pointer-events: none !important;
}

/* Ensure table action buttons work */
.table .btn,
.table button,
.table a.btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 20 !important;
}

/* Fix for rounded buttons */
.rounded-circle.btn,
button.rounded-circle {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Debug: Add visual indicator on hover (remove in production) */
.btn:hover,
button:hover,
a.btn:hover {
    opacity: 0.9;
}


/* ===== CUSTOM BUTTON SYSTEM (Replaces Bootstrap .btn) ===== */
/* Base button styles */
.custom-btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.custom-btn:hover {
    opacity: 0.9;
}

.custom-btn:focus {
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.custom-btn:disabled,
.custom-btn.disabled {
    pointer-events: none;
    opacity: 0.65;
    cursor: not-allowed;
}

/* Button Sizes */
.custom-btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.custom-btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

/* Button Colors - Primary */
.custom-btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.custom-btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.custom-btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5);
}

/* Button Colors - Secondary */
.custom-btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.custom-btn-secondary:hover {
    color: #fff;
    background-color: #5c636a;
    border-color: #565e64;
}

/* Button Colors - Success */
.custom-btn-success {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

.custom-btn-success:hover {
    color: #fff;
    background-color: #157347;
    border-color: #146c43;
}

/* Button Colors - Danger */
.custom-btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.custom-btn-danger:hover {
    color: #fff;
    background-color: #bb2d3b;
    border-color: #b02a37;
}

/* Button Colors - Warning */
.custom-btn-warning {
    color: #000;
    background-color: #ffc107;
    border-color: #ffc107;
}

.custom-btn-warning:hover {
    color: #000;
    background-color: #ffca2c;
    border-color: #ffc720;
}

/* Button Colors - Info */
.custom-btn-info {
    color: #000;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.custom-btn-info:hover {
    color: #000;
    background-color: #31d2f2;
    border-color: #25cff2;
}

/* Outline Buttons */
.custom-btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
    background-color: transparent;
}

.custom-btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.custom-btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
    background-color: transparent;
}

.custom-btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.custom-btn-outline-success {
    color: #198754;
    border-color: #198754;
    background-color: transparent;
}

.custom-btn-outline-success:hover {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

.custom-btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
}

.custom-btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.custom-btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
    background-color: transparent;
}

.custom-btn-outline-warning:hover {
    color: #000;
    background-color: #ffc107;
    border-color: #ffc107;
}

.custom-btn-outline-info {
    color: #0dcaf0;
    border-color: #0dcaf0;
    background-color: transparent;
}

.custom-btn-outline-info:hover {
    color: #000;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

/* Rounded Circle Buttons */
.custom-btn-circle {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Button Spacing */
.custom-btn.px-3 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.custom-btn.px-4 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.custom-btn.px-5 {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

/* Ensure custom buttons work everywhere */
.custom-btn,
button.custom-btn,
a.custom-btn,
input[type="submit"].custom-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.custom-btn * {
    pointer-events: none !important;
}
