/* ==========================================================================
   ev.ct.com.tr  --  Envanter & Kabin Yonetim Sistemi
   Aydinlik tema  --  tek stil dosyasi, dis bagimlilik yok
   ========================================================================== */

:root {
    /* Zemin ve yuzeyler */
    --bg:            #f6f8fb;
    --surface:       #ffffff;
    --surface-2:     #f1f5f9;
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    /* Metin */
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-light:    #94a3b8;

    /* Vurgu */
    --primary:       #1d4ed8;
    --primary-dark:  #1e40af;
    --primary-light: #eff6ff;
    --primary-border:#bfdbfe;

    /* Durum renkleri */
    --success:       #15803d;
    --success-bg:    #f0fdf4;
    --success-border:#bbf7d0;

    --danger:        #b91c1c;
    --danger-bg:     #fef2f2;
    --danger-border: #fecaca;

    --warning:       #b45309;
    --warning-bg:    #fffbeb;
    --warning-border:#fde68a;

    --info:          #0369a1;
    --info-bg:       #f0f9ff;
    --info-border:   #bae6fd;

    /* Olculer */
    --radius:        10px;
    --radius-sm:     7px;
    --sidebar-w:     238px;
    --shadow:        0 1px 2px rgba(15,23,42,.05);
    --shadow-md:     0 4px 12px rgba(15,23,42,.08);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 12px; }

code, .mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: .92em;
}

/* ==========================================================================
   YERLESIM
   ========================================================================== */

.layout { display: flex; min-height: 100vh; }

/* --- Yan menu --- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: block;
}

.sidebar-brand .sub {
    font-size: 11.5px;
    color: var(--text-light);
    letter-spacing: .3px;
}

.nav { padding: 12px 10px; flex: 1; }

.nav-group-title {
    padding: 14px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--text-light);
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    transition: background .12s, color .12s;
}

.nav a:hover { background: var(--surface-2); text-decoration: none; }

.nav a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav a .icon { width: 17px; text-align: center; flex-shrink: 0; opacity: .85; }

.nav a .tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 20px;
    background: var(--surface-2);
    color: var(--text-light);
    border: 1px solid var(--border);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.avatar {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}

.user-card .info { min-width: 0; flex: 1; }
.user-card .info strong { display: block; font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .info span { font-size: 11.5px; color: var(--text-muted); }

/* --- Ana alan --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 20;
}

.topbar h1 { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .meta { font-size: 12.5px; color: var(--text-light); }

.content { padding: 24px; flex: 1; max-width: 1440px; width: 100%; }

.menu-toggle {
    display: none;
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px; cursor: pointer; font-size: 15px;
}

/* ==========================================================================
   KARTLAR
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.card-head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}

.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-head .hint { font-size: 12.5px; color: var(--text-muted); }

.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* --- Istatistik kutulari --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.stat .label {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex; align-items: center; gap: 6px;
}

.stat .value { font-size: 24px; font-weight: 600; letter-spacing: -.4px; }
.stat .value small { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.stat .foot { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.stat.accent { border-left: 3px solid var(--primary); }
.stat.warn   { border-left: 3px solid var(--warning); }
.stat.ok     { border-left: 3px solid var(--success); }

/* Doluluk cubugu */
.bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 10px;
}
.bar > span {
    display: block; height: 100%;
    background: var(--primary);
    border-radius: 20px;
}
.bar.warn > span { background: #f59e0b; }
.bar.danger > span { background: #dc2626; }

/* ==========================================================================
   TABLOLAR
   ========================================================================== */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th {
    text-align: left;
    padding: 11px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

table.data td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbfc; }

table.data td.num, table.data th.num { text-align: right; }
table.data td.actions { text-align: right; white-space: nowrap; }

.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--text-light);
}
.empty .icon { font-size: 28px; margin-bottom: 8px; opacity: .5; }

/* ==========================================================================
   ROZETLER
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge.green  { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge.red    { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.badge.amber  { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge.blue   { background: var(--primary-light); color: var(--primary); border-color: var(--primary-border); }
.badge.gray   { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ==========================================================================
   BUTONLAR
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}

.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.secondary {
    background: var(--surface);
    color: #334155;
    border-color: var(--border-strong);
}
.btn.secondary:hover { background: var(--surface-2); color: #334155; }

.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }

.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.block { width: 100%; }

.btn-link {
    background: none; border: 0; padding: 0;
    color: var(--primary); font: inherit; font-size: 13px;
    cursor: pointer; text-decoration: underline;
}
.btn-link.danger { color: #dc2626; }

/* ==========================================================================
   FORMLAR
   ========================================================================== */

