/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #1e293b; min-height: 100vh; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* =============================================
   LAYOUT — mobile default: no sidebar
   ============================================= */
.app { display: flex; min-height: 100vh; }

/* =============================================
   SIDEBAR — hidden by default on mobile
   ============================================= */
.sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: 240px; background: #0f172a;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200; overflow-y: auto;
}
.sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }

.sidebar-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px; border-bottom: 1px solid #1e293b; flex-shrink: 0;
}
.sidebar-logo  { font-size: 1.4rem; color: #3b82f6; }
.sidebar-title { font-size: 0.97rem; font-weight: 700; color: #f1f5f9; flex: 1; }
.sidebar-close { background: none; border: none; color: #94a3b8; font-size: 1.2rem; padding: 4px 6px; border-radius: 4px; line-height: 1; }
.sidebar-close:hover { background: #1e293b; color: #fff; }

.sidebar-nav  { flex: 1; padding: 8px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 20px; color: #94a3b8; font-size: 0.93rem;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover  { background: #1e293b; color: #f1f5f9; }
.nav-item.active { background: #1d4ed8; color: #fff; font-weight: 600; }
.nav-logout      { color: #f87171; }
.nav-logout:hover { background: #1e293b; }

.sidebar-footer  { padding: 8px 0; border-top: 1px solid #1e293b; flex-shrink: 0; }

/* =============================================
   OVERLAY
   ============================================= */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 190; }
.overlay.show { display: block; }

/* =============================================
   MAIN
   ============================================= */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; width: 100%; }

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky; top: 0; z-index: 50;
}
.hamburger { display: flex; align-items: center; justify-content: center; background: none; border: none; font-size: 1.3rem; color: #475569; padding: 6px; border-radius: 6px; }
.hamburger:hover { background: #f1f5f9; }
.page-title  { font-size: 1rem; font-weight: 700; flex: 1; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { font-size: 0.82rem; color: #64748b; white-space: nowrap; }

/* =============================================
   CONTENT
   ============================================= */
.content { padding: 14px; flex: 1; }

/* =============================================
   DASHBOARD STATS
   ============================================= */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card  { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.stat-icon  { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-label { font-size: 0.76rem; color: #64748b; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: #1e293b; line-height: 1.2; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }

/* =============================================
   CARDS
   ============================================= */
.card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; margin-bottom: 14px; overflow: hidden; }
.card:last-child { margin-bottom: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; gap: 8px; }
.card-title  { font-size: 0.95rem; font-weight: 700; color: #1e293b; }
.card-body   { padding: 14px 16px; }

/* =============================================
   TOOLBAR
   ============================================= */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.toolbar .spacer { flex: 1; min-width: 8px; }
.tarih-kisa-grup { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar .btn-sm,
.toolbar .input-sm,
.toolbar .select.input-sm { min-height: 34px; box-sizing: border-box; }
.tarih-kisa.aktif { background: #2563eb !important; color: #fff !important; border-color: #2563eb !important; }

/* =============================================
   FORM ELEMENTS
   ============================================= */
.input, .select, .textarea {
    border: 1px solid #cbd5e1; border-radius: 7px; padding: 9px 12px;
    font-size: 0.93rem; color: #1e293b; background: #fff;
    outline: none; transition: border 0.15s, box-shadow 0.15s;
    width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.input-sm { padding: 7px 10px; font-size: 0.88rem; }
.input-search { max-width: 220px; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border-radius: 7px; font-size: 0.9rem;
    font-weight: 600; border: none; transition: background 0.15s, opacity 0.15s;
    white-space: nowrap; line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-ghost   { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover:not(:disabled)   { background: #e2e8f0; }
.btn-sm   { padding: 6px 12px; font-size: 0.84rem; }
.btn-icon { padding: 6px 9px; }

/* =============================================
   TABLE
   ============================================= */
.tablo-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tablo { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.tablo thead th {
    background: #f8fafc; padding: 10px 12px; text-align: left;
    font-weight: 700; color: #475569; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
table.tablo thead th.siralanabilir { cursor: pointer; user-select: none; transition: color 0.15s; }
table.tablo thead th.siralanabilir:hover { color: #2563eb; }
table.tablo thead th.siralanabilir.aktif { color: #2563eb; }
table.tablo thead th .sort-ok { font-size: 0.65rem; opacity: 0.85; }
table.tablo tbody td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; font-size: 0.9rem; }
table.tablo tbody tr:hover td { background: #f8fafc; }
table.tablo tbody tr:last-child td { border-bottom: none; }
.tablo-bos   { text-align: center; padding: 40px; color: #94a3b8; font-style: italic; }
.tablo-islem { display: flex; gap: 4px; }

/* =============================================
   BADGE
   ============================================= */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* =============================================
   PAGINATION
   ============================================= */
.sayfalama { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 0 4px; }
.sayfalama button {
    min-width: 34px; height: 34px; border: 1px solid #e2e8f0; border-radius: 7px;
    background: #fff; font-size: 0.85rem; font-family: inherit;
    transition: background 0.15s; padding: 0 8px;
}
.sayfalama button:hover:not(:disabled) { background: #dbeafe; border-color: #3b82f6; color: #2563eb; }
.sayfalama button.aktif { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 700; }
.sayfalama button:disabled { opacity: 0.4; cursor: default; }
.sayfalama-bilgi { font-size: 0.82rem; color: #64748b; margin-left: 4px; }

/* =============================================
   MODAL
   ============================================= */
.modal-bg {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.6); z-index: 300;
    align-items: flex-end; justify-content: center;
    padding: 0;
}
.modal-bg.open { display: flex; }
.modal {
    background: #fff; border-radius: 14px 14px 0 0;
    width: 100%; max-height: 92vh; overflow-y: auto;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-title  { font-size: 1rem; font-weight: 700; }
.modal-close  { background: none; border: none; font-size: 1.3rem; color: #94a3b8; padding: 2px 8px; border-radius: 5px; }
.modal-close:hover { background: #f1f5f9; color: #1e293b; }
.modal-body   { padding: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid #e2e8f0; }

/* Stok seçici (arama + liste) */
.stok-sec { position: relative; }
.stok-sec-input-wrap { display: flex; gap: 0; }
.stok-sec-input { flex: 1; border-radius: 7px 0 0 7px !important; }
.stok-sec-toggle {
    flex-shrink: 0; width: 40px; border: 1px solid #e2e8f0; border-left: none;
    border-radius: 0 7px 7px 0; background: #f8fafc; color: #475569;
    font-size: 0.9rem; cursor: pointer;
}
.stok-sec-toggle:hover { background: #e2e8f0; color: #2563eb; }
.stok-sec-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    z-index: 400; max-height: 240px; overflow-y: auto;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}
.stok-sec-item {
    display: block; width: 100%; text-align: left; padding: 10px 14px;
    border: none; border-bottom: 1px solid #f1f5f9; background: #fff;
    cursor: pointer; font-family: inherit;
}
.stok-sec-item:last-child { border-bottom: none; }
.stok-sec-item:hover, .stok-sec-item:focus { background: #eff6ff; outline: none; }
.stok-sec-kod { display: block; font-weight: 700; font-size: 0.88rem; color: #1d4ed8; }
.stok-sec-ad { display: block; font-size: 0.86rem; color: #334155; margin-top: 2px; }
.stok-sec-meta { display: block; font-size: 0.78rem; color: #94a3b8; margin-top: 2px; }
.stok-sec-bos { padding: 14px; text-align: center; color: #94a3b8; font-size: 0.86rem; }

/* =============================================
   FORM GRID
   ============================================= */
.form-grid     { display: grid; grid-template-columns: 1fr; gap: 13px; }
.form-group    { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label    { font-size: 0.82rem; font-weight: 600; color: #475569; }

/* =============================================
   NOTIFICATION
   ============================================= */
.bildirim {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 999; padding: 13px 22px; border-radius: 10px;
    font-size: 0.93rem; font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    animation: fadeInUp 0.25s ease; max-width: 90vw; text-align: center;
    white-space: nowrap;
}
@keyframes fadeInUp { from { transform: translateX(-50%) translateY(12px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.bildirim-success { background: #16a34a; color: #fff; }
.bildirim-error   { background: #dc2626; color: #fff; }
.bildirim-warning { background: #d97706; color: #fff; }
.bildirim-info    { background: #2563eb; color: #fff; }

/* =============================================
   LOADING
   ============================================= */
.yukleniyor { text-align: center; padding: 32px; color: #94a3b8; }
.spinner    { display: inline-block; width: 26px; height: 26px; border: 3px solid #e2e8f0; border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   LOGIN
   ============================================= */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f172a; padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 36px 28px; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo span { font-size: 2rem; }
.login-logo h2  { font-size: 1.2rem; font-weight: 800; color: #0f172a; margin-top: 8px; }
.login-logo p   { font-size: 0.82rem; color: #64748b; margin-top: 4px; }
.login-form     { display: flex; flex-direction: column; gap: 14px; }
.login-hata     { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 7px; font-size: 0.87rem; display: none; }

/* =============================================
   KRITIK STOK
   ============================================= */
.kritik-satir td { background: #fff7ed !important; }
.kritik-satir:hover td { background: #fef3c7 !important; }

/* =============================================
   RAPOR
   ============================================= */
.rapor-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.rapor-kart { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 16px 18px; }
.rapor-kart h3 { font-size: 0.92rem; font-weight: 700; color: #475569; margin-bottom: 12px; }

/* =============================================
   TABLET — 640px+
   ============================================= */
@media (min-width: 640px) {
    .content     { padding: 18px; }
    .topbar      { padding: 12px 20px; }
    .form-grid   { grid-template-columns: 1fr 1fr; }
    .stats-grid  { grid-template-columns: repeat(4, 1fr); }
    .rapor-grid  { grid-template-columns: 1fr 1fr; }
    .modal-bg    { align-items: center; padding: 20px; }
    .modal       { border-radius: 12px; max-width: 560px; }
    .bildirim    { left: auto; right: 24px; transform: none; }
    @keyframes fadeInUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* =============================================
   DESKTOP — 1024px+
   ============================================= */
@media (min-width: 1024px) {
    .sidebar {
        position: sticky; top: 0; height: 100vh;
        transform: translateX(0) !important;
        flex-shrink: 0;
    }
    .sidebar-close { display: none !important; }
    .hamburger     { display: none !important; }
    .overlay       { display: none !important; }
    .content       { padding: 22px; }
    .form-grid.col3 { grid-template-columns: 1fr 1fr 1fr; }
    .dash-grid     { grid-template-columns: 3fr 2fr; }
    .modal         { max-width: 600px; }
    .input-search  { max-width: 240px; }
}

@media (min-width: 1280px) {
    .stats-grid { gap: 16px; }
    .stat-value { font-size: 1.6rem; }
}
