/* ==================== CSS VARIABLES ==================== */
:root {
    /* Brand Colors - #9393c9 Based */
    --primary: #9393c9;
    --primary-dark: #7b7bb5;
    --primary-darker: #6969a3;
    --primary-light: #aeaed8;
    --primary-bg: #f4f4fa;

    --success: #059669;
    --success-dark: #047857;
    --success-light: #10b981;
    --success-bg: #ecfdf5;

    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --danger-light: #ef4444;
    --danger-bg: #fef2f2;

    --warning: #d97706;
    --warning-dark: #b45309;
    --warning-light: #f59e0b;
    --warning-bg: #fffbeb;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Text - Black for readability */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-brand: 0 4px 14px rgba(147, 147, 201, 0.35);

    --transition: all 0.2s ease;
}

/* ==================== GLOBAL RESET ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== TYPOGRAPHY ==================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 147, 201, 0.3);
}

.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    color: white !important;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success) !important;
    color: white !important;
    border: none !important;
}

.btn-success:hover {
    background: var(--success-dark) !important;
    color: white !important;
}

.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    border: none !important;
}

.btn-danger:hover {
    background: var(--danger-dark) !important;
    color: white !important;
}

.btn-warning {
    background: var(--warning) !important;
    color: white !important;
    border: none !important;
}

.btn-warning:hover {
    background: var(--warning-dark) !important;
    color: white !important;
}

.btn-secondary {
    background: var(--gray-500) !important;
    color: white !important;
    border: none !important;
}

.btn-secondary:hover {
    background: var(--gray-600) !important;
    color: white !important;
}

.btn-light {
    background: white !important;
    color: var(--gray-700) !important;
    border: 1px solid var(--gray-300) !important;
}

.btn-light:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-400) !important;
}

/* Outline Buttons */
.btn-outline-primary {
    background: transparent !important;
    color: var(--primary) !important;
    border: 1.5px solid var(--primary) !important;
}

.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: white !important;
}

.btn-outline-secondary {
    background: transparent !important;
    color: var(--gray-600) !important;
    border: 1.5px solid var(--gray-300) !important;
}

.btn-outline-secondary:hover {
    background: var(--gray-100) !important;
    color: var(--gray-700) !important;
}

.btn-outline-danger {
    background: transparent !important;
    color: var(--danger) !important;
    border: 1.5px solid var(--danger) !important;
}

.btn-outline-danger:hover {
    background: var(--danger) !important;
    color: white !important;
}

.btn-outline-light {
    background: transparent !important;
    color: white !important;
    border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
}

.btn-outline-light:hover {
    background: white !important;
    color: var(--gray-800) !important;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ==================== CARDS ==================== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
}

.card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
}

/* ==================== FORMS ==================== */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition);
    color: var(--gray-800);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #9393c9;
    box-shadow: 0 0 0 3px rgba(147, 147, 201, 0.15);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ==================== TABLES ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--gray-50);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.bg-success {
    background: var(--success-bg) !important;
    color: var(--success) !important;
}

.bg-danger {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
}

.bg-warning {
    background: var(--warning-bg) !important;
    color: var(--warning) !important;
}

.bg-primary {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
}

.bg-secondary {
    background: var(--gray-100) !important;
    color: var(--gray-600) !important;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    border: none;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-dark);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-dark);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-dark);
}

.alert-info {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

/* ==================== NAV TABS ==================== */
.nav-tabs {
    border-bottom: 1px solid var(--gray-200);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    background: transparent !important;
    border-radius: 0 !important;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover {
    color: var(--primary) !important;
    background: var(--gray-50) !important;
}

.nav-tabs .nav-link.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
    background: transparent !important;
}

.nav-tabs button.nav-link {
    color: var(--gray-600) !important;
    background: transparent !important;
}

.nav-tabs button.nav-link:hover {
    color: var(--primary) !important;
}

.nav-tabs button.nav-link.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
}

/* ==================== NAV PILLS ==================== */
.nav-pills .nav-link {
    color: var(--gray-600);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.nav-pills .nav-link:hover {
    background: var(--gray-100);
}

.nav-pills .nav-link.active {
    background: var(--primary);
    color: white;
}

/* ==================== PAGINATION ==================== */
.pagination {
    gap: 0.25rem;
}

.pagination .page-link {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.pagination .page-link:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--gray-300);
    background: var(--gray-50);
}

/* ==================== NAVBAR ==================== */
.navbar-main {
    background: #111827 !important;
    padding: 0.75rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.navbar-main .navbar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem;
    color: white !important;
    text-decoration: none !important;
    font-weight: 600;
}

.navbar-main .navbar-brand img {
    height: 32px;
}

.navbar-main .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem !important;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.navbar-main .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.navbar-main .nav-link.active {
    color: white !important;
    background: #9393c9 !important;
}

