/* ═══════════════════════════════════════════════════════════════════
   SysFleet — Premium Dashboard Styles
   Modern fleet management system with dark sidebar & light content
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ──────────────────────────────────────── */
:root {
    /* Sidebar */
    --sidebar-bg: #1f2937;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 72px;
    --sidebar-text: #cbd5e1;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(20, 184, 166, 0.18);
    --sidebar-active-text: #5eead4;
    --sidebar-border: rgba(255, 255, 255, 0.12);

    /* Accent */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --primary-glow: rgba(99, 102, 241, 0.25);

    /* Status */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Content area */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbfc;
    --text-primary: #1a1d2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Topbar */
    --topbar-height: 64px;
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --topbar-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); }

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-base);
    overflow: hidden;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 64px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
}

.logo-icon {
    font-size: 28px;
    color: var(--primary);
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.company-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .submenu-arrow,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ─── Sidebar Nav ────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-search .material-icons-outlined {
    font-size: 18px;
    color: var(--sidebar-text);
}

.sidebar-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 13px;
}

.sidebar-search input::placeholder {
    color: var(--sidebar-text);
}

.nav-section-title {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 14px 6px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-list {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active,
.nav-link.active:hover {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--sidebar-active-text);
    border-radius: 0 3px 3px 0;
}

.nav-link .material-icons-outlined {
    font-size: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 18px !important;
    transition: transform var(--transition-fast);
}

.has-submenu.open > .nav-link .submenu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow), opacity var(--transition-base);
    opacity: 0;
    padding-left: 0;
}

.has-submenu.open > .submenu {
    max-height: 2400px;
    opacity: 1;
    overflow: visible;
}

.submenu li a {
    display: block;
    padding: 7px 14px 7px 48px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 400;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.submenu-group-title {
    display: block;
    padding: 10px 14px 6px 32px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submenu li a::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: var(--sidebar-text);
    border-radius: 50%;
    opacity: 0.4;
    transition: all var(--transition-fast);
}

.submenu li a:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.04);
}
.submenu li a:hover::before {
    opacity: 1;
    background: var(--primary);
}

.submenu li a.active {
    color: var(--sidebar-active-text);
    font-weight: 500;
}
.submenu li a.active::before {
    opacity: 1;
    background: var(--sidebar-active-text);
    box-shadow: 0 0 6px rgba(94, 234, 212, 0.35);
}

/* ─── Sidebar Footer / User Card ─────────────────────────────────── */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--sidebar-border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    transition: opacity var(--transition-fast);
}

.user-name {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--sidebar-text);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    color: var(--sidebar-text);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: auto;
}
.logout-btn:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 28px;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--topbar-shadow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}
.breadcrumb span + span::before {
    content: '›';
    margin: 0 8px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-greeting {
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.topbar-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ─── Page Content ───────────────────────────────────────────────── */
.page-content {
    padding: 28px;
    max-width: 1440px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px 24px 24px;
}

/* Stats Cards Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.primary::after { background: linear-gradient(90deg, var(--primary), #818cf8); }
.stat-card.success::after { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::after { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::after { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.info::after { background: linear-gradient(90deg, var(--info), #60a5fa); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.info .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-icon .material-icons-outlined { font-size: 24px; }

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Grid Layouts ───────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}
.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Toolbar (search + filters + actions) ───────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 280px;
}

.search-box .material-icons-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn .material-icons-outlined {
    font-size: 18px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #059669;
    color: #fff;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}
.btn-warning:hover {
    background: #d97706;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm .material-icons-outlined {
    font-size: 16px;
}

.btn-icon {
    padding: 7px;
    width: 34px;
    height: 34px;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 6px;
}

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all var(--transition-fast);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    border-radius: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.help-text {
    color: var(--text-muted);
    font-size: 12px;
}

.company-logo-preview {
    min-height: 110px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 10px;
    color: var(--text-muted);
}

.company-logo-preview img {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 50px;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* ─── Tabs ───────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn .material-icons-outlined {
    font-size: 18px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

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

/* ─── Flash Messages ─────────────────────────────────────────────── */
.flash-container {
    padding: 16px 28px 0;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 13.5px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
    border: 1px solid;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success { background: var(--success-bg); color: #065f46; border-color: rgba(16,185,129,0.2); }
.flash-danger { background: var(--danger-bg); color: #991b1b; border-color: rgba(239,68,68,0.2); }
.flash-warning { background: var(--warning-bg); color: #92400e; border-color: rgba(245,158,11,0.2); }
.flash-info { background: var(--info-bg); color: #1e40af; border-color: rgba(59,130,246,0.2); }

.flash-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 2px;
    display: flex;
}
.flash-close:hover { opacity: 1; }

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    padding: 16px 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.pagination .active-page {
    background: var(--primary);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Auth Layout ────────────────────────────────────────────────── */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f1117 0%, #1a1d2e 50%, #0f1117 100%);
    position: relative;
    overflow: hidden;
}

.auth-layout::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
    animation: aurora 15s ease-in-out infinite alternate;
}

@keyframes aurora {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-30px, 20px) rotate(3deg); }
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    padding: 44px 36px;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    font-size: 44px;
    display: block;
    margin: 0 auto 12px;
}

.auth-logo h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--sidebar-text);
    font-size: 14px;
    margin-top: 6px;
}

.auth-card .form-group {
    margin-bottom: 20px;
}

.auth-card .form-label {
    color: #94a3b8;
}

.auth-card .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 16px;
}

.auth-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.auth-card .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    margin-top: 8px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-remember label {
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
}

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .material-icons-outlined {
    font-size: 56px;
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* ─── Error Pages ────────────────────────────────────────────────── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.error-page h1 {
    font-size: 80px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -3px;
}

.error-page h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 12px 0 8px;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ─── Permissions Grid (Role form) ───────────────────────────────── */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.permission-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.permission-item label {
    font-size: 13px;
    cursor: pointer;
    flex: 1;
}

.permission-module {
    font-weight: 600;
    color: var(--text-primary);
}

.permission-action {
    color: var(--text-secondary);
}

/* ─── Photo Gallery ──────────────────────────────────────────────── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.photo-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card .photo-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.photo-card:hover .photo-actions {
    opacity: 1;
}

.photo-primary {
    position: absolute;
    bottom: 8px;
    left: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .mobile-toggle { display: flex; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 100%; }
    .page-header { flex-direction: column; align-items: flex-start; }

    .has-submenu.open > .submenu {
        max-height: 55vh;
        overflow-y: auto;
    }

    /* Mobile overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    .sidebar.mobile-open ~ .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 32px 24px; }
    .topbar-greeting { display: none; }
}
