/* ═══════════════════════════════════════
   Statik Soru Çözücü — Dark Chat UI
   ═══════════════════════════════════════ */

:root {
    --bg: #212121;
    --bg-secondary: #2f2f2f;
    --bg-hover: #3a3a3a;
    --bg-input: #303030;
    --border: #424242;
    --text: #ececec;
    --text-muted: #9e9e9e;
    --text-dim: #6e6e6e;
    --accent: #6e9eff;
    --accent-hover: #5a8eef;
    --green: #4ade80;
    --red: #f87171;
    --radius: 24px;
    --radius-sm: 12px;
    --max-w: 740px;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

body { display: flex; flex-direction: column; }

.d-none { display: none !important; }

/* ── Header ── */

#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.header-left i { font-size: 1.1rem; opacity: 0.7; }

.header-right { display: flex; gap: 8px; align-items: center; }

/* Progress Badge */
.progress-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: transparent;
}

.progress-badge i { color: #f59e0b; font-size: 0.85rem; }

.streak-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
    color: #ef4444;
}

.streak-indicator i { color: #ef4444; font-size: 0.8rem; }

/* Language Button */
.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 36px;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

a.header-btn {
    text-decoration: none;
}

.header-btn-logout {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 6px 10px;
}

.header-btn-logout:hover {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.4);
}

#btn-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

#btn-new-chat:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

#btn-new-chat .btn-label { font-family: inherit; }

/* ── Chat Area ── */

#chat-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
    position: relative;
}

/* ── Drag & Drop Overlay ── */

#drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(33, 33, 33, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 50px 80px;
    border: 3px dashed var(--accent);
    border-radius: 24px;
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 600;
    animation: dropPulse 1.5s infinite;
}

.drop-content i { font-size: 3rem; }

@keyframes dropPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ── Welcome Screen ── */

#welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px 20px;
    min-height: 300px;
}

#welcome-screen h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

#welcome-screen > p {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

#welcome-screen.hidden { display: none; }

/* Example Cards */

#example-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 640px;
}

.example-card {
    flex: 1 1 170px;
    max-width: 200px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.example-card:hover {
    border-color: var(--accent);
    background: #2a2a3a;
    transform: translateY(-2px);
}

.example-card .ec-icon {
    font-size: 1.3rem;
    margin-bottom: 6px;
    display: block;
}

.example-card .ec-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text);
    line-height: 1.3;
}

.example-card .ec-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ── Messages ── */

#messages {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
}

.message {
    margin-bottom: 24px;
    animation: fadeInUp 0.3s ease;
}

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

/* User Message */
.user-msg { display: flex; justify-content: flex-end; }

.user-msg .msg-body {
    max-width: 85%;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 12px 18px;
}

.user-msg .msg-text { white-space: pre-wrap; word-break: break-word; }

.user-msg .msg-image { margin-top: 8px; }

.user-msg .msg-image img {
    max-width: 280px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* AI Message */
.ai-msg { display: flex; gap: 12px; align-items: flex-start; }

.ai-msg .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--accent);
    border: 1px solid var(--border);
}

.ai-msg .msg-body { flex: 1; min-width: 0; }

/* Thinking Animation */
.msg-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px 0;
}

.dot-pulse { display: flex; gap: 4px; }

.dot-pulse::before,
.dot-pulse::after,
.dot-pulse span {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dotPulse 1.2s infinite;
}

.dot-pulse::after { animation-delay: 0.2s; }
.dot-pulse span { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Results */
.result-diagram { margin-bottom: 16px; }

.diagram-img {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: zoom-in;
    transition: opacity 0.15s;
}

.diagram-img:hover { opacity: 0.92; }

details { margin-bottom: 10px; }

details summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 0;
    user-select: none;
}

details summary:hover { color: var(--text); }

.ascii-block {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.72rem;
    line-height: 1.3;
    background: #1a1a2e;
    color: #c8d6e5;
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    margin: 4px 0 0 0;
}

