/* =============================================
   Hukuk Sınav Analiz - Styles
   Professional legal aesthetic, mobile-first
   ============================================= */

:root {
    --bg: #FAFAF7;
    --bg-card: #FFFFFF;
    --bg-elevated: #F5F4F0;
    --text-primary: #1A1A18;
    --text-secondary: #6B6A65;
    --text-tertiary: #9C9B96;
    --border: #E5E4DF;
    --border-hover: #D1D0CB;
    --accent: #2D5A27;
    --accent-light: #E8F0E7;
    --accent-dark: #1E3D1B;
    --red: #B8352A;
    --red-light: #FCECEA;
    --amber: #9A6B16;
    --amber-light: #FDF5E6;
    --green: #2D6B2E;
    --green-light: #E8F5E9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

/* ---- Navigation ---- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 247, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--text-primary);
}
.logo-icon {
    font-size: 22px;
    filter: grayscale(1);
}
.nav-links { display: flex; gap: 4px; }
.nav-btn {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.nav-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-btn.active { background: var(--accent-light); color: var(--accent-dark); }

/* ---- Views ---- */
.view { display: none; padding: 24px 0 60px; animation: fadeUp 0.3s ease; }
.view.active { display: block; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---- Hero / Headers ---- */
.hero { text-align: center; margin-bottom: 32px; }
.hero h1, .review-header h1, .view > .container > h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.hero p, .review-header p {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 480px;
    margin: 0 auto;
}
.review-header { margin-bottom: 24px; }

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-zone.has-image {
    border-style: solid;
    padding: 0;
}
.upload-icon { color: var(--text-tertiary); margin-bottom: 12px; }
.upload-text { display: block; font-weight: 500; font-size: 15px; margin-bottom: 4px; }
.upload-hint { display: block; font-size: 13px; color: var(--text-tertiary); }
.preview-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius);
}

/* ---- Buttons ---- */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-loader { align-items: center; gap: 8px; }
.btn-loader[hidden] { display: none; }
.btn-primary .btn-loader:not([hidden]) { display: flex; }
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Status Message ---- */
.status-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}
.status-message.error { background: var(--red-light); color: var(--red); }
.status-message.success { background: var(--green-light); color: var(--green); }

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 24px 0;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-size: 28px; }
.accent-green { color: var(--green); }

/* ---- Section ---- */
.section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.section h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 16px;
}

/* ---- Domain Performance Bars ---- */
.domain-bars { display: flex; flex-direction: column; gap: 10px; }
.domain-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.domain-name {
    width: 180px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    color: var(--text-primary);
}
.domain-bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.domain-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
    min-width: 2px;
}
.domain-bar-fill.low { background: #E07A5F; }
.domain-bar-fill.mid { background: #E0B85F; }
.domain-bar-fill.high { background: #6BAA75; }
.domain-stat {
    width: 60px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ---- Weak Areas ---- */
.weak-areas { display: flex; flex-direction: column; gap: 10px; }
.weak-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}
.weak-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.weak-priority.critical { background: var(--red); }
.weak-priority.high { background: var(--amber); }
.weak-priority.medium { background: var(--text-tertiary); }
.weak-content { flex: 1; }
.weak-topic { font-weight: 500; font-size: 14px; }
.weak-domain { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.weak-message { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.weak-accuracy {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--red);
    flex-shrink: 0;
}

/* ---- Weak Laws ---- */
.weak-laws { display: flex; flex-wrap: wrap; gap: 8px; }
.law-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--red-light);
    color: var(--red);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.law-count {
    background: var(--red);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ---- Question Cards (Review) ---- */
.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.question-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.question-number {
    font-weight: 600;
    font-size: 13px;
    color: var(--accent);
    background: var(--accent-light);
    padding: 4px 10px;
    border-radius: 6px;
}
.question-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}
.tag-domain { background: #EDE7F6; color: #5E35B1; }
.tag-subtopic { background: #E0F2F1; color: #00796B; }
.tag-law { background: #FFF3E0; color: #E65100; }
.tag-difficulty { background: var(--bg-elevated); color: var(--text-secondary); }

.question-text {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.options-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.option-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}
.option-row:hover { border-color: var(--accent); background: var(--accent-light); }
.option-row.selected { border-color: var(--accent); background: var(--accent-light); }
.option-letter {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 20px;
}

.correct-answer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 13px;
}
.correct-label { font-weight: 500; color: var(--text-secondary); }
.correct-select {
    font-family: var(--font-body);
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
}

.question-explanation {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--amber-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--amber);
    line-height: 1.5;
}

.review-actions { margin: 20px 0; }

/* ---- Score Result ---- */
.score-result {
    margin-top: 24px;
    animation: fadeUp 0.4s ease;
}
.score-card {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
}
.score-number {
    font-family: var(--font-display);
    font-size: 56px;
    color: var(--accent);
    margin-bottom: 8px;
}
.score-detail {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ---- History ---- */
.history-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.history-item:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.history-info { flex: 1; }
.history-date { font-size: 12px; color: var(--text-tertiary); }
.history-title { font-weight: 500; font-size: 14px; margin-top: 2px; }
.history-score {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--accent);
}
.history-count { font-size: 12px; color: var(--text-tertiary); text-align: right; }

/* ---- Empty States ---- */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .domain-name { width: 100px; font-size: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .hero h1, .review-header h1, .view > .container > h1 { font-size: 24px; }
    .nav-btn { padding: 6px 12px; font-size: 13px; }
    .question-header { flex-direction: column; gap: 8px; }
}
@media (min-width: 601px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Nav Logout ---- */
.nav-logout {
    color: var(--red) !important;
    font-size: 13px !important;
}
.nav-logout:hover { background: var(--red-light) !important; }

/* ---- Auth View ---- */
.auth-wrapper {
    max-width: 400px;
    margin: 0 auto;
    padding-top: 48px;
}
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}
.auth-icon {
    font-size: 40px;
    filter: grayscale(1);
    display: block;
    margin-bottom: 12px;
}
.auth-brand h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 6px;
}
.auth-brand p {
    color: var(--text-secondary);
    font-size: 15px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.auth-form {
    padding: 24px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-group input::placeholder { color: var(--text-tertiary); }
.auth-form .btn-primary { margin-top: 8px; }
.auth-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}
.auth-status.error { background: var(--red-light); color: var(--red); }
.auth-status.success { background: var(--green-light); color: var(--green); }
