/* ============================================================
   Emlak Konut Proje Asistanı — "Mimari Pafta" tasarım sistemi
   Zemin: milimetrik çizim kağıdı · Tip: Archivo / IBM Plex
   Vurgu: kurumsal lacivert + şantiye turuncusu
   ============================================================ */

:root {
    --brand: #004F9F;        /* Emlak Konut laciverti */
    --brand-deep: #00335F;
    --ink: #0F2540;
    --muted: #5B7290;
    --paper: #F5F8FC;        /* soğuk pafta kağıdı */
    --sheet: #FFFFFF;
    --line: #D9E4F0;
    --line-strong: #B9CCE2;
    --grid: rgba(0, 79, 159, .05);
    --accent: #F26B1D;       /* şantiye turuncusu — tek sıcak vurgu */
    --radius: 10px;

    --font-display: "Archivo", "Segoe UI", sans-serif;
    --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", Consolas, monospace;
}

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

html, body { height: 100%; }

body {
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--ink);
    background-color: var(--paper);
    /* milimetrik çizim kağıdı */
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-font-smoothing: antialiased;
}

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

::selection { background: rgba(0, 79, 159, .18); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Başlık: pafta anteti ---------- */

.header {
    background: var(--sheet);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 1px 0 var(--sheet), 0 4px 18px rgba(15, 37, 64, .06);
    position: relative;
    z-index: 10;
}
.header::after {                 /* antet alt çizgisi: marka rulesi */
    content: "";
    display: block; height: 3px;
    background: linear-gradient(90deg, var(--brand) 0 72%, var(--accent) 72% 100%);
    transform-origin: left;
    animation: ruleIn .7s cubic-bezier(.6, 0, .2, 1) both;
}

.header-inner {
    max-width: 980px; margin: 0 auto;
    padding: 14px 24px;
    display: flex; align-items: center; gap: 22px;
}

.brand { display: flex; align-items: center; gap: 13px; margin-right: auto; }

.logo {
    width: 44px; height: 44px;
    border: 2px solid var(--brand);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    background: var(--sheet);
}
.logo img { width: 28px; height: auto; display: block; }
.logo::before, .logo::after {    /* pafta köşe tik işaretleri */
    content: ""; position: absolute; width: 7px; height: 7px;
    border: 1.5px solid var(--accent);
}
.logo::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.logo::after  { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }

.eyebrow {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
    color: var(--muted); display: block; margin-bottom: 1px;
}
.brand-text h1 {
    font-family: var(--font-display); font-weight: 700; font-size: 19px;
    letter-spacing: -.01em; color: var(--ink); line-height: 1.15;
}

/* antet hücreleri: envanter sayıları */
.titleblock { display: flex; border-left: 1px solid var(--line); }
.tb-cell {
    padding: 2px 18px;
    border-right: 1px solid var(--line);
    text-align: left;
}
.tb-num {
    font-family: var(--font-mono); font-size: 17px; font-weight: 500;
    color: var(--brand-deep); line-height: 1.2; display: block;
}
.tb-label {
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em;
    color: var(--muted); text-transform: uppercase;
}

/* satış hattı plakası */
.call-plate {
    display: flex; align-items: center; gap: 9px;
    background: var(--brand); color: #fff;
    text-decoration: none;
    padding: 9px 16px;
    border: 1px solid var(--brand-deep);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 8px rgba(0, 51, 95, .25);
    transition: background .15s;
}
.call-plate:hover { background: var(--brand-deep); }
.call-label {
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em;
    text-transform: uppercase; opacity: .8;
}
.call-no { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .02em; }

/* ---------- Sohbet alanı ---------- */

.chat { flex: 1; overflow-y: auto; padding: 34px 20px 12px; }

.empty-state {
    max-width: 620px; margin: 5vh auto 0; text-align: center;
    animation: fadeUp .6s .15s ease both;
}
.skyline {
    width: min(560px, 92%); color: var(--brand);
    margin-bottom: 26px; opacity: .9;
}
.skyline-path {
    stroke-dasharray: 1600; stroke-dashoffset: 1600;
    animation: draw 2.4s .2s cubic-bezier(.5, 0, .3, 1) forwards;
}
.skyline-path.crane { animation-delay: 1.1s; stroke-dasharray: 900; stroke-dashoffset: 900; }
.skyline-dot { opacity: 0; animation: fadeIn .4s 2.6s forwards; }

.empty-state h2 {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(24px, 3.4vw, 31px); line-height: 1.18;
    letter-spacing: -.015em; margin-bottom: 12px;
}
.empty-state p { color: var(--muted); font-size: 14px; line-height: 1.65; margin-bottom: 26px; }

.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.chip {
    font-family: var(--font-body); font-size: 13px; font-weight: 500;
    color: var(--brand-deep);
    background: var(--sheet);
    border: 1px solid var(--line-strong);
    padding: 9px 16px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.chip:hover {
    border-color: var(--brand);
    box-shadow: 0 3px 10px rgba(0, 79, 159, .12);
    transform: translateY(-1px);
}

/* mesajlar */
.message {
    max-width: 980px; margin: 0 auto 20px;
    display: flex; gap: 13px;
    animation: fadeUp .3s ease both;
}
.message.user { justify-content: flex-end; }

.avatar {
    width: 34px; height: 34px; flex-shrink: 0; margin-top: 2px;
    border: 1.5px solid var(--brand);
    background: var(--sheet);
    display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 21px; height: auto; display: block; }

.bubble {
    padding: 14px 18px;
    font-size: 14.5px; line-height: 1.62;
    max-width: 82%;
    overflow-wrap: break-word;
}

.message.user .bubble {
    background: var(--brand); color: #fff;
    box-shadow: 0 2px 10px rgba(0, 79, 159, .28);
    border-radius: var(--radius) var(--radius) 3px var(--radius);
    font-weight: 500;
}

.message.assistant .bubble {
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 3px var(--radius) var(--radius) var(--radius);
    box-shadow: 0 1px 4px rgba(15, 37, 64, .05);
}

.bubble p { margin-bottom: 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 10px 20px; }
.bubble li { margin-bottom: 4px; }
.bubble a { color: var(--brand); font-weight: 500; text-underline-offset: 2px; }
.message.user .bubble a { color: #CFE3FF; }
.bubble h3, .bubble h4 {
    font-family: var(--font-display); font-size: 15px; font-weight: 600;
    margin: 12px 0 6px; letter-spacing: -.005em;
}
.bubble strong { font-weight: 600; }
.bubble.error {
    background: #FFF6F0; border-color: #F4CBB1; color: #8A3A12;
}

/* yazıyor göstergesi */
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing span {
    width: 6px; height: 6px; background: var(--line-strong);
    animation: pulse 1.1s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* ---------- tablolar: çizim cetveli ---------- */

.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line-strong); }
.bubble table { border-collapse: collapse; font-size: 13px; width: 100%; background: var(--sheet); }
.bubble th, .bubble td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 8px 12px; text-align: left; vertical-align: top;
}
.bubble th:last-child, .bubble td:last-child { border-right: 0; }
.bubble tr:last-child td { border-bottom: 0; }
.bubble th {
    background: #EDF3FA;
    font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
    letter-spacing: .1em; text-transform: uppercase; color: var(--brand-deep);
    white-space: nowrap;
}
.bubble tr:nth-child(even) td { background: #FAFCFE; }

/* ---------- proje kartları ---------- */

.cards-wrap { margin-top: 14px; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    gap: 12px;
}

.project-card {
    background: var(--sheet);
    border: 1px solid var(--line-strong);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.project-card:hover {
    border-color: var(--brand);
    box-shadow: 0 8px 22px rgba(0, 79, 159, .14);
    transform: translateY(-2px);
}

.card-media { position: relative; aspect-ratio: 16 / 8.5; background: #E4ECF5 ; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.status-stamp {
    position: absolute; top: 9px; left: 9px;
    font-family: var(--font-mono); font-size: 9px; font-weight: 500;
    letter-spacing: .13em; text-transform: uppercase;
    padding: 4px 8px;
    background: rgba(255, 255, 255, .93);
    border: 1px solid currentColor;
}
.status-stamp.ongoing { color: var(--accent); }
.status-stamp.done { color: var(--brand); }

.card-body { padding: 12px 14px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }

.card-title {
    font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
    letter-spacing: -.005em; color: var(--ink); line-height: 1.25;
}
.card-meta {
    font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em;
    color: var(--muted); text-transform: uppercase;
    display: flex; align-items: center; gap: 5px;
}
.card-meta svg { flex-shrink: 0; }
.card-units {
    font-family: var(--font-mono); font-size: 11px; color: var(--brand-deep);
    border-top: 1px dashed var(--line); padding-top: 7px;
}

.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }

.action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--font-body); font-size: 11.5px; font-weight: 500;
    text-decoration: none;
    color: var(--brand-deep);
    background: var(--sheet);
    border: 1px solid var(--line-strong);
    padding: 5px 9px;
    transition: all .13s ease;
    white-space: nowrap;
}
.action-btn svg { flex-shrink: 0; }
.action-btn:hover {
    background: var(--brand); color: #fff; border-color: var(--brand);
}

