/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables - Light Theme */
:root {
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --primary-light: #3d8bfd;
    --secondary: #198754;
    --accent: #ffc107;
    --danger: #dc3545;
    --dark: #212529;
    --light: #f8f9fa;
    --white: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --card-bg: #ffffff;
    --body-bg: #f5f7fa;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo svg {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding: 6px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-balance {
    background: var(--light);
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.user-balance span {
    color: var(--secondary);
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.user-avatar:hover {
    opacity: 0.9;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    min-width: 180px;
    display: none;
    animation: fadeIn 0.15s ease;
    box-shadow: var(--shadow-lg);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--light);
}

.dropdown-menu svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-success:hover {
    background: #157347;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #bb2d3b;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.card-title svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-control::placeholder {
    color: #adb5bd;
}

.input-group {
    position: relative;
}

.input-group .form-control {
    padding-left: 42px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

/* Radio & Checkbox */
.radio-group,
.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-item input,
.checkbox-item input {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-item input {
    border-radius: 4px;
}

.radio-item input:checked,
.checkbox-item input:checked {
    border-color: var(--primary);
    background: var(--primary);
}

.radio-item input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.checkbox-item input:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* File Input */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    background: var(--light);
}

.file-upload:hover {
    border-color: var(--primary);
    background: #e7f1ff;
}

.file-upload.has-file {
    border-color: var(--secondary);
    background: #d1e7dd;
}

.file-upload input {
    display: none;
}

.file-upload svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.file-upload p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.file-upload .file-name {
    color: var(--secondary);
    font-weight: 500;
    margin-top: 8px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: var(--light);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--light);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-completed,
.badge-success {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-failed,
.badge-danger {
    background: #f8d7da;
    color: #842029;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card .card {
    padding: 35px;
    border: none;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 25px;
}

.auth-header .logo {
    justify-content: center;
    margin-bottom: 20px;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    padding: 25px 0;
}

.dashboard-header {
    margin-bottom: 25px;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: var(--text);
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-icon.purple { background: var(--primary); }
.stat-icon.green { background: var(--secondary); }
.stat-icon.orange { background: var(--accent); }
.stat-icon.blue { background: #0dcaf0; }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text);
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* QR Section */
.qr-section {
    text-align: center;
    padding: 20px;
}

.qr-code {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.qr-code img {
    max-width: 220px;
    height: auto;
}

.qr-info {
    background: var(--light);
    border-radius: 8px;
    padding: 15px;
    text-align: left;
}

.qr-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.qr-info-item:last-child {
    border-bottom: none;
}

.qr-info-item span:first-child {
    color: var(--text-muted);
}

.qr-info-item span:last-child {
    font-weight: 600;
    color: var(--primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.tab-btn:hover {
    background: var(--light);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-content.active {
    display: block;
}

/* Image Preview */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.image-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--light);
    border: 1px solid var(--border);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Alert & Toast */
.alert {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.alert-success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    color: #664d03;
}

.alert-info {
    background: #cff4fc;
    border: 1px solid #b6effb;
    color: #055160;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    font-size: 0.9rem;
}

.toast.success {
    border-left: 4px solid var(--secondary);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
}

.modal-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Spinner */
.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-content .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
}

.loading-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .image-preview-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
    }

    .modal {
        max-width: 95%;
        margin: 20px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.4;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
    font-size: 1.1rem;
}

/* Admin Sidebar */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.admin-sidebar .logo {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.admin-nav {
    list-style: none;
}

.admin-nav li {
    margin-bottom: 4px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.admin-nav a:hover {
    background: var(--light);
    color: var(--text);
}

.admin-nav a.active {
    background: var(--primary);
    color: white;
}

.admin-nav svg {
    width: 18px;
    height: 18px;
}

.admin-content {
    flex: 1;
    margin-left: 240px;
    padding: 25px;
    background: var(--body-bg);
}

@media (max-width: 1024px) {
    .admin-sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .admin-content {
        margin-left: 0;
    }

    .admin-layout {
        flex-direction: column;
    }
}

/* OTP Input */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    transition: all 0.2s ease;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Session Badge */
.session-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #d1e7dd;
    border: 1px solid #badbcc;
    border-radius: 8px;
    color: #0f5132;
    font-weight: 500;
    font-size: 0.9rem;
}

.session-badge svg {
    width: 18px;
    height: 18px;
}

/* Welcome Page */
.welcome-section {
    text-align: center;
    padding: 60px 20px;
}

.welcome-section h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--text);
}

.welcome-section p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 30px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.quick-action-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text);
}

.quick-action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.quick-action-card svg {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 12px;
}

.quick-action-card h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.quick-action-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}
