/**
 * Weekly Feedback - Clean Modern Design
 * v2.4
 */

/* ========================================
   VARIABLES
   ======================================== */

:root {
    --white: #ffffff;
    --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;

    --brand-navy: #272251;
    --brand-yellow: #ffd618;
    --brand-green: #10b981;
    --brand-red: #ef4444;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

/* ========================================
   RESET & BASE
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

/* ========================================
   LAYOUT
   ======================================== */

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.logo:hover {
    background: var(--gray-50);
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.admin-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
}

.admin-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.admin-toggle.active {
    background: var(--brand-navy);
    color: var(--white);
}

/* ========================================
   ADMIN PANEL
   ======================================== */

.admin-panel {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.admin-panel.open {
    max-height: 300px;
}

.admin-panel-content {
    padding: 20px 24px;
    text-align: center;
}

.admin-panel-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.admin-panel-content p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.btn-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--brand-navy);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-admin:hover {
    background: #3a3470;
}

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

#reportStatus {
    margin-top: 12px;
    font-size: 14px;
}

#reportStatus.success { color: var(--brand-green); }
#reportStatus.error { color: var(--brand-red); }

#reportStatus a {
    color: var(--brand-navy);
    font-weight: 500;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 48px;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    width: 100%;
    max-width: 520px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-content {
    padding: 32px;
}

.auth-content {
    text-align: center;
}

.auth-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-content p {
    font-size: 15px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    color: var(--gray-500);
    font-size: 14px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--brand-navy);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

#g_id_signin {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.auth-help {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

#authError .error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-top: 16px;
}

.card-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--gray-100);
    text-align: center;
}

/* ========================================
   PROGRESS
   ======================================== */

.progress {
    padding: 20px 32px 0;
}

.progress-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.progress-track {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--brand-navy);
    border-radius: 2px;
    width: 0;
    transition: width 0.3s ease;
}

/* ========================================
   QUESTIONS
   ======================================== */

.questions {
    padding: 24px 32px 32px;
}

.question {
    display: none;
    animation: fadeIn 0.2s ease;
}

.question.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-title {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.question-hint {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

textarea {
    width: 100%;
    min-height: 140px;
    padding: 14px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--white);
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:hover {
    border-color: var(--gray-300);
}

textarea:focus {
    outline: none;
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 3px rgba(39, 34, 81, 0.1);
}

textarea::placeholder {
    color: var(--gray-400);
}

.question-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.char-count {
    font-size: 12px;
    color: var(--gray-400);
}

.question-nav {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn-primary,
.btn-secondary {
    height: 44px;
    padding: 0 24px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.btn-primary {
    flex: 1;
    background: var(--brand-navy);
    color: var(--white);
}

.btn-primary:hover {
    background: #3a3470;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-text {
    background: none;
    border: none;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.15s;
}

.btn-text:hover {
    color: var(--gray-700);
}

.btn-signout:hover {
    color: var(--brand-red);
}

/* ========================================
   PREVIOUS WEEK RECALL
   ======================================== */

.previous-week-recall {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
    font-size: 14px;
}

.previous-week-recall h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.previous-week-recall p {
    color: var(--gray-600);
    line-height: 1.5;
}

.previous-week-recall:empty {
    display: none;
}

/* ========================================
   SUCCESS SCREEN
   ======================================== */

.success-screen {
    text-align: center;
    padding: 40px 0;
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.success-icon {
    width: 56px;
    height: 56px;
    background: #d1fae5;
    color: var(--brand-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
}

.success-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.success-content p {
    font-size: 15px;
    color: var(--gray-500);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 560px) {
    .header {
        padding: 12px 16px;
    }

    .logo-text {
        font-size: 16px;
    }

    .main {
        padding: 20px 16px 32px;
    }

    .card-content,
    .questions {
        padding-left: 20px;
        padding-right: 20px;
    }

    .progress {
        padding-left: 20px;
        padding-right: 20px;
    }

    .card-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .question-nav {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    textarea {
        min-height: 120px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .main {
        padding-bottom: max(48px, env(safe-area-inset-bottom));
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