/* diğer kaynak etiketleri */
.sources {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
    padding-top: 10px; border-top: 1px dashed var(--line);
}
.sources-label {
    font-family: var(--font-mono); font-size: 9.5px; color: var(--muted);
    width: 100%; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .14em;
}
.source-chip {
    font-family: var(--font-mono); font-size: 11px; color: var(--brand-deep); text-decoration: none;
    background: #EDF3FA; border: 1px solid var(--line);
    padding: 4px 10px;
    transition: border-color .15s;
}
.source-chip:hover { border-color: var(--brand); }

/* ---------- yazım alanı ---------- */

.composer {
    padding: 10px 20px 13px;
    background: linear-gradient(to top, var(--paper) 72%, transparent);
}

.composer-inner {
    max-width: 980px; margin: 0 auto;
    display: flex; align-items: flex-end; gap: 10px;
    background: var(--sheet);
    border: 1.5px solid var(--line-strong);
    padding: 11px 11px 11px 18px;
    box-shadow: 0 6px 24px rgba(15, 37, 64, .09);
    transition: border-color .15s;
}
.composer-inner:focus-within { border-color: var(--brand); }

#input {
    flex: 1; border: none; outline: none; resize: none;
    font-family: var(--font-body); font-size: 14.5px; line-height: 1.5;
    max-height: 140px; background: transparent; color: var(--ink);
}
#input::placeholder { color: #93A7BE; }

#send {
    width: 40px; height: 40px; border: none;
    background: var(--brand); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, transform .1s; flex-shrink: 0;
}
#send:hover:not(:disabled) { background: var(--accent); }
#send:active:not(:disabled) { transform: scale(.94); }
#send:disabled { background: var(--line-strong); cursor: not-allowed; }

.disclaimer {
    text-align: center;
    font-family: var(--font-mono); font-size: 10.5px; color: var(--muted);
    margin-top: 9px; letter-spacing: .02em;
}
.disclaimer a { color: var(--brand); text-decoration: none; font-weight: 500; }
.disclaimer a:hover { text-decoration: underline; }

/* ---------- animasyonlar ---------- */

@keyframes ruleIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 60%, 100% { opacity: .45; } 30% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .skyline-path { stroke-dashoffset: 0; }
    .skyline-dot { opacity: 1; }
}

/* ---------- duyarlılık ---------- */

@media (max-width: 860px) {
    .titleblock { display: none; }
}
@media (max-width: 620px) {
    .call-label { display: none; }
    .header-inner { padding: 12px 16px; gap: 12px; }
    .bubble { max-width: 92%; }
    .cards-grid { grid-template-columns: 1fr; }
}
