:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --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;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 28px;
}

header h1 {
    font-size: 1.75rem;
    color: #fff;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
}

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #86efac;
}

/* Form Sections */
.form-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.form-section h2 {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-100);
}

/* Date Selector */
.date-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.date-option {
    cursor: pointer;
}

.date-option input {
    display: none;
}

.date-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.date-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.date-option input:checked + .date-card {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.date-day {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.date-month {
    font-size: 0.8rem;
    text-align: center;
}

/* Time Grid */
.time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.time-slot {
    padding: 10px 4px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--gray-700);
}

.time-slot:hover:not(.booked):not(.selected) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.time-slot.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.time-slot.booked {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    text-decoration: line-through;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.captcha-group {
    background: var(--gray-50);
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.captcha-group label {
    margin-bottom: 8px;
}

/* Submit Button */
.btn-submit {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.btn-submit:hover {
    background: var(--primary-dark);
}

.btn-submit:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

/* Success Card */
.success-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.success-card h2 {
    color: var(--success);
    margin-bottom: 12px;
}

.success-card p {
    color: var(--gray-600);
    margin-bottom: 24px;
    line-height: 1.8;
}

/* ==================== ADMIN ==================== */
.admin-body {
    background: var(--gray-50);
}

.admin-container {
    max-width: 1000px;
}

/* Login */
.login-card {
    max-width: 400px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h1 {
    color: var(--gray-800);
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.login-card .btn-submit {
    margin-top: 16px;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    color: var(--gray-800);
    font-size: 1.5rem;
}

.admin-actions {
    display: flex;
    gap: 12px;
}

.btn-link {
    padding: 8px 14px;
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-link:hover {
    background: var(--gray-200);
}

.btn-logout {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-logout:hover {
    background: #fca5a5;
}

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

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.stat-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat-card.active {
    border-color: var(--primary);
}

.stat-card:hover {
    border-color: var(--primary-light);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.stat-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Export Bar */
.export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.export-bar span {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.btn-export {
    padding: 8px 14px;
    background: var(--primary-light);
    color: var(--primary-dark);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
    margin-left: 8px;
}

.btn-export:hover {
    background: #bfdbfe;
}

/* Admin Table */
.table-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    color: var(--gray-600);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

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

.admin-table .small-text {
    font-size: 0.78rem;
    color: var(--gray-400);
}

.btn-delete {
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #fca5a5;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: #fff;
    border-radius: var(--radius);
    color: var(--gray-400);
    box-shadow: var(--shadow);
}

/* Settings */
.settings-section {
    margin-top: 24px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-section summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.settings-form {
    padding: 0 16px 16px;
    max-width: 360px;
}

/* Responsive */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .export-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .date-selector {
        grid-template-columns: 1fr;
    }

    .time-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
