/**
 * Bisnisku Custom Styles - Dark Theme
 * Modern, Professional, Premium Dark UI
 */

/* ===== IMPORT FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* ===== LAYOUT VARIABLES ===== */
:root {
    /* Primary Colors - Vibrant Blue & Purple */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --secondary-dark: #7c3aed;
    --secondary-light: #a78bfa;
    
    /* Accent Colors */
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    
    /* Status Colors */
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #3b82f6;
    --info-dark: #2563eb;
    
    /* Dark Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    
    /* Dark Surface Colors */
    --surface-1: #1e293b;
    --surface-2: #334155;
    --surface-3: #475569;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;
    
    /* Border Colors */
    --border-color: #334155;
    --border-light: #475569;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
    
    /* Layout - Responsive */
    --sidebar-width: 280px;
    --topbar-height: 70px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Responsive Spacing */
    --spacing-xs: clamp(0.5rem, 1vw, 0.75rem);
    --spacing-sm: clamp(0.75rem, 1.5vw, 1rem);
    --spacing-md: clamp(1rem, 2vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 3vw, 2rem);
    --spacing-xl: clamp(2rem, 4vw, 3rem);
    
    /* Responsive Font Sizes */
    --font-xs: clamp(0.75rem, 0.8vw, 0.875rem);
    --font-sm: clamp(0.875rem, 0.9vw, 1rem);
    --font-base: clamp(0.875rem, 1vw, 1rem);
    --font-lg: clamp(1rem, 1.2vw, 1.25rem);
    --font-xl: clamp(1.25rem, 1.5vw, 1.5rem);
    --font-2xl: clamp(1.5rem, 2vw, 2rem);
    --font-3xl: clamp(1.875rem, 2.5vw, 2.25rem);
}

/* Laptop adjustments */
@media (max-width: 1279px) and (min-width: 1024px) {
    :root {
        --sidebar-width: 260px;
        --topbar-height: 65px;
    }
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1f35 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

h1 { font-size: var(--font-3xl); }
h2 { font-size: var(--font-2xl); }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }
h5 { font-size: var(--font-base); }
h6 { font-size: var(--font-sm); }

img {
    max-width: 100%;
    height: auto;
}

/* ===== SMOOTH SCROLLBAR - DARK THEME ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
}

/* ===== SELECTION ===== */
::selection {
    background: var(--primary);
    color: white;
}

::-moz-selection {
    background: var(--primary);
    color: white;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.8);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===== UTILITY CLASSES ===== */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: var(--transition);
}

.hover-scale:hover {
    transform: scale(1.03);
}

.hover-glow:hover {
    animation: glow 2s ease-in-out infinite;
}

/* ===== SIDEBAR - DARK THEME - FULLY RESPONSIVE ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    border-right: 1px solid var(--border-color);
}

/* Sidebar Toggle Button (Hidden on Desktop) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    padding: 0.625rem 0.875rem;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--surface-3);
    transform: scale(1.05);
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

/* Sidebar Overlay for Mobile/Tablet */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0.1;
    pointer-events: none;
}

.sidebar-brand {
    padding: clamp(1.25rem, 2vw, 1.75rem) var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-1);
    position: relative;
    z-index: 1;
}

.sidebar-brand h2 {
    color: var(--text-primary);
    font-size: clamp(1.25rem, 1.5vw, 1.5rem);
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Poppins', sans-serif;
}

.sidebar-brand h2 i {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand p {
    color: var(--text-tertiary);
    font-size: var(--font-xs);
    margin: 0.25rem 0 0 0;
    font-weight: 500;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.875rem var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    margin: 0.25rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: var(--font-sm);
}

.sidebar-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.125rem;
    transition: var(--transition);
}

.sidebar-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    padding-left: calc(var(--spacing-md) + 0.25rem);
    box-shadow: var(--shadow-sm);
}

.sidebar-item:hover i {
    transform: scale(1.1);
    color: var(--primary-light);
}

.sidebar-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-item.active i {
    color: white;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: white;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem var(--spacing-md);
}

