/* assets/css/style.css - HC tasarım sistemi (tüm sayfalarda ortak)
 * Renkler, yazı tipleri, köşeler ve gölgeler yalnızca :root değişkenlerinden yönetilir.
 * Özel sayfa stilleri: auth.css (giriş/kayıt), chat.css (sohbet odası).
 */

:root {
    color-scheme: light;

    /* Yazı tipi: sistemin yuvarlak/modern yazı tipleri (harici sunucu gerektirmez) */
    --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Pastel yeşil */
    --green-50:  #f3faee;
    --green-100: #e4f3da;
    --green-200: #cfe8c0;
    --green-300: #b5d9a1;
    --green-500: #7fba6a;
    --green-600: #5b9a48;
    --green-700: #467a38;
    --green-800: #3a6830;
    --green-900: #2d4f2a;

    /* Krem ve açık sarı */
    --cream-50:  #fffdf6;
    --cream-100: #fbf6e6;
    --cream-200: #f4ebd0;
    --yellow-100: #fff3c4;
    --yellow-200: #fbe7a0;
    --yellow-400: #f3cf5f;

    /* Sıcak kahverengi (ahşap) */
    --brown-100: #efe0cc;
    --brown-200: #e2c9a6;
    --brown-300: #d2b083;
    --brown-500: #9a6b43;
    --brown-700: #6e4a30;
    --brown-900: #43291a;

    /* Yumuşak turuncu (vurgu) */
    --orange-100: #fff0e0;
    --orange-200: #f9d2b0;
    --orange-400: #f4a261;
    --orange-700: #a8561a;

    --white: #ffffff;
    --red-600: #b8432f;
    --red-100: #fbe3df;

    /* Anlamsal renkler */
    --bg: var(--cream-100);
    --surface: var(--white);
    --surface-soft: var(--cream-50);
    --text: var(--brown-900);
    --text-soft: #7a5f4a;
    --line: var(--brown-100);
    --primary: var(--green-700);
    --primary-hover: var(--green-800);
    --primary-shadow: var(--green-900);
    --primary-ink: var(--white);
    --focus: rgba(127, 186, 106, 0.45);

    /* Şekil */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(110, 74, 48, 0.08), 0 2px 6px rgba(110, 74, 48, 0.06);
    --shadow: 0 8px 22px rgba(110, 74, 48, 0.14);

    /* Hafif ahşap doku (yalnızca CSS) */
    --wood-light: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 2px, rgba(255, 255, 255, 0) 2px 8px),
                  linear-gradient(180deg, #efd9b4, #e3c69b);

    /* Ölçüler */
    --tap: 44px;
    --topbar-h: 64px;
    --tabbar-h: 64px;
}

/* ---------------------------------------------------------------
 * Temel
 * ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg);
    background-image: radial-gradient(rgba(127, 186, 106, 0.12) 1.5px, transparent 1.6px);
    background-size: 26px 26px;
    color: var(--text);
    font: 16px/1.5 var(--font);
    overflow-x: hidden;
}

h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.25; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

a { color: var(--primary); font-weight: 700; }
a:hover { color: var(--primary-hover); }

img, svg { display: block; max-width: 100%; }

button, input, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

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

.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--text-soft); }
.small { font-size: 0.875rem; }

.icon { width: 22px; height: 22px; flex: none; }

/* ---------------------------------------------------------------
 * Avatar
 * ------------------------------------------------------------- */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--green-100);
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
    flex: none;
}
.avatar-xl { width: 96px; height: 96px; border-width: 4px; }

