/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

:root {
    /* Primary Palette — vibrant electric blue matching MaScan brand */
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --secondary-color: #7C3AED;
    --accent-color: #06B6D4;

    /* Semantic Colors */
    --danger-color: #EF4444;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;

    /* Neutrals */
    --light-gray: #F8FAFF;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --border-radius-sm: 6px;
    --transition: all 0.25s cubic-bezier(.4,0,.2,1);

    /* Light Mode Theme */
    --bg-color: #EFF4FF;
    --text-color: #1E293B;
    --text-secondary: #64748B;
    --navbar-bg: rgba(255, 255, 255, 0.92);
    --navbar-text: #64748B;
    --card-bg: #FFFFFF;
    --input-bg: #F8FAFF;
    --input-border: #DBEAFE;
    --table-bg: #FFFFFF;
    --table-hover: #F0F5FF;
    --sidebar-bg: #FFFFFF;
    --border-color: #DBEAFE;
    --shadow: 0 1px 3px rgba(37,99,235,0.06), 0 4px 12px rgba(37,99,235,0.04);
    --shadow-lg: 0 4px 24px rgba(37,99,235,0.10);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

html.dark-mode {
    /* Dark Mode Colors */
    --bg-color: #0F172A;
    --text-color: #E2E8F0;
    --text-secondary: #94A3B8;
    --navbar-bg: rgba(15, 23, 42, 0.92);
    --navbar-text: #94A3B8;
    --card-bg: #1E293B;
    --input-bg: #1E293B;
    --input-border: #334155;
    --table-bg: #1E293B;
    --table-hover: #263548;
    --sidebar-bg: #1E293B;
    --border-color: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.35);
    --primary-color: #3B82F6;
    --primary-hover: #2563EB;
    --primary-light: rgba(59, 130, 246, 0.12);
    --secondary-color: #8B5CF6;
    --accent-color: #22D3EE;
    --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
    background-size: 40px 40px;
}

html.dark-mode body {
    background-image: none;
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--navbar-text); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    animation: fadeIn 0.4s ease-out;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 60%, #2563EB 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.30);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

html.dark-mode .navbar {
    background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 60%, #1D4ED8 100%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 36px;
    width: 100%;
    height: auto;
}

.navbar-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.navbar-brand a {
    text-decoration: none;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-size: 1.35em;
    color: #FFFFFF;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
}

.navbar-brand a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.logo-text {
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.logo-text img {
    height: 34px;
    width: auto;
    object-fit: contain;
    display: block;
}

.navbar-menu {
    display: flex;
    gap: 6px;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.nav-link {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.80);
    font-weight: 500;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: var(--transition);
    padding: 8px 14px;
    border-radius: 99px;
    position: relative;
    white-space: nowrap;
}

.nav-icon {
    font-size: 0.92em;
    width: 16px;
    text-align: center;
    opacity: 0.85;
    transition: var(--transition);
}

.nav-link::after {
    display: none;
}

.nav-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
}

.nav-link:hover .nav-icon {
    opacity: 1;
}

.nav-link.active, .nav-link[aria-current="page"] {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.22);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.user-info {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 99px;
    transition: var(--transition);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

/* Theme Toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: var(--transition);
    padding: 7px 10px;
    border-radius: 99px;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.theme-toggle i {
    font-size: 0.95em;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #FFFFFF;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 8px 12px;
    gap: 5px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.22);
}

.hamburger-menu span {
    width: 22px;
    height: 2px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu:hover span {
    background: #FFFFFF;
}

/* Buttons */
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--danger-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 99px;
    font-size: 0.92em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1D4ED8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.30);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.40);
    filter: brightness(1.06);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.20);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    padding: 7px 14px;
    font-size: 0.85em;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 99px;
    transition: var(--transition);
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.85);
    color: white;
    border-color: transparent;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.82em;
    border-radius: var(--border-radius-sm);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    animation: slideInDown 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.92em;
    font-weight: 500;
    transition: opacity 0.3s, transform 0.3s;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    opacity: 0.6;
    color: inherit;
    padding: 0 4px;
    line-height: 1;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--danger-color);
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 3px solid var(--success-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #D97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-left: 3px solid var(--warning-color);
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    color: var(--info-color);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--info-color);
}

html.dark-mode .alert-warning { color: var(--warning-color); }

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--border-radius);
    font-size: 0.95em;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.form-group textarea {
    resize: vertical;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-bg);
    margin: 20px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th {
    background: var(--input-bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92em;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--table-hover);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.2);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
}

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 0;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 460px;
    width: 90%;
    animation: slideUp 0.3s cubic-bezier(.34,1.56,.64,1);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 24px 24px 16px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--danger-color);
    font-size: 1.3em;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-icon i {
    font-size: 20px;
    color: var(--danger-color);
}

html.dark-mode .modal-icon {
    background: rgba(239, 68, 68, 0.15);
}

.modal-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
}

.modal-body {
    padding: 0 24px 20px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.92em;
}

.modal-body p {
    margin: 0;
}

.modal-item-info {
    background: var(--input-bg);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin: 12px 0;
    border-left: 3px solid var(--danger-color);
    font-weight: 500;
    word-break: break-word;
    font-size: 0.92em;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 10px 22px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.modal-btn-cancel {
    background: var(--input-bg);
    color: var(--text-color);
    border: 1.5px solid var(--border-color);
}

.modal-btn-cancel:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.modal-btn-delete {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.modal-btn-delete:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.modal-btn-delete:active {
    transform: translateY(0);
}

.modal-btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

/* Modal Responsive */
@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        max-width: 100%;
        border-radius: var(--border-radius);
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 0 20px 20px;
    }

    .modal-footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
    }

    .modal-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modal-title {
        font-size: 1.05em;
    }
}