.field { margin-bottom: 15px; }

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.field .help { font-size: 12px; color: var(--text-light); margin-top: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color .12s, box-shadow .12s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

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

textarea { min-height: 80px; resize: vertical; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0 14px;
}

.form-actions {
    display: flex; gap: 10px; align-items: center;
    margin-top: 18px; padding-top: 16px;
    border-top: 1px solid var(--border);
}

.inline-form { display: inline; }

/* ==========================================================================
   BILDIRIMLER
   ========================================================================== */

.alert {
    display: flex;
    gap: 11px;
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 14px;
    font-size: 13.5px;
    line-height: 1.55;
}

.alert .icon { flex-shrink: 0; font-size: 15px; line-height: 1.4; }
.alert strong { display: block; margin-bottom: 2px; }

.alert.success { background: var(--success-bg); border-color: var(--success-border); color: #14532d; }
.alert.error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: #7f1d1d; }
.alert.warning { background: var(--warning-bg); border-color: var(--warning-border); color: #78350f; }
.alert.info    { background: var(--info-bg);    border-color: var(--info-border);    color: #075985; }

/* ==========================================================================
   GIRIS EKRANI
   ========================================================================== */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-box { width: 100%; max-width: 400px; }

.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .mark {
    width: 46px; height: 46px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}
.auth-logo h1 { font-size: 17px; margin-bottom: 3px; }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin: 0; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 26px;
    box-shadow: var(--shadow-md);
}

.auth-foot {
    text-align: center;
    margin-top: 18px;
    font-size: 12px;
    color: var(--text-light);
}

.auth-foot .ip {
    display: inline-block;
    margin-top: 7px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: ui-monospace, monospace;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* --- Kod girisi --- */
.code-input {
    width: 100%;
    padding: 15px;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 27px;
    font-weight: 600;
    letter-spacing: 11px;
    text-indent: 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}
.code-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

.otp-target {
    text-align: center;
    padding: 12px 14px;
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #1e3a8a;
    margin-bottom: 18px;
}
.otp-target strong { font-weight: 600; }

/* ==========================================================================
   YARDIMCI SINIFLAR
   ========================================================================== */

.muted     { color: var(--text-muted); }
.small     { font-size: 12.5px; }
.text-right{ text-align: right; }
.nowrap    { white-space: nowrap; }
.mt-0      { margin-top: 0; }
.mb-0      { margin-bottom: 0; }
.mb-16     { margin-bottom: 16px; }
.mt-16     { margin-top: 16px; }
.flex      { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.spacer    { flex: 1; }

.page-intro {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: -4px 0 18px;
    max-width: 720px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    align-items: start;
}

.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv th {
    text-align: left; padding: 8px 0; width: 40%;
    font-weight: 500; color: var(--text-muted); vertical-align: top;
}
.kv td { padding: 8px 0; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--border); }

/* Sistem durumu satirlari */
.check {
    display: flex; gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.check:last-child { border-bottom: 0; }
.check .mark {
    width: 20px; height: 20px; flex-shrink: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    margin-top: 1px;
}
.check .mark.ok   { background: #16a34a; }
.check .mark.fail { background: #dc2626; }
.check .body { flex: 1; min-width: 0; }
.check .body strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.check .body .val { font-size: 13px; color: var(--text); font-family: ui-monospace, monospace; }
.check .body .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* Sayfalama */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center;
    padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 11px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px;
    background: var(--surface); color: #334155;
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* "Yakinda" sayfasi */
.soon {
    text-align: center;
    padding: 60px 24px;
}
.soon .icon {
    width: 58px; height: 58px; margin: 0 auto 18px;
    border-radius: 14px;
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 25px;
}
.soon h2 { font-size: 18px; margin-bottom: 8px; }
.soon p { color: var(--text-muted); max-width: 440px; margin: 0 auto 16px; }

/* ==========================================================================
   MOBIL
   ========================================================================== */

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open { transform: translateX(0); }

    .menu-toggle { display: inline-flex; }

    .content { padding: 16px; }
    .topbar { padding: 0 16px; }

    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(15,23,42,.35);
        z-index: 99;
    }
}

@media print {
    .sidebar, .topbar, .btn, .form-actions { display: none !important; }
    body { background: #fff; }
    .card { border: 1px solid #ddd; box-shadow: none; }
}