.json-block {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    background: var(--bg-secondary);
    color: #a8d8a8;
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    margin: 4px 0 0 0;
    max-height: 300px;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-action:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

/* Error */
.msg-error {
    background: #3a1a1a;
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

/* Solver */
.result-solver summary {
    color: var(--green);
}

.result-solver summary i {
    margin-right: 4px;
}

.solver-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.85rem;
}

.solver-table th,
.solver-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.solver-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.solver-table td {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.solver-equations {
    margin-top: 8px;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.solver-equations ul {
    list-style: none;
    padding-left: 0;
    margin-top: 4px;
}

.solver-equations li {
    padding: 2px 0;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
}

.solver-equations li::before {
    content: "→ ";
    color: var(--accent);
}

.solver-badge {
    margin-top: 8px;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #0a2e1a;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 500;
}

.solver-error {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 4px 0;
}

.solver-error i { margin-right: 4px; }

/* Guidance */
.msg-guidance {
    background: #1a2a3a;
    color: #bfdbfe;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.7;
    border-left: 3px solid var(--accent);
}

.msg-guidance strong { color: #e0ecff; }

.msg-guidance p { margin-bottom: 8px; }
.msg-guidance p:last-child { margin-bottom: 0; }

/* ── Input Bar ── */

#input-bar {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 12px 20px 16px;
}

.input-wrapper {
    max-width: var(--max-w);
    margin: 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within { border-color: var(--text-muted); }

#file-preview { padding: 10px 14px 0; }

.preview-item { display: inline-flex; position: relative; }

.preview-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.preview-item button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.preview-item button:hover { background: #dc2626; color: white; border-color: #dc2626; }

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 6px 8px;
}

#btn-attach {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

#btn-attach:hover { background: var(--bg-hover); color: var(--text); }

#text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    padding: 8px 4px;
    max-height: 150px;
    line-height: 1.5;
}

#text-input::placeholder { color: var(--text-dim); }

/* Model Selector */
#model-selector { flex-shrink: 0; }

#model-select {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    padding: 5px 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.15s;
    max-width: 170px;
}

#model-select:hover,
#model-select:focus { border-color: var(--text-muted); color: var(--text); }

#model-select option { background: var(--bg-secondary); color: var(--text); }

#btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--text-dim);
    color: var(--bg);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

#btn-send:not(:disabled) { background: var(--text); color: var(--bg); }
#btn-send:not(:disabled):hover { background: white; }
#btn-send:disabled { cursor: not-allowed; opacity: 0.5; }

.input-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* ── Toast ── */

#toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
    text-align: center;
}

.toast.show { opacity: 1; transform: translateY(0); }

.toast-success { background: #166534; color: #bbf7d0; }
.toast-error { background: #7f1d1d; color: #fecaca; }
.toast-info { background: #1e3a5f; color: #bfdbfe; }

/* ── Lightbox ── */

#lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    cursor: zoom-out;
}

#lightbox-img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    background: white;
}

#lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ── */

@media (max-width: 600px) {
    #welcome-screen h1 { font-size: 1.5rem; }
    #example-cards { gap: 8px; }
    .example-card { flex: 1 1 140px; padding: 10px; }
    .user-msg .msg-body { max-width: 92%; }
    .input-wrapper { border-radius: 16px; }
    #btn-new-chat .btn-label { display: none; }
    #lightbox { padding: 16px; }
}

/* ═══════════════════════════════════════
   Login sayfası — glassmorphism
   ═══════════════════════════════════════ */

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow-x: hidden;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(110, 158, 255, 0.22), transparent),
        radial-gradient(ellipse 60% 40% at 100% 50%, rgba(74, 222, 128, 0.08), transparent),
        radial-gradient(ellipse 50% 30% at 0% 80%, rgba(110, 158, 255, 0.12), transparent),
        var(--bg);
    pointer-events: none;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    animation: loginFadeIn 0.55s ease-out;
}

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

@keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

.login-card {
    background: rgba(47, 47, 47, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 36px 32px 32px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-card--shake {
    animation: loginShake 0.5s ease;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(110, 158, 255, 0.25), rgba(110, 158, 255, 0.08));
    border: 1px solid rgba(110, 158, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--accent);
}

.login-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.login-alerts {
    margin-bottom: 20px;
}

.login-alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.45;
}

.login-alert--error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.login-alert--message {
    background: rgba(110, 158, 255, 0.1);
    border: 1px solid rgba(110, 158, 255, 0.25);
    color: #bfdbfe;
}

.login-alert--ok {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.35);
    color: #bbf7d0;
}

.login-alert code {
    font-size: 0.82em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.login-label .bi {
    font-size: 1rem;
    color: var(--accent);
    opacity: 0.9;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder {
    color: var(--text-dim);
}

.login-input:hover {
    border-color: #555;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(110, 158, 255, 0.2);
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.login-btn {
    margin-top: 8px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #4f7fd4);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    box-shadow: 0 8px 24px rgba(110, 158, 255, 0.35);
}

.login-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 10px 28px rgba(110, 158, 255, 0.45);
}

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

.login-btn .bi {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.login-btn:hover .bi {
    transform: translateX(3px);
}

.login-footnote {
    margin-top: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.5;
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 22px 24px;
        border-radius: 22px;
    }
    .login-title { font-size: 1.2rem; }
}
