/* ================================================================
   RectaPOS - Modern Tasarım Sistemi (Kuyumcu/Takı Teması)
   ================================================================ */

:root {
    --gold: #c9a24b;
    --gold-light: #e6cd8a;
    --navy: #10141f;
    --navy-soft: #1a2032;
    --panel: #ffffff;
    --bg: #f4f5f8;
    --text: #1c1f2a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #1a9c5f;
    --danger: #d64545;
    --warning: #d69b1c;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(16, 20, 31, 0.06);
    --shadow-lg: 0 10px 30px rgba(16, 20, 31, 0.14);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 15px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------------- App Shell ---------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-soft) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    padding: 22px 20px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--gold-light);
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-nav a {
    padding: 11px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.78);
    font-size: 14.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--gold); color: #1a1a1a; font-weight: 600; }

.sidebar-user {
    padding: 16px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-name { font-weight: 600; font-size: 14px; }
.sidebar-user-role { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.sidebar-logout {
    display: inline-block;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--gold-light);
}
.sidebar-logout:hover { text-decoration: underline; }

.main-content {
    flex: 1;
    padding: 24px 28px;
    min-width: 0;
}

/* ---------------- Auth Pages ---------------- */
.auth-body {
    background: radial-gradient(circle at top, #1a2032 0%, #0b0e16 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-box {
    background: #fff;
    padding: 36px 34px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.auth-logo { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: var(--navy); }
.auth-box h1 { font-size: 20px; margin: 0 0 18px; color: var(--navy); }
.auth-box label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: var(--text-muted); }
.auth-box input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14.5px; }
.auth-box input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,0.15); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    transition: filter 0.12s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; margin-top: 18px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.2); }
.btn-gold { background: var(--gold); color: #1a1a1a; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.12); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #f6f6f6; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Alerts ---------------- */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; }
.alert-error { background: #fdeaea; color: #a02222; border: 1px solid #f3c6c6; }
.alert-success { background: #e9f9f0; color: #147a45; border: 1px solid #b9ecd1; }
.alert-info { background: #eaf2fd; color: #1c5faa; border: 1px solid #c3dcf7; }
.alert-warning { background: #fdf6e3; color: #93701a; border: 1px solid #f2e0a8; }

/* ---------------- Cards / Panels ---------------- */
.card {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 21px; margin: 0; color: var(--navy); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 4px; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 700; }
tr:hover td { background: #fafafa; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=tel], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,0.15); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge-success { background: #e9f9f0; color: #147a45; }
.badge-danger { background: #fdeaea; color: #a02222; }
.badge-warning { background: #fdf6e3; color: #93701a; }
.badge-muted { background: #f0f0f0; color: #666; }

/* ---------------- Modal ---------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,12,20,0.55);
    display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: var(--radius); width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ================================================================
   POS (Hızlı Satış) Ekranı
   ================================================================ */
.pos-layout { display: grid; grid-template-columns: 1fr 400px; gap: 18px; height: calc(100vh - 48px); }

.pos-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.scan-bar {
    background: var(--navy);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: var(--shadow);
}
.scan-bar input {
    flex: 1;
    padding: 13px 14px;
    font-size: 17px;
    border-radius: 8px;
    border: none;
}
.scan-bar .scan-icon { color: var(--gold-light); font-size: 20px; }

.product-search-results {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px; flex: 1; overflow-y: auto; min-height: 120px;
}
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.product-tile {
    border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: left;
    background: #fff; transition: border-color .12s, box-shadow .12s;
}
.product-tile:hover { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,75,0.12); }
.product-tile .name { font-size: 13.5px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; min-height: 34px; }
.product-tile .price { color: var(--navy); font-weight: 700; font-size: 14.5px; }
.product-tile .stock { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.product-tile .stock.low { color: var(--danger); font-weight: 700; }

.held-sales-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.held-chip {
    flex-shrink: 0; background: #fff7e6; border: 1px solid #f0d99a; border-radius: 8px;
    padding: 8px 12px; font-size: 12.5px; white-space: nowrap;
}
.held-chip b { color: var(--warning); }

/* Sepet (Sağ Panel) */
.pos-cart {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden;
}
.pos-cart-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display:flex; justify-content: space-between; align-items:center; }
.pos-cart-header h3 { margin: 0; font-size: 16px; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 6px 10px; }

.cart-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 6px; border-bottom: 1px solid #f0f0f0; }
.cart-row .info { flex: 1; min-width: 0; }
.cart-row .info .name { font-size: 13.5px; font-weight: 600; }
.cart-row .info .meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.cart-row .qty-box { display: flex; align-items: center; gap: 4px; }
.cart-row .qty-box button { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: #fff; font-size: 14px; line-height: 1; }
.cart-row .qty-box input { width: 42px; text-align: center; padding: 4px; font-size: 13px; }
.cart-row .line-total { width: 76px; text-align: right; font-weight: 700; font-size: 13.5px; }
.cart-row .remove-btn { color: var(--danger); background: none; border: none; font-size: 16px; padding: 2px 4px; }
.cart-row .discount-input { width: 60px; padding: 3px 5px; font-size: 12px; margin-top: 4px; }

.pos-cart-empty { text-align: center; color: var(--text-muted); padding: 40px 10px; font-size: 13.5px; }

.pos-summary { padding: 12px 16px; border-top: 1px solid var(--border); background: #fafafa; }
.summary-line { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; }
.summary-line.total { font-size: 19px; font-weight: 800; color: var(--navy); padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 6px; }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 16px; }
.pos-actions .btn { padding: 12px; }
.pos-actions .btn-checkout { grid-column: 1 / -1; }

/* Ödeme Modal */
.pay-methods { display: flex; gap: 8px; margin-bottom: 12px; }
.pay-method-btn {
    flex: 1; padding: 12px; border-radius: 10px; border: 2px solid var(--border);
    background: #fff; font-weight: 700; font-size: 13.5px; text-align:center;
}
.pay-method-btn.active { border-color: var(--gold); background: #fdf8ec; }
.pay-split-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pay-split-row label { width: 110px; font-size: 13px; font-weight: 600; }
.pay-remaining { font-size: 14px; font-weight: 700; text-align: center; padding: 10px; border-radius: 8px; background: #f4f5f8; margin: 10px 0; }
.pay-remaining.ok { background: #e9f9f0; color: #147a45; }
.pay-remaining.neg { background: #fdeaea; color: #a02222; }

/* Numpad (dokunmatik hızlı giriş için) */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.numpad button { padding: 12px; font-size: 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 600; }
.numpad button:hover { background: #f6f6f6; }

/* ---------------- Fiş Yazdırma (Print) ---------------- */
.receipt {
    width: 300px; margin: 0 auto; background: #fff; padding: 14px; font-family: 'Courier New', monospace; font-size: 12.5px; color: #000;
}
.receipt h2 { text-align: center; font-size: 15px; margin: 0 0 2px; }
.receipt .center { text-align: center; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 8px 0; }
.receipt table { width: 100%; font-size: 12px; }
.receipt table th, .receipt table td { padding: 3px 0; border: none; }
.receipt .totals-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; }
.receipt .grand-total { font-size: 15px; font-weight: 800; border-top: 1px dashed #000; margin-top: 4px; padding-top: 4px; }
.no-print { }
@media print {
    body.receipt-page * { visibility: hidden; }
    body.receipt-page .receipt, body.receipt-page .receipt * { visibility: visible; }
    body.receipt-page .receipt { position: absolute; top: 0; left: 0; width: 100%; }
    .no-print { display: none !important; }
}

/* ---------------- Barkod Etiket Yazdırma ---------------- */
.label-sheet { display: flex; flex-wrap: wrap; gap: 8px; }
.label-item { border: 1px dashed #bbb; padding: 6px 10px; text-align: center; }
.label-item .label-name { font-size: 11px; font-weight: 700; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.label-item .label-price { font-size: 12px; font-weight: 800; margin-top: 2px; }
@media print {
    .label-only * { visibility: hidden; }
    .label-only .label-sheet, .label-only .label-sheet * { visibility: visible; }
    .label-only .label-sheet { position: absolute; top: 0; left: 0; }
}

/* ---------------- Rapor Yazdırma ---------------- */
.report-print-header { display: none; }
@media print {
    body.report-page .sidebar { display: none !important; }
    body.report-page .no-print { display: none !important; }
    body.report-page .app-shell { display: block; }
    body.report-page .main-content { padding: 0; }
    body.report-page .report-print-header { display: block; margin-bottom: 14px; }
    body.report-page .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ---------------- Basit Bar Grafik ---------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 10px 4px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-chart .bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-radius: 4px 4px 0 0; }
.bar-chart .bar-label { font-size: 10px; color: var(--text-muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-chart .bar-value { font-size: 10px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 600; }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
    .pos-layout { grid-template-columns: 1fr; height: auto; }
    .sidebar { position: static; height: auto; }
    .app-shell { flex-direction: column; }
}

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: slideIn .2s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity:0; } to { transform: translateX(0); opacity:1; } }
