/* ==========================================================================
   wBasicERP — Tablet-first, dokunmatik dostu, responsive tema
   ========================================================================== */

:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --ink: #1e293b;
    --ink-soft: #64748b;
    --surface: #ffffff;
    --bg: #eef1f6;
    --line: #e2e8f0;
    --ok: #16a34a;
    --danger: #dc2626;
    --warn: #d97706;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 6px 20px rgba(30, 41, 59, .08);
    --shadow-lg: 0 12px 32px rgba(30, 41, 59, .14);
    --tap: 3.25rem; /* dokunmatik minimum hedef yüksekliği */
}

html {
    font-size: 16px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 17px; }
}

body {
    background: var(--bg);
    color: var(--ink);
    margin: 0;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Üst uygulama çubuğu ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(100deg, var(--brand) 0%, #6366f1 60%, #7c83f6 100%);
    box-shadow: var(--shadow);
}

.app-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: .3px;
    text-decoration: none;
    white-space: nowrap;
}

.app-brand .logo {
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .2);
    border-radius: 10px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.app-nav .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: .6rem .9rem;
    border-radius: 999px;
    line-height: 1;
    transition: background .15s ease;
}

.app-nav .nav-btn:hover,
.app-nav .nav-btn.active {
    background: rgba(255, 255, 255, .22);
}

.app-nav .nav-btn svg { width: 1.15rem; height: 1.15rem; }

@media (min-width: 861px) {
    .app-nav { flex: 1; }
    .app-nav .app-user { margin-left: auto; }
}

/* Admin açılır menüsü */
.app-nav .dropdown { display: inline-flex; }
.app-nav .dropdown-toggle::after { margin-left: .1rem; }
.app-nav .dropdown-menu {
    border: 0;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: .4rem;
    margin-top: .3rem;
    min-width: 12rem;
}
.app-nav .dropdown-item {
    border-radius: 9px;
    padding: .6rem .8rem;
    font-weight: 600;
    color: var(--ink);
}
.app-nav .dropdown-item:hover { background: var(--brand-light); color: var(--brand); }
.app-nav .dropdown-item.active { background: var(--brand); color: #fff; }

.app-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    font-weight: 600;
}

.app-user .role-chip {
    font-size: .72rem;
    padding: .18rem .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .25);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.logout-btn {
    background: rgba(0, 0, 0, .18);
    border: 0;
    color: #fff;
    font-weight: 600;
    padding: .5rem .8rem;
    border-radius: 999px;
    cursor: pointer;
}
.logout-btn:hover { background: rgba(0, 0, 0, .3); }

/* Hamburger (mobil) */
.nav-toggle {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, .18);
    border: 0;
    color: #fff;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 12px;
    font-size: 1.4rem;
    cursor: pointer;
}

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .app-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        padding: .5rem 1rem 1rem;
    }
    .app-bar { flex-wrap: wrap; }
    .app-collapse { width: 100%; }
    .app-collapse.open .app-nav { display: flex; }
    .app-nav .nav-btn {
        font-size: 1.1rem;
        padding: .85rem 1rem;
        border-radius: 14px;
    }
    .app-user { padding: .3rem 1rem 0; }
}

/* ---------- İçerik kabı ---------- */
.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.page-title {
    font-weight: 800;
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    margin: .25rem 0 1.25rem;
}

/* ---------- Butonlar: büyük, dokunmatik ---------- */
.btn {
    min-height: var(--tap);
    padding: .7rem 1.35rem;
    font-size: 1.02rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.btn-sm {
    min-height: 2.6rem;
    padding: .45rem .85rem;
    font-size: .92rem;
    border-radius: 10px;
}

.btn-lg { min-height: 3.75rem; font-size: 1.15rem; padding: .9rem 1.8rem; }

.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); border-width: 2px; }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-outline-secondary, .btn-outline-success, .btn-outline-danger, .btn-outline-info, .btn-outline-warning { border-width: 2px; }

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .22rem rgba(79, 70, 229, .3);
}

/* ---------- Kartlar ---------- */
.card {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 1rem 1.25rem;
}

.card .card-body { padding: 1.25rem; }

