/* ===== CSS Variables ===== */
:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* ===== Reset & Base Styles ===== */
* {
    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%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Language Switcher ===== */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.lang-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: var(--bg-secondary);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
}

/* ===== Desktop Warning ===== */
.desktop-warning {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    font-size: 14px;
}

@media (min-width: 768px) {
    .desktop-warning {
        display: block;
    }
}

/* ===== Auth Page ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-header {
    text-align: center;
    padding: 40px 30px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.brand-logo {
    display: inline-block;
    width: 120px;
    height: 120px;
    margin-bottom: 12px;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.brand-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.auth-form {
    padding: 30px;
}

.form-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.checkbox-group {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-footer {
    text-align: center;
    margin-top: 24px;
}

.link-text {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.link-text:hover {
    text-decoration: underline;
}

/* ===== Status Text ===== */
.status-text {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-text.success {
    color: var(--success-color);
}

.status-text.error {
    color: var(--error-color);
}

/* ===== Photo Preview ===== */
.photo-preview {
    margin-top: 12px;
    display: none;
    border-radius: var(--radius);
    overflow: hidden;
}

.photo-preview.active {
    display: block;
}

.photo-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.modal-body video {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    background: #000;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn {
    flex: 1;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    transition: bottom 0.3s;
    max-width: 90%;
}

.toast.active {
    bottom: 30px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast-content {
    font-size: 14px;
    font-weight: 500;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Dashboard Styles (for next page) ===== */
.dashboard-page {
    background: var(--bg-secondary);
}

.dashboard-container {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 0 80px 0;
}

.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
}

.user-greeting {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.user-pinfl {
    font-size: 20px;
    font-weight: 600;
}

.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin: 16px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.logout-link {
    color: var(--bg-primary);
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f00;
    padding: 10px 30px;
    border-radius: 25px;
    width: max-content;
    gap: 6px;
    cursor: pointer;
    margin: auto;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* ===== Check-in Time Slots ===== */
.checkin-time-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.checkin-time-slot:last-child {
    margin-bottom: 0;
}

.time-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.time-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.time-status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.time-status.completed {
    background: #D1FAE5;
    color: var(--success-color);
}

.time-status.pending {
    background: #FEF3C7;
    color: var(--warning-color);
}

/* ===== Statistics Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-value.success {
    color: var(--success-color);
}

.stat-value.error {
    color: var(--error-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== Check-in List ===== */
.checkin-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

.checkin-item:last-child {
    border-bottom: none;
}

.checkin-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkin-icon.verified {
    background: #D1FAE5;
    color: var(--success-color);
}

.checkin-icon.pending {
    background: #FEF3C7;
    color: var(--warning-color);
}

.checkin-icon.failed {
    background: #FEE2E2;
    color: var(--error-color);
}

.checkin-details {
    flex: 1;
}

.checkin-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.checkin-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.checkin-location {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* ===== Button Icon ===== */
.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
}

/* ===== Check-in Step ===== */
.checkin-step h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* ===== Profile Info ===== */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.profile-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.profile-value.muted {
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
}

.profile-image {
    margin-top: 8px;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 300px;
}

.profile-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .auth-container {
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .language-switcher {
        top: 10px;
        right: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