/* Details / Collapsible Elements */
details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: var(--transition);
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary::after {
    content: '▼';
    font-size: 0.8em;
    color: var(--text-color);
    transition: transform 0.3s ease;
    margin-left: 12px;
    flex-shrink: 0;
}

details[open] > summary::after {
    transform: rotate(-180deg);
}

details > summary h2 {
    margin: 0;
    flex: 1;
}

/* Responsive */
@media (max-width: 1200px) {
    .navbar-container {
        gap: 24px;
        padding: 10px 20px;
    }

    .navbar-menu {
        gap: 4px;
    }

    .nav-link {
        font-size: 0.85em;
        padding: 7px 10px;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        gap: 12px;
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .hamburger-menu {
        display: flex;
        order: 3;
    }

    .navbar-brand {
        order: 1;
    }

    .navbar-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(180deg, #1D4ED8, #2563EB);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-bottom: none;
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
        order: 4;
    }

    .navbar-menu.active {
        max-height: 500px;
    }

    .nav-link {
        font-size: 0.9em;
        padding: 12px 20px;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        background: transparent;
        display: flex;
        width: 100%;
        text-align: left;
        color: rgba(255, 255, 255, 0.85);
    }

    .nav-link::after {
        display: none;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #FFFFFF;
    }

    .navbar-right {
        position: static;
        border-left: none;
        border-top: none;
        padding: 0;
        gap: 8px;
        width: auto;
        max-height: none;
        overflow: visible;
        background: transparent;
        order: 2;
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-left: auto;
    }
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100% - 48px);
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    min-width: 280px;
}

html.dark-mode .toast {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-dismissing {
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease-in;
}

.toast-icon {
    font-size: 1.25em;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-message {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.3em;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastCountdown linear forwards;
}

@keyframes toastCountdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Toast type colors */
.toast-success { border-left: 4px solid var(--success-color); }
.toast-success .toast-icon { color: var(--success-color); }
.toast-success .toast-progress-bar { background: var(--success-color); }

.toast-danger { border-left: 4px solid var(--danger-color); }
.toast-danger .toast-icon { color: var(--danger-color); }
.toast-danger .toast-progress-bar { background: var(--danger-color); }

.toast-warning { border-left: 4px solid #F59E0B; }
.toast-warning .toast-icon { color: #D97706; }
.toast-warning .toast-progress-bar { background: #F59E0B; }

.toast-info { border-left: 4px solid var(--primary-color); }
.toast-info .toast-icon { color: var(--primary-color); }
.toast-info .toast-progress-bar { background: var(--primary-color); }

@media (max-width: 480px) {
    #toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
    .toast { min-width: auto; }
}

@media (max-width: 480px) {
    .user-info {
        display: none;
    }

    .btn-logout {
        padding: 5px 10px;
        font-size: 0.78em;
    }

    .theme-toggle {
        padding: 5px 8px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 8px 12px;
        gap: 8px;
    }

    .navbar-brand a {
        font-size: 1.1em;
        padding: 6px 8px;
    }

    .logo-text {
        font-size: 0.95em;
        gap: 6px;
    }

    .logo-text img {
        height: 28px;
    }

    .nav-link {
        font-size: 0.85em;
        padding: 12px 16px;
    }

    .navbar-right {
        gap: 6px;
        margin-left: auto;
    }

    .theme-toggle {
        padding: 5px 8px;
        font-size: 0.85em;
    }

    .user-info {
        display: none;
    }

    .btn-logout {
        padding: 4px 8px;
        font-size: 0.7em;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .action-buttons {
        flex-direction: column !important;
    }

    .action-buttons .btn {
        min-width: auto;
    }
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.8em;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.app-footer span {
    font-weight: 600;
    color: var(--primary-color);
}

/* ──────────────────────────────────────────────────────────────
   Section headings — colored left-bar accent
────────────────────────────────────────────────────────────── */
.container h2,
.container h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--text-color);
}

.container h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.1em;
    min-height: 20px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    flex-shrink: 0;
}

/* Table header gradient */
thead th {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.05)) !important;
    color: var(--primary-color) !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78em;
    border-bottom: 2px solid rgba(37, 99, 235, 0.18) !important;
}

html.dark-mode thead th {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.08)) !important;
    color: var(--primary-color) !important;
    border-bottom-color: rgba(59, 130, 246, 0.25) !important;
}

/* Scanner Laser Line Additions */
.laser-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #22c55e;
    box-shadow: 0 0 10px #22c55e, 0 0 20px #22c55e;
    z-index: 10;
    animation: scan-laser 2.5s infinite linear;
    pointer-events: none;
}

@keyframes scan-laser {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.qr-reader-wrapper video {
    border-radius: 12px;
}

/* Page transition */
.page-enter {
    animation: pageEnter 0.4s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Mobile Responsive Fixes ─── */
@media (max-width: 768px) {
    .container {
        padding: 16px 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px 10px;
    }
}

/* Responsive table wrappers */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
}

.table-responsive .table {
    margin: 0;
}