.navbar-main .navbar-text {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.875rem;
}

.navbar-main .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.navbar-main .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

@media (max-width: 991.98px) {
    .navbar-main .navbar-collapse {
        background: #1f2937;
        margin-top: 0.75rem;
        padding: 1rem;
        border-radius: 10px;
    }

    .navbar-main .nav-link {
        padding: 0.625rem 1rem !important;
        margin: 0.125rem 0;
    }

    .navbar-main .navbar-text {
        padding: 0.5rem 1rem;
    }
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-900);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
}

.login-logo-box img {
    height: 36px;
}

.login-logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7b7bb5 0%, #9393c9 100%);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(147, 147, 201, 0.3);
}

.login-logo-container img {
    height: 36px;
}

/* Direct logo without background box */
.login-logo-img {
    height: 60px;
    max-width: 200px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(147, 147, 201, 0.3));
}

.login-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-title h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: #111827;
}

.login-title p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.security-badge {
    display: inline-block;
    background: #f4f4fa;
    color: #7b7bb5;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
}

/* ==================== REGISTRATION PAGE ==================== */
.register-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 650px;
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.4s ease-out;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .register-card {
        padding: 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

/* ==================== STATS CARDS ==================== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-primary .stat-card-icon,
.stats-card-primary .stat-card-icon,
.stats-card-icon {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-card-success .stat-card-icon,
.stats-card-success .stat-card-icon {
    background: var(--success-bg);
    color: var(--success);
}

.stat-card-warning .stat-card-icon,
.stats-card-warning .stat-card-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-card-info .stat-card-icon,
.stats-card-info .stat-card-icon {
    background: #e0f2fe;
    color: #0284c7;
}

.stats-card-primary,
.stats-card-success,
.stats-card-warning,
.stats-card-info {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
}

.stat-card h3,
.stat-card h4 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
    color: var(--gray-900);
}

.stat-card p {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin: 0;
}

/* ==================== SCANNER PAGE ==================== */
.scanner-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.scanner-header {
    text-align: center;
    margin-bottom: 1rem;
}

.scanner-header h4 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.scanner-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
}

#reader,
.qr-reader-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gray-900);
    position: relative;
}

#result-area {
    margin-top: 1rem;
    padding: 0.875rem;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.875rem;
}

/* ==================== BULK ACTIONS BAR ==================== */
.bulk-actions-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gray-900);
    color: white;
    padding: 0.875rem 1.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1050;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

/* ==================== FOOTER ==================== */
.app-footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 1rem 0;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.footer-link {
    color: var(--gray-700);
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary);
}

/* ==================== UTILITIES ==================== */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.sort-icon-muted {
    opacity: 0.4;
    font-size: 0.875em;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.8125rem;
    }

    .table th,
    .table td {
        padding: 0.625rem 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
    }

    .btn-sm {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .login-card {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .d-flex.gap-2 {
        gap: 0.375rem !important;
    }

    .navbar-main .nav-link {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.8125rem;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== CAPTCHA ==================== */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.captcha-container img {
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

/* ==================== MISC ==================== */
.tenant-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.event-logo {
    height: 60px;
    max-width: 280px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.info-box {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.8125rem;
}

.logo-preview-box {
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-lg {
    max-height: 80px;
    max-width: 100%;
}

.color-preview {
    width: 60px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.color-input-lg {
    width: 80px !important;
    height: 40px !important;
}

.header-badge {
    background: var(--success);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.checkbox-cell {
    width: 40px;
}

.search-input-wide {
    min-width: 180px;
}

.img-thumbnail-sm {
    height: 50px;
    object-fit: contain;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* ==================== LINKS ==================== */
a {
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== SELECTION ==================== */
::selection {
    background: rgba(147, 147, 201, 0.25);
    color: var(--gray-900);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==================== SELECTION CARDS ==================== */
.selection-card {
    position: relative;
    padding-left: 3.25rem !important;
    border: 1.5px solid var(--gray-300) !important;
    transition: var(--transition);
}

.selection-card .form-check-input {
    position: absolute;
    left: 1.25rem;
    top: 1.5rem;
    margin: 0;
    float: none;
    cursor: pointer;
}

.selection-card .form-check-label {
    cursor: pointer;
}

.selection-card.border-primary {
    border-color: var(--primary) !important;
    background-color: var(--primary-bg) !important;
}

.selection-card:hover {
    border-color: var(--primary) !important;
}

/* ==================== BRAND ACCENT CLASSES ==================== */
.text-brand {
    color: var(--primary) !important;
}

.bg-brand {
    background: var(--primary) !important;
    color: white !important;
}

.bg-brand-light {
    background: var(--primary-bg) !important;
    color: var(--primary) !important;
}

.border-brand {
    border-color: var(--primary) !important;
}