/* ============================================================
   Baskı Yönetim Sistemi — Koyu Tema
   ============================================================ */
:root {
    --bg:        #0b0e14;
    --bg-soft:   #11151f;
    --card:      #161b27;
    --card-2:    #1c2230;
    --border:    #28304a;
    --text:      #e7eaf2;
    --muted:     #8b94ab;
    --accent:    #6c8cff;
    --accent-2:  #38bdf8;
    --accent-grad: linear-gradient(135deg, #6c8cff, #38bdf8);
    --green:     #34d399;
    --amber:     #fbbf24;
    --red:       #f87171;
    --radius:    14px;
    --radius-sm: 9px;
    --shadow:    0 8px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

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

body { display: flex; flex-direction: column; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 1.65rem; margin: 0 0 .4rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }

code { background: var(--card-2); padding: .15em .45em; border-radius: 6px; font-size: .9em; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.page { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Topbar ---------- */
.topbar {
    background: rgba(17, 21, 31, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-weight: 800; font-size: 1.05rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 1.25rem; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
    color: var(--muted);
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 500;
    transition: .15s;
}
.topnav a:hover { color: var(--text); background: var(--card-2); text-decoration: none; }
.topnav a.nav-cta { color: var(--accent); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-chip {
    background: var(--card-2);
    border: 1px solid var(--border);
    padding: 5px 13px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 18px 0;
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
}

/* ---------- Kartlar ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.stat .num { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
.stat .lbl { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat.s-open    .num { color: var(--amber); }
.stat.s-confirmed .num { color: var(--accent-2); }
.stat.s-printed .num { color: var(--green); }

/* ---------- Butonlar ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    transition: .15s;
    text-decoration: none !important;
    color: #fff;
    background: var(--card-2);
    border-color: var(--border);
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--accent-grad); border: none; color: #0b0e14; }
.btn-success { background: var(--green); border: none; color: #0b0e14; }
.btn-danger  { background: rgba(248, 113, 113, .12); color: var(--red); border-color: rgba(248, 113, 113, .35); }
.btn-ghost   { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--card-2); }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Formlar ---------- */
.form-group { margin-bottom: 16px; }
label.form-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 5px; }
input[type=text], input[type=password], input[type=number], textarea, select {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 14px;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 140, 255, .18);
}
textarea { resize: vertical; min-height: 90px; }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid rgba(40, 48, 74, .55); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(28, 34, 48, .5); }

/* ---------- Durum rozetleri ---------- */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
}
.st-open      { background: rgba(251, 191, 36, .14); color: var(--amber); }
.st-confirmed { background: rgba(56, 189, 248, .14); color: var(--accent-2); }
.st-printed   { background: rgba(52, 211, 153, .14); color: var(--green); }
.st-cancelled { background: rgba(139, 148, 171, .14); color: var(--muted); }

/* ---------- Flash ---------- */
.flash {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 500;
    border: 1px solid;
}
.flash-success { background: rgba(52, 211, 153, .1);  border-color: rgba(52, 211, 153, .35);  color: var(--green); }
.flash-error   { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); color: var(--red); }
.flash-info    { background: rgba(56, 189, 248, .1);  border-color: rgba(56, 189, 248, .35);  color: var(--accent-2); }

/* ---------- Sekme filtreleri ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
    padding: 7px 15px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 600;
    font-size: .86rem;
    border: 1px solid var(--border);
    transition: .15s;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--accent-grad); color: #0b0e14; border-color: transparent; }

/* ---------- Link kutusu ---------- */
.link-box {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-soft);
    border: 1px dashed var(--accent);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
}
.link-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--accent-2);
    font-family: ui-monospace, monospace;
    font-size: .88rem;
    padding: 0;
}
.link-box input:focus { box-shadow: none; }

/* ---------- Resim ızgarası ---------- */
.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.img-card {
    position: relative;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}
.img-card img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.img-card .img-meta {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, .82));
    color: #fff;
    font-size: .7rem;
    padding: 18px 8px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.img-card .img-del {
    position: absolute;
    top: 7px; right: 7px;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(11, 14, 20, .72);
    color: var(--red);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: .15s;
}
.img-card .img-del:hover { background: var(--red); color: #fff; }
.img-card .img-crop {
    position: absolute;
    top: 7px; left: 7px;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(11, 14, 20, .72);
    color: var(--accent-2);
    font-size: .85rem;
    cursor: pointer;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: .15s;
}
.img-card .img-crop:hover { background: var(--accent); color: #fff; }
/* Adet (kopya) seçici — kartın altında */
.img-card .copies-bar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 16px 7px 7px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .82));
}
.img-card .cp-btn {
    width: 27px; height: 27px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: .15s;
}
.img-card .cp-btn:hover { background: var(--accent); }
.img-card .cp-val { color: #fff; font-size: .76rem; font-weight: 700; white-space: nowrap; }

/* Adet rozeti (salt okunur görünümler) */
.copies-badge {
    position: absolute;
    right: 7px; bottom: 7px;
    background: var(--accent-grad);
    color: #0b0e14;
    font-size: .74rem;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 999px;
}

/* Çözünürlük uyarısı */
.img-warn {
    position: absolute;
    top: 7px; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(251, 191, 36, .92);
    color: #1a1402;
    font-size: .9rem;
    cursor: pointer;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.img-warn.w-bad { background: rgba(248, 113, 113, .94); color: #2b0606; }

.img-card.uploading img { opacity: .45; }
.img-card .img-progress {
    position: absolute;
    left: 10px; right: 10px; bottom: 10px;
    height: 6px;
    background: rgba(255, 255, 255, .18);
    border-radius: 99px;
    overflow: hidden;
}
.img-card .img-progress span {
    display: block; height: 100%; width: 0;
    background: var(--accent-grad);
    border-radius: 99px;
    transition: width .2s;
}
.img-card.error { border-color: var(--red); }
.img-card .img-err {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    background: rgba(11, 14, 20, .85);
    color: var(--red);
    font-size: .78rem;
    font-weight: 600;
    padding: 10px;
    text-align: center;
}

/* ---------- Yükleme alanı (misafir) ---------- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    margin-bottom: 20px;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: rgba(108, 140, 255, .06);
}
.dropzone .dz-icon { font-size: 2.4rem; margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 700; font-size: 1.05rem; }
.dropzone .dz-sub { color: var(--muted); font-size: .85rem; margin-top: 4px; }

.upload-meter { margin-bottom: 18px; }
.upload-meter .um-text { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; margin-bottom: 7px; }
.upload-meter .um-bar { height: 8px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.upload-meter .um-bar span { display: block; height: 100%; width: 0; background: var(--accent-grad); border-radius: 99px; transition: width .3s; }

/* ---------- Misafir sayfası ---------- */
.guest-wrap { max-width: 760px; margin: 0 auto; padding: 36px 20px 60px; width: 100%; }
.guest-head { text-align: center; margin-bottom: 28px; }
.guest-head .gh-icon { font-size: 2.6rem; }
.guest-head h1 { margin-top: 6px; }
.guest-note {
    background: rgba(56, 189, 248, .08);
    border: 1px solid rgba(56, 189, 248, .25);
    border-radius: var(--radius-sm);
    padding: 13px 17px;
    color: var(--accent-2);
    font-size: .92rem;
    margin-bottom: 20px;
}
.guest-state { text-align: center; padding: 40px 20px; }
.guest-state .gs-icon { font-size: 3.4rem; margin-bottom: 12px; }
.guest-actions { margin-top: 26px; display: flex; justify-content: center; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(5, 7, 11, .75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 560px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 26px;
}
.modal h3 { margin: 0 0 10px; font-size: 1.15rem; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal .img-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 14px; }

/* ---------- Kırpma modalı ---------- */
.crop-modal { max-width: 720px; }
.crop-area {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 12px;
}
.crop-area img { display: block; max-width: 100%; max-height: 55vh; }
.crop-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.crop-tools .btn.active { background: var(--accent-grad); color: #0b0e14; border-color: transparent; }
/* Cropper.js koyu tema uyumu */
.cropper-view-box { outline-color: var(--accent); }
.cropper-line, .cropper-point { background-color: var(--accent); }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0;
    background: rgba(5, 7, 11, .92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 110;
    cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }

/* ---------- Toast ---------- */
.toast-area {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    display: flex; flex-direction: column; gap: 8px;
    width: min(420px, calc(100vw - 40px));
}
.toast {
    background: var(--card-2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .88rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: toast-in .25s ease;
}
.toast.t-error { border-left-color: var(--red); }
.toast.t-success { border-left-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Giriş sayfası ---------- */
.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 34px 30px;
    box-shadow: var(--shadow);
}
.auth-card .auth-logo { text-align: center; font-size: 2.6rem; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.auth-card .auth-sub { text-align: center; color: var(--muted); font-size: .87rem; margin-bottom: 24px; }

/* ---------- Detay listesi ---------- */
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.detail-list .dl-item { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 15px; }
.detail-list .dl-lbl { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.detail-list .dl-val { font-weight: 600; margin-top: 3px; }

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

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

/* Dropzone metinleri: masaüstü / mobil */
.dz-mobile { display: none; }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
    .topbar-inner { gap: 10px; height: auto; flex-wrap: wrap; padding: 10px 0; }
    .topnav { order: 3; width: 100%; justify-content: center; }
    .img-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    h1 { font-size: 1.35rem; }
    .page-head { flex-direction: column; }

    /* --- Misafir sayfası --- */
    .dz-desktop { display: none; }
    .dz-mobile { display: inline; }

    /* Yükleme alanı: 2 sütun — butonlar (✂ × − +) rahat sığsın */
    #imgGrid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .guest-wrap { padding: 22px 14px 110px; } /* sabit onay çubuğuna yer aç */
    .guest-head h1 { font-size: 1.25rem; }
    .dropzone { padding: 28px 16px; }

    /* Onay butonu: ekranın altına sabitlenir */
    .guest-actions {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        margin: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(11, 14, 20, .92);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        z-index: 60;
    }
    .guest-actions .btn { width: 100%; }

    /* Modallar: alttan açılan panel (bottom sheet) */
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal {
        max-width: none;
        border-radius: 18px 18px 0 0;
        max-height: 94vh;
        padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
    }
    .modal .modal-actions { position: sticky; bottom: 0; }
    .modal .modal-actions .btn { flex: 1; padding: 13px 18px; }

    /* Dokunma hedefleri büyür */
    .img-card .img-del, .img-card .img-crop { width: 36px; height: 36px; font-size: 1.05rem; }
    .img-card .cp-btn { width: 32px; height: 32px; }
    .crop-area img { max-height: 46vh; }
    .crop-tools .btn { padding: 9px 13px; }
}