/* ---------------------------------------------------------------
 * Düğmeler
 * ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap);
    padding: 0 20px;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--cream-200);
    color: var(--brown-700);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { color: var(--brown-900); }

.btn-primary {
    background: var(--primary);
    color: var(--primary-ink);
    box-shadow: 0 3px 0 var(--primary-shadow);
}
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-shadow); }

.btn-soft { background: var(--brown-100); border-color: var(--brown-200); color: var(--brown-700); }
.btn-soft:hover { background: var(--brown-200); }

.btn-ghost { background: transparent; color: var(--brown-700); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.45); }

.btn-danger { background: var(--red-100); border-color: #efb9b0; color: var(--red-600); }
.btn-danger:hover { background: #f6d0ca; color: var(--red-600); }

.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.btn-block { width: 100%; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap);
    border-radius: 50%;
    border: 0; background: transparent;
    color: var(--brown-700);
    cursor: pointer;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.5); }

/* ---------------------------------------------------------------
 * Formlar
 * ------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 800; font-size: 0.95rem; }

.input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 2px solid var(--brown-100);
    border-radius: var(--radius);
    background: var(--cream-50);
    font-size: 16px; /* iOS'ta odaklanınca yakınlaşmayı önler */
    outline: none;
}
.input:focus { border-color: var(--green-500); box-shadow: 0 0 0 4px var(--focus); }
.input.is-invalid { border-color: #d98c7e; background: #fff8f6; }
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-btn {
    position: absolute; top: 2px; right: 2px;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--radius);
    background: transparent; color: var(--text-soft);
    cursor: pointer;
}
.input-btn:hover { color: var(--brown-900); }
.input-btn[aria-pressed="true"] .when-hidden,
.input-btn[aria-pressed="false"] .when-shown { display: none; }

.field-hint { margin-top: 6px; min-height: 1.3em; font-size: 0.85rem; color: var(--text-soft); }
.field-hint.is-ok { color: var(--green-700); font-weight: 700; }
.field-hint.is-bad { color: var(--red-600); font-weight: 700; }

.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 16px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------
 * Uyarılar, rozetler, çipler
 * ------------------------------------------------------------- */
.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    font-weight: 700;
    font-size: 0.95rem;
}
.alert-success { background: var(--green-100); border-color: var(--green-300); color: var(--green-900); }
.alert-error   { background: var(--red-100); border-color: #efb9b0; color: #8f2f1e; }
.alert-info    { background: var(--yellow-100); border-color: var(--yellow-200); color: var(--brown-700); }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem; font-weight: 800;
    background: var(--brown-100); color: var(--brown-700);
}
.badge-important { background: var(--orange-200); color: var(--orange-700); }
.badge-admin { background: var(--yellow-200); color: var(--brown-700); }
.badge-on  { background: var(--green-100); color: var(--green-900); }
.badge-off { background: var(--brown-100); color: var(--text-soft); }

.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--green-100);
    color: var(--green-900);
    font-size: 0.85rem; font-weight: 800;
}
.live-dot {
    display: inline-block; width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--green-500);
    box-shadow: 0 0 0 3px rgba(127, 186, 106, 0.3);
}

.toast {
    position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    background: var(--brown-900); color: var(--cream-50);
    font-weight: 700; font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 100;
}