.sidebar-footer {
    position: sticky;
    bottom: 0;
    padding: 1rem var(--spacing-md);
    background: var(--surface-1);
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-2);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.sidebar-user:hover {
    background: var(--surface-3);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-user-info h6 {
    margin: 0;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user-info p {
    margin: 0;
    font-size: var(--font-xs);
    color: var(--text-tertiary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
    overflow-x: hidden;
    min-width: 0;
}

.content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    min-width: 0;
}

/* ===== TOPBAR - DARK THEME - FULLY RESPONSIVE ===== */
.topbar {
    background: var(--surface-1);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.topbar-title h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 1rem);
}

.topbar-notification {
    position: relative;
    padding: clamp(0.5rem, 1vw, 0.625rem);
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.topbar-notification:hover {
    color: var(--primary-light);
    background: var(--surface-3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.topbar-notification .badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface-1);
    animation: pulse 2s ease-in-out infinite;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.topbar-user:hover {
    background: var(--surface-3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.topbar-user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.topbar-user-info h6 {
    margin: 0;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.topbar-user-info p {
    margin: 0;
    font-size: var(--font-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ===== CONTENT AREA ===== */
.content-area {
    padding: clamp(1rem, 3vw, 2rem);
    animation: fadeIn 0.6s ease-out;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    min-width: 0;
}

@media (max-width: 1200px) {
    .content-area {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 1rem;
    }
}

/* ===== CARDS - DARK THEME ===== */
.stat-card {
    background: var(--surface-1);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent-cyan));
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.stat-card-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card-icon.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.stat-card-icon.success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.stat-card-icon.warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.stat-card-icon.info {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.stat-card-icon.danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-family: 'Poppins', sans-serif;
}

.stat-card-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
}

.stat-card-trend.up {
    color: var(--success);
}

.stat-card-trend.down {
    color: var(--danger);
}

.stat-card-trend i {
    font-size: 1rem;
}

/* ===== TABLES - DARK THEME - FULLY RESPONSIVE ===== */
.table-card {
    background: var(--surface-1);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.table-card-header {
    padding: clamp(1rem, 2vw, 1.5rem);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.table-card-header h5 {
    margin: 0;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    max-width: 100%;
}

.custom-table thead {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border-light);
}

.custom-table th {
    padding: clamp(0.75rem, 1.5vw, 1rem) clamp(1rem, 2vw, 1.5rem);
    text-align: left;
    font-weight: 700;
    font-size: var(--font-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.custom-table td {
    padding: clamp(0.75rem, 1.5vw, 1rem) clamp(1rem, 2vw, 1.5rem);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
    font-size: var(--font-sm);
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background: var(--surface-2);
}

/* Mobile-specific table cards (transform table rows to cards) */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: visible;
    }
    
    .custom-table {
        min-width: 100%;
    }
    
    .custom-table thead {
        display: none;
    }
    
    .custom-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: var(--surface-2);
        border-radius: var(--border-radius-sm);
        border: 1px solid var(--border-color);
        padding: 1rem;
    }
    
    .custom-table tbody tr:hover {
        transform: none;
    }
    
    .custom-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .custom-table td:last-child {
        border-bottom: none;
    }
    
    .custom-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-primary);
        font-size: var(--font-xs);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: 1rem;
    }
}

/* Tablet horizontal scroll */
@media (min-width: 768px) and (max-width: 1023px) {
    .table-responsive {
        overflow-x: auto;
    }
}

/* ===== BUTTONS - DARK THEME - FULLY RESPONSIVE ===== */
.btn-custom {
    padding: clamp(0.625rem, 1.2vw, 0.75rem) clamp(1rem, 2vw, 1.5rem);
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: var(--font-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-custom::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-custom:hover::before {
    width: 300px;
    height: 300px;
}

.btn-custom:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-custom:active {
    transform: translateY(-1px);
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success-custom {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger-custom {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning-custom {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Mobile: Full-width buttons */
@media (max-width: 767px) {
    .btn-custom {
        width: 100%;
        padding: 0.875rem 1rem;
    }
    
    /* Keep inline buttons normal size */
    .btn-group .btn-custom,
    .btn-custom.btn-sm {
        width: auto;
        padding: 0.5rem 1rem;
    }
}

.btn-outline-custom {
    background: transparent;
    border: 2px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline-custom:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .btn-custom {
        padding: 0.625rem 1.25rem;
        font-size: 0.8rem;
    }
}

/* ===== BADGES - DARK THEME ===== */
.badge-custom {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.875rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}

.badge-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    color: var(--info);
    border: 1px solid var(--info);
}

.badge-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.2));
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* ===== FORMS - DARK THEME ===== */
.form-control-custom {
    width: 100%;
    max-width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--surface-2);
    color: var(--text-primary);
    font-weight: 500;
    min-width: 0;
}

.form-control-custom::placeholder {
    color: var(--text-muted);
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-3);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-control-custom:hover {
    border-color: var(--border-light);
}

.form-label-custom {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

select.form-control-custom {
    cursor: pointer;
}

textarea.form-control-custom {
    resize: vertical;
    min-height: 100px;
}

.input-group {
    position: relative;
}

.input-group .form-control-custom {
    padding-left: 3rem;
}

.input-group-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.125rem;
}

@media (max-width: 768px) {
    .form-control-custom {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
}

/* ===== CHARTS - DARK THEME ===== */
.chart-container {
    background: var(--surface-1);
    border-radius: var(--border-radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent-cyan));
}

.chart-container:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

/* Chart Canvas Wrapper */
.chart-container canvas {
    max-height: 350px;
}

/* ===== LOADING - DARK THEME ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--surface-3);
    border-top-color: var(--primary);
    border-right-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    :root {
        --sidebar-width: 260px;
    }
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .topbar {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar-title h3 {
        font-size: 1.25rem;
    }
    
    .stat-card-value {
        font-size: 1.875rem;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0.875rem 1rem;
    }
    
    .topbar-title h3 {
        font-size: 1.125rem;
    }
    
    .topbar-user-info {
        display: none;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card-icon {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }
    
    .stat-card-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 576px) {
    .topbar {
        padding: 0.75rem;
    }
    
    .topbar-actions {
        gap: 0.5rem;
    }
    
    .content-area {
        padding: 0.875rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    padding: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: var(--surface-3);
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 992px) {
    .sidebar {
        z-index: 1001;
    }
}

/* ===== AUTH PAGES - DARK THEME ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2), transparent);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.auth-card {
    max-width: 480px;
    width: 100%;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: scaleIn 0.5s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo .logo-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.auth-logo h1 {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@media (max-width: 576px) {
    .auth-wrapper {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem 1.5rem;
        max-width: 100%;
    }
    
    .auth-logo .logo-icon {
        font-size: 2.5rem;
    }
    
    .auth-logo h1 {
        font-size: 1.875rem;
    }
    
    .auth-logo p {
        font-size: 0.85rem;
    }
}

/* ===== CUSTOM CHECKBOX FOR AUTH PAGES ===== */
.custom-checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    transition: var(--transition);
}

.checkbox-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    background: transparent;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.checkbox-icon {
    color: transparent;
    font-size: 11px;
    transition: all 0.3s ease;
    transform: scale(0);
}

.custom-checkbox-input:checked ~ .custom-checkbox-label .checkbox-box {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--primary);
}

.custom-checkbox-input:checked ~ .custom-checkbox-label .checkbox-icon {
    color: #ffffff;
    transform: scale(1);
}

.custom-checkbox-label:hover .checkbox-box {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.checkbox-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.custom-checkbox-input:checked ~ .custom-checkbox-label .checkbox-text {
    color: var(--text-primary);
}

.custom-checkbox-label:hover .checkbox-text {
    color: var(--text-primary);
}

/* Focus state for accessibility */
.custom-checkbox-input:focus ~ .custom-checkbox-label .checkbox-box {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 576px) {
    .checkbox-box {
        width: 18px;
        height: 18px;
    }
    
    .checkbox-icon {
        font-size: 10px;
    }
    
    .checkbox-text {
        font-size: 0.85rem;
    }
}

/* ===================================================
   RESPONSIVE BREAKPOINTS - COMPREHENSIVE
   ================================================== */

/* ===== LAPTOP (1024px - 1279px) ===== */
@media (min-width: 1024px) and (max-width: 1279px) {
    :root {
        --sidebar-width: 260px;
        --topbar-height: 65px;
    }
    
    .sidebar {
        width: var(--sidebar-width);
    }
    
    .content {
        margin-left: var(--sidebar-width);
    }
    
    /* Slightly reduce paddings */
    .card-custom {
        padding: 1.25rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
}

/* ===== TABLET (768px - 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --sidebar-width: 0px;
    }
    
    /* Hide sidebar by default */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1100;
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }
    
    /* Show sidebar toggle button */
    .sidebar-toggle {
        display: block;
    }
    
    /* Full width content */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    /* Stack cards */
    .row.g-4 [class*="col-xl-"],
    .row.g-4 [class*="col-lg-"] {
        flex: 0 0 50%;
        max-width: 50%;
        min-width: 0;
    }
    
    /* Hide some table columns */
    .custom-table th:nth-child(n+5),
    .custom-table td:nth-child(n+5) {
        display: none;
    }
    
    /* Adjust topbar */
    .topbar {
        left: 0;
        padding-left: 4rem;
    }
    
    .topbar-user-info {
        display: none;
    }
    
    /* Enable horizontal scroll for tables */
    .table-responsive {
        overflow-x: auto;
    }
}

/* ===== MOBILE (≤767px) ===== */
@media (max-width: 767px) {
    :root {
        --sidebar-width: 0px;
        --topbar-height: 60px;
    }
    
    /* Hide sidebar by default */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1100;
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    /* Show sidebar toggle button */
    .sidebar-toggle {
        display: block;
    }
    
    /* Full width content */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Adjust topbar for mobile */
    .topbar {
        left: 0;
        padding: 0.75rem 1rem 0.75rem 3.5rem;
        height: var(--topbar-height);
        width: 100%;
        max-width: 100%;
    }
    
    .topbar-search {
        display: none;
    }
    
    .topbar-notification {
        padding: 0.5rem;
    }
    
    .topbar-user-info {
        display: none;
    }
    
    .topbar-title h3 {
        font-size: 1.125rem;
    }
    
    /* Stack all cards vertically */
    .row.g-4 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .row,
    .row.g-4 {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        min-width: 0;
    }
    
    /* Reduce card padding */
    .card-custom {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .stat-card {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .card-header-custom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    /* Full width inputs and selects */
    .form-control-custom,
    .form-select-custom {
        width: 100%;
        max-width: 100%;
    }
    
    /* Adjust chart containers */
    .chart-container {
        height: 250px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Hide sidebar footer on very small screens */
    .sidebar-footer {
        padding: 0.75rem;
    }
    
    .sidebar-brand {
        padding: 1.25rem 1rem;
    }
    
    .sidebar-item {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ===== VERY SMALL MOBILE (≤480px) ===== */
@media (max-width: 480px) {
    .topbar-actions > *:not(:last-child):not(.topbar-notification) {
        display: none;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .auth-card {
        padding: 1.5rem 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Make action buttons stack */
    .table-card-header {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .table-card-header .btn-custom {
        width: 100%;
        max-width: 100%;
    }
    
    /* Stack button groups */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn-custom {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ===== BOOTSTRAP GRID RESPONSIVE FIXES ===== */
.container,
.container-fluid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-left: 15px;
    padding-right: 15px;
}

.row {
    width: 100%;
    max-width: 100%;
    margin-left: -15px;
    margin-right: -15px;
    display: flex;
    flex-wrap: wrap;
}

[class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    min-width: 0;
    flex-shrink: 0;
}

/* Fix grid gutters */
.g-4,
.gx-4 {
    --bs-gutter-x: 1.5rem;
}

.g-4,
.gy-4 {
    --bs-gutter-y: 1.5rem;
}

@media (max-width: 767px) {
    .g-4,
    .gx-4 {
        --bs-gutter-x: 1rem;
    }
    
    .g-4,
    .gy-4 {
        --bs-gutter-y: 1rem;
    }
    
    .container,
    .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .topbar,
    .sidebar-toggle,
    .btn-custom {
        display: none !important;
    }
    
    .content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card-custom {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ===== BOOTSTRAP GRID RESPONSIVE FIXES ===== */
.container,
.container-fluid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.row {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
}

[class*="col-"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

/* Fix flexbox/grid child shrinking */
.d-flex > *,
.d-grid > * {
    min-width: 0;
}

/* Ensure no element exceeds viewport */
* {
    max-width: 100%;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Fix specific components */
.card-custom,
.stat-card,
.table-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.card-header-custom,
.table-card-header {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Fix button groups */
.btn-group {
    max-width: 100%;
    overflow-x: auto;
}

/* Fix form elements */
input,
select,
textarea,
.form-control,
.form-select {
    max-width: 100%;
}

@media (max-width: 767px) {
    /* Force all containers to stay within viewport */
    .container,
    .container-fluid,
    .row,
    [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Remove negative margins on mobile */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ===== QUICK ACTIONS - MODERN STYLE ===== */
.hover-lift.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift.transition-all:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.hover-lift.transition-all:active {
    transform: translateY(-2px);
}

/* Ensure proper card grid layout */
@media (min-width: 992px) {
    .stat-card {
        min-height: 160px;
    }
}

@media (max-width: 991px) {
    .stat-card-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 575px) {
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .stat-card-title {
        font-size: 0.75rem;
    }
}