/* ---------- Dashboard: istatistik + büyük kutucuklar ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    color: #fff;
    box-shadow: var(--shadow);
}
.stat .label { font-size: .85rem; opacity: .9; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; line-height: 1.15; margin-top: .2rem; }
.stat .sub { font-size: .8rem; opacity: .85; }
.stat.alacak { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat.borc { background: linear-gradient(135deg, #16a34a, #22c55e); }
.stat.info { background: var(--surface); color: var(--ink); }
.stat.info .label { color: var(--ink-soft); }
.stat.info .value { color: var(--brand); }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 44vw, 230px), 1fr));
    gap: 1rem;
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .75rem;
    min-height: 8.5rem;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.08rem;
    transition: transform .12s ease, box-shadow .12s ease;
    border: 1px solid transparent;
}

.tile:hover, .tile:focus {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-light);
    color: var(--ink);
}
.tile:active { transform: translateY(0); }

.tile .ico {
    width: 3.75rem;
    height: 3.75rem;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--brand-light);
    color: var(--brand);
}
.tile .ico svg { width: 2rem; height: 2rem; }

.tile.accent-green .ico { background: #dcfce7; color: #16a34a; }
.tile.accent-amber .ico { background: #fef3c7; color: #d97706; }
.tile.accent-sky .ico { background: #e0f2fe; color: #0284c7; }
.tile.accent-rose .ico { background: #ffe4e6; color: #e11d48; }
.tile.accent-violet .ico { background: #ede9fe; color: #7c3aed; }

.section-label {
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-size: .82rem;
    margin: 1.75rem 0 .85rem;
}

/* ---------- Formlar: dokunmatik ---------- */
.form-control, .form-select {
    min-height: var(--tap);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 1.02rem;
    padding: .65rem .9rem;
}
textarea.form-control { min-height: 6rem; }
.form-label { font-weight: 600; margin-bottom: .35rem; }
.form-check-input { width: 1.35rem; height: 1.35rem; margin-top: .15rem; }
.form-check-label { padding-left: .2rem; }

/* ---------- Tablolar: geniş satır, dokunmatik ---------- */
.table-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
/* Tüm liste/rapor tabloları otomatik kart görünümü */
.page .table-responsive {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
}

.table {
    margin: 0;
    --bs-table-hover-bg: var(--brand-light);
}
.table > thead th {
    background: #f8fafc;
    color: var(--ink-soft);
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--line);
    padding: .9rem 1rem;
    white-space: nowrap;
}
.table > tbody td { padding: .95rem 1rem; vertical-align: middle; }
.table > tbody tr { border-bottom: 1px solid var(--line); }

/* ---------- Rozetler & uyarılar ---------- */
.badge { font-weight: 600; padding: .45em .7em; border-radius: 999px; font-size: .78rem; }
.alert { border: 0; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 500; padding: 1rem 1.15rem; }

/* Bakiye/miktar büyük rozet */
.big-badge {
    border-radius: var(--radius);
    color: #fff;
    text-align: center;
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.big-badge .lbl { font-size: .82rem; text-transform: uppercase; opacity: .9; letter-spacing: .5px; }
.big-badge .num { font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 800; }

/* Filtre çubuğu */
.toolbar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}

/* ---------- Giriş / Identity sayfaları ---------- */
.auth-body {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card {
    background: var(--surface);
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .35);
    padding: 2rem 1.9rem 2.2rem;
}
.auth-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.5rem; }
.auth-brand .logo {
    width: 3rem; height: 3rem; border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), #6366f1);
    display: grid; place-items: center;
}
.auth-brand .name { font-weight: 800; font-size: 1.4rem; color: var(--ink); line-height: 1; }
.auth-brand .tag { color: var(--ink-soft); font-size: .85rem; margin-top: .2rem; }
.auth-card h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: .25rem; }
.auth-card h2 { font-size: 1rem; color: var(--ink-soft); font-weight: 500; margin-bottom: 1.25rem; }
.auth-card hr { display: none; }
.auth-card .btn-primary { width: 100%; }

/* Yardımcılar */
.stack-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
@media (max-width: 575px) {
    .stack-actions .btn { flex: 1 1 100%; }
    .page-head-actions { width: 100%; }
    .page-head-actions .btn { flex: 1 1 auto; }
}