/* ---------------------------------------------------------------
 * Kartlar ve "ahşap tabela" başlıkları
 * ------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.board { overflow: hidden; margin-bottom: 16px; }
.board-title {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    background: var(--wood-light);
    border-bottom: 3px solid var(--brown-300);
    font-size: 1.05rem;
    color: var(--brown-900);
}
.board-title::after {
    content: "";
    width: 9px; height: 9px; margin-left: auto;
    border-radius: 50%;
    background: var(--brown-500);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45);
}
.board-body { padding: 16px 18px 18px; display: grid; gap: 12px; }

/* ---------------------------------------------------------------
 * Üst çubuk + gezinme (mobilde alt çubuk, masaüstünde üstte)
 * ------------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    background: var(--wood-light);
    border-bottom: 3px solid var(--brown-300);
    box-shadow: var(--shadow-sm);
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brown-900); min-height: var(--tap); }
.brand:hover { color: var(--brown-900); }
.brand-logo { width: 40px; height: 40px; }
.brand-name { font-weight: 800; font-size: 1.1rem; }

.userbox { display: flex; align-items: center; gap: 4px; min-width: 0; }
.userlink {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: var(--tap); min-width: 0;
    padding: 2px 8px 2px 2px;
    border-radius: var(--radius-pill);
    text-decoration: none; color: var(--brown-900);
}
.userlink:hover { background: rgba(255, 255, 255, 0.45); color: var(--brown-900); }
.usertext { display: none; flex-direction: column; line-height: 1.2; min-width: 0; }
.usertext strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.usertext small { color: var(--brown-700); font-weight: 800; letter-spacing: 0.02em; }
.btn-ghost .label { display: none; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    background: var(--cream-50);
    border-top: 3px solid var(--brown-200);
    box-shadow: 0 -4px 14px rgba(110, 74, 48, 0.08);
}
.tab {
    flex: 1; max-width: 140px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: var(--radius);
    color: var(--text-soft); text-decoration: none;
    font-size: 0.75rem; font-weight: 800;
}
.tab:hover { color: var(--brown-900); }
.tab.is-active { background: var(--green-100); color: var(--green-900); }

@media (min-width: 820px) {
    .usertext { display: flex; }
    .btn-ghost .label { display: inline; }

    .tabbar {
        position: static; height: auto; padding: 0; gap: 6px;
        background: transparent; border: 0; box-shadow: none;
    }
    .tab {
        flex: none; max-width: none;
        flex-direction: row; gap: 8px;
        padding: 0 16px; min-height: var(--tap);
        border-radius: var(--radius-pill);
        font-size: 0.95rem; color: var(--brown-700);
    }
    .tab:hover { background: rgba(255, 255, 255, 0.45); }
    .tab.is-active { background: var(--cream-50); box-shadow: var(--shadow-sm); }
    .toast { bottom: 28px; }
}

/* ---------------------------------------------------------------
 * Sayfa iskeleti
 * ------------------------------------------------------------- */
.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}
@media (min-width: 820px) {
    .page { padding: 28px 20px 48px; }
}

/* Ana sayfa */
.welcome {
    position: relative; overflow: hidden;
    padding: 22px 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--green-100), var(--yellow-100));
    border-color: var(--green-200);
}
.welcome-text { position: relative; z-index: 1; display: grid; gap: 4px; }
.welcome h1 { font-size: 1.75rem; overflow-wrap: anywhere; }
.welcome p { color: var(--brown-700); font-weight: 700; }
.welcome-leaf {
    position: absolute; right: -14px; bottom: -22px;
    width: 130px; height: 130px;
    color: var(--green-300); opacity: 0.7;
    stroke-width: 1.5;
}

.home-grid { display: grid; gap: 0; }
@media (min-width: 820px) {
    .home-grid { grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
}

.note {
    padding: 14px 14px 12px;
    background: var(--cream-50);
    border: 1px solid var(--line);
    border-left: 5px solid var(--yellow-400);
    border-radius: var(--radius);
}
.note-important { border-left-color: var(--orange-400); background: var(--orange-100); }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.note-head h3 { overflow-wrap: anywhere; }
.note-text { overflow-wrap: anywhere; }
.note-date { display: block; margin-top: 8px; font-size: 0.8rem; color: var(--text-soft); font-weight: 700; }

.room-card {
    display: grid; gap: 14px;
    padding: 16px;
    background: linear-gradient(180deg, var(--green-50), var(--cream-50));
    border: 2px solid var(--green-200);
    border-radius: var(--radius);
}
.room-info { display: grid; gap: 6px; justify-items: start; }
.room-info p { color: var(--text-soft); }

/* Profil */
.profile-card { padding: 22px 20px; display: grid; gap: 18px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h1 { overflow-wrap: anywhere; margin-bottom: 4px; }
.profile-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.profile-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 14px; background: var(--cream-50);
}
.profile-row + .profile-row { border-top: 1px solid var(--line); }
.profile-row dt { color: var(--text-soft); font-weight: 800; }
.profile-row dd { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.hc-id { font-size: 1.15rem; letter-spacing: 0.04em; color: var(--brown-700); }

/* Yönetim */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
    display: grid; gap: 2px; justify-items: center;
    padding: 14px 8px;
    background: var(--cream-50); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat strong { font-size: 1.6rem; color: var(--green-800); }
.stat span { font-size: 0.85rem; color: var(--text-soft); font-weight: 700; }

.admin-item {
    display: grid; gap: 12px;
    padding: 14px;
    background: var(--cream-50); border: 1px solid var(--line); border-radius: var(--radius);
}
.admin-item.is-inactive { opacity: 0.75; border-style: dashed; }
.admin-item-main { display: grid; gap: 6px; min-width: 0; }
.admin-item-main h3 { overflow-wrap: anywhere; }
.admin-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-item-text { overflow-wrap: anywhere; color: var(--text-soft); }
.admin-item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-item-actions form { margin: 0; }

/* Açılır pencere (profil kartı) */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(67, 41, 26, 0.45); }
.modal-card {
    position: relative;
    width: 100%; max-width: 340px;
    padding: 24px 20px 20px;
    display: grid; gap: 10px; justify-items: center; text-align: center;
    box-shadow: var(--shadow);
}
.modal-card h2 { overflow-wrap: anywhere; }
.pc-status { font-weight: 800; color: var(--text-soft); }
.pc-status.on { color: var(--green-700); }
.pc-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.modal-card .btn-block { margin-top: 6px; }

/* HC 2.1 - Profil ayarları, coin / seviye rozetleri */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip svg { width: 16px; height: 16px; flex: none; }
.chip-coin { background: var(--yellow-200); color: var(--brown-700); }
.chip-level { background: var(--green-100); color: var(--green-900); }
.profile-bio { color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.photo-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.source-box { display: grid; gap: 8px; justify-items: start; }
.source-list { display: flex; flex-wrap: wrap; gap: 8px; }
.source-list .btn[aria-pressed="true"] { background: var(--green-100); border-color: var(--green-500); color: var(--green-900); }
.source-list .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bio-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* HC 2.1 - Market ürün görünümleri (market sayfası VE sohbet kullanır; sınıf = i-<ürün kodu>) */
.i-nc_green  { color: #2f7d32 !important; } .i-nc_blue   { color: #1f6fb8 !important; }
.i-nc_purple { color: #7a3fb0 !important; } .i-nc_orange { color: #d9660f !important; }
.i-nc_pink   { color: #c93a7e !important; } .i-nc_red    { color: #c22a2a !important; }
.i-nc_gold   { color: #b98500 !important; text-shadow: 0 0 6px rgba(243, 207, 95, 0.55); }

.i-bb_cream    { --bb-bg: #fff3c4; --bb-line: #f3cf5f; }
.i-bb_green    { --bb-bg: #dff1d3; --bb-line: #a9d291; }
.i-bb_blue     { --bb-bg: #dcecfa; --bb-line: #a6cdeb; }
.i-bb_lavender { --bb-bg: #e8ddf4; --bb-line: #c7aee3; }
.i-bb_peach    { --bb-bg: #fde0cd; --bb-line: #f2b78f; }
.i-bb_pink     { --bb-bg: #fbdce6; --bb-line: #efa9c1; }
.bubble-demo[class*="i-bb_"],
.msg.mine .msg-card[class*="i-bb_"] { background: var(--bb-bg); border-color: var(--bb-line); }

.avatar.i-fr_simple  { box-shadow: 0 0 0 3px var(--brown-300); }
.avatar.i-fr_pastel  { box-shadow: 0 0 0 3px #f6b8c4, 0 0 0 6px #c8e6d8; }
.avatar.i-fr_floral  { box-shadow: 0 0 0 3px #f08fb0; outline: 4px dotted #7fba6a; outline-offset: 3px; }
.avatar.i-fr_special { box-shadow: 0 0 0 3px #7a3fb0, 0 0 0 6px #fff, 0 0 0 9px #f4a261; }
.avatar.i-fr_rare    { box-shadow: 0 0 0 3px #f3cf5f, 0 0 0 5px #b98500, 0 0 14px 6px rgba(243, 207, 95, 0.7); }

/* HC 2.1 - Üst bar: seviye + coin */
.userstats { display: inline-flex; align-items: center; gap: 6px; }
.userstats .chip { padding: 2px 9px; font-size: 0.8rem; }
.userstats .chip-level { display: none; }
@media (min-width: 700px) { .userstats .chip-level { display: inline-flex; } }
