/* ============================================================
   BÖLÜM 1: TEMEL AYARLAR VE DEĞİŞKENLER
   ============================================================ */
:root {
    --bg-body: #F8FAFC;          /* Açık Gri */
    --bg-sidebar: #0F172A;       /* Koyu Lacivert */
    --primary: #3B82F6;          /* Mavi */
    --primary-hover: #2563EB;    /* Koyu Mavi */
    --text-main: #1E293B;        /* Koyu Gri */
    --text-muted: #64748B;       /* Pasif Gri */
    --border-color: #E2E8F0;     /* Çerçeve */
    --danger: #EF4444;           /* Kırmızı */
    --success: #10B981;          /* Yeşil */
    --warning: #F59E0B;          /* Turuncu */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --radius: 12px;              
    --transition: all 0.3s ease;
}

* { box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    margin: 0; background-color: var(--bg-body); color: var(--text-main); font-size: 14px;
    -webkit-font-smoothing: antialiased; animation: slideDownFade 0.8s ease-out;
}

@keyframes slideDownFade { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }
.text-center { text-align: center; }
.full-width { width: 100%; }

/* ============================================================
   BÖLÜM 2: GİRİŞ EKRANI & SIDEBAR (ADMIN)
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 10%, rgba(34, 211, 238, 0.16), transparent 28rem),
        radial-gradient(circle at 82% 20%, rgba(59, 130, 246, 0.15), transparent 26rem),
        linear-gradient(135deg, #020617 0%, #0f172a 48%, #111827 100%);
}

.login-box {
    position: relative;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.86);
    padding: 40px;
    border-radius: 18px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.login-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.08), transparent 38%);
    pointer-events: none;
}

.login-box > * {
    position: relative;
    z-index: 1;
}

.brand-logo {
    font-size: 2rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    letter-spacing: 0;
}

.login-subtitle {
    color: #94a3b8;
    margin: 0 0 20px;
    text-align: center;
}

.login-box input {
    color: #e2e8f0;
    background: rgba(2, 6, 23, 0.48);
    border-color: rgba(148, 163, 184, 0.22);
}

.login-box input::placeholder {
    color: #64748b;
}

.login-box input:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13);
}

.login-box .btn-primary {
    background: linear-gradient(135deg, #0891b2, #2563eb);
    box-shadow: 0 14px 30px rgba(8, 145, 178, 0.2);
}

.login-box .btn-primary:hover {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.recaptcha-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 15px 0;
    min-height: 78px;
}

.login-box .error-msg {
    color: #fda4af;
}

@media (max-width: 380px) {
    .recaptcha-wrap {
        transform: scale(0.9);
        transform-origin: center;
        width: 112%;
    }
}

.dashboard-container { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; background: var(--bg-sidebar); display: flex; flex-direction: column; color: white; flex-shrink: 0; }
.sidebar .brand { padding: 25px; font-size: 1.4rem; font-weight: 700; color: white; border-bottom: 1px solid rgba(255,255,255,0.1); }
.nav-btn { background: transparent; border: none; color: #94A3B8; width: 90%; margin: 5px auto; padding: 12px 15px; text-align: left; cursor: pointer; font-weight: 500; border-radius: 8px; transition: var(--transition); display: flex; align-items: center; }
.nav-btn i { width: 24px; margin-right: 10px; font-size: 1.1em; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.nav-btn.active { background: var(--primary); color: white; }
.nav-btn.logout { margin-top: auto; margin-bottom: 20px; color: #F87171; }
.content { flex: 1; padding: 30px; overflow-y: auto; background: var(--bg-body); }

/* ============================================================
   BÖLÜM 3: TEMEL BİLEŞENLER
   ============================================================ */
h2 { font-size: 1.5rem; color: var(--text-main); font-weight: 700; margin-bottom: 20px; }
.card { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border-color); box-shadow: 0 2px 4px rgba(0,0,0,0.02); margin-bottom: 20px; }

input, select, textarea { 
    width: 100%; 
    padding: 12px 14px; /* İç boşluğu artırdık */
    margin: 8px 0; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 14px; 
    background: #fff; 
    transition: var(--transition); 
    color: var(--text-main); 
    /* height: 42px; Kodu SİLİNDİ - Sabit yükseklik yerine min-height kullanıyoruz */
    min-height: 45px; /* Yazının sığması için garanti alan */
    line-height: 1.5; /* Satır aralığını açarak harflerin kesilmesini önler */
    box-sizing: border-box; /* Padding'in taşmasını önler */
}

input:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); 
}
.btn-primary { background: var(--primary); color: white; border: none; padding: 0 20px; height: 42px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: #fff; border: 1px solid var(--border-color); color: var(--text-main); padding: 0 15px; height: 42px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; }
.btn-secondary:hover { background: #F8FAFC; border-color: #CBD5E1; }
.xml-sync-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: xml-sync-spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 7px;
}
@keyframes xml-sync-spin {
    to { transform: rotate(360deg); }
}
.btn-danger { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.data-badge { padding: 4px 8px; border-radius: 6px; background: #F1F5F9; color: var(--text-main); font-weight: 600; font-size: 12px; }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.notification-badge { background-color: var(--danger); color: white; border-radius: 12px; padding: 2px 8px; font-size: 10px; margin-left: 5px; vertical-align: middle; }

/* ============================================================
   BÖLÜM 4: ARAMA KUTULARI VE KAMERA
   ============================================================ */
.toolbar-container { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 20px; align-items: center; flex-wrap: wrap; }
.xml-manual-upload {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.xml-manual-upload__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    color: #2563eb;
    background: #dbeafe;
    font-size: 18px;
}
.xml-manual-upload__content { min-width: 0; }
.xml-manual-upload__content h4 { margin: 0 0 4px; color: var(--text-main); font-size: 14px; }
.xml-manual-upload__content p { margin: 0; color: var(--text-muted); font-size: 12px; }
.xml-manual-upload__button { margin-left: auto; flex-shrink: 0; }
@media (max-width: 640px) {
    .xml-manual-upload { align-items: flex-start; flex-wrap: wrap; }
    .xml-manual-upload__button { width: 100%; margin-left: 0; }
}
.search-wrapper { position: relative; display: flex; align-items: center; width: 100%; max-width: 400px; height: 42px; }
.search-wrapper input { margin: 0; border-radius: 8px; padding-left: 35px; width: 100%; height: 100%; }
.search-wrapper.with-camera input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; border-right: none !important; }
.search-wrapper.with-camera .btn-secondary { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; border-left: 1px solid var(--border-color); margin: 0; height: 100%; width: 50px; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--text-muted); }
.search-wrapper.with-camera .btn-secondary:hover { color: var(--primary); background: #f8fafc; }
.search-wrapper i.fa-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94A3B8; pointer-events: none; font-size: 14px; z-index: 5; }

/* ============================================================
   BÖLÜM 5: TABLOLAR
   ============================================================ */
.table-responsive { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-color); background: #fff; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { background: #F8FAFC; padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-main); vertical-align: middle; font-size: 13px; }
tr:hover td { background: #F8FAFC; }
.tab-container { display: flex; gap: 5px; padding: 4px; background: #E2E8F0; border-radius: 8px; width: fit-content; margin-bottom: 20px; }
.tab-btn { padding: 8px 20px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 13px; }
.tab-btn.active { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3); 
    transform: translateY(-1px);
}

/* ============================================================
   BÖLÜM 6: DASHBOARD & TOPTAN SATIŞ
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 20px; border-radius: var(--radius); display: flex; align-items: center; border: 1px solid var(--border-color); box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-right: 15px; flex-shrink: 0; }
.stat-info h3 { margin: 0; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.stat-info p { margin: 5px 0 0 0; font-size: 1.8rem; font-weight: 700; color: var(--text-main); line-height: 1; }
.orange .stat-icon { background: #FFF7ED; color: #EA580C; } .blue .stat-icon { background: #EFF6FF; color: var(--primary); }
.purple .stat-icon { background: #F3E8FF; color: #9333EA; } .red-outline .stat-icon { background: #F1F5F9; color: #94A3B8; }
.warning-active { border: 2px solid var(--danger); background: #FEF2F2; animation: pulseRed 2s infinite; } .warning-active .stat-icon { background: #FEE2E2; color: var(--danger); }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.wholesale-layout { display: flex; gap: 20px; align-items: flex-start; width: 100%; } .ws-left-col { flex: 1; min-width: 0; } .ws-right-col { width: 350px; flex-shrink: 0; }
.sticky-card { position: sticky; top: 20px; z-index: 90; background: #fff; border-radius: 12px; padding: 20px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed #eee; font-size: 14px; color: var(--text-muted); }
.summary-total { margin-top: 15px; padding-top: 15px; border-top: 2px solid var(--text-main); display: flex; justify-content: space-between; align-items: center; font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.discount-tiers-container { margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--border-color); }
.tier-item { display: flex; justify-content: space-between; padding: 8px 12px; margin-bottom: 5px; background: #F8FAFC; border-radius: 8px; font-size: 13px; color: var(--text-muted); border: 1px solid transparent; transition: var(--transition); }
.tier-item.active-tier { background: #EFF6FF; color: var(--primary); border-color: #BFDBFE; font-weight: 600; }
.badge-discount { background: #DCFCE7; color: #166534; padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-left: 5px; }
.switch { position: relative; display: inline-block; width: 40px; height: 24px; } .switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary); } input:focus + .slider { box-shadow: 0 0 1px var(--primary); } input:checked + .slider:before { transform: translateX(16px); } .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; }

/* ============================================================
   BÖLÜM 7: MODALLAR
   ============================================================ */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 1; }
.modal-content { background: #fff; padding: 25px; border-radius: 20px; width: 500px; max-width: 95%; position: relative; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); border: 1px solid #fff; max-height: 90vh; overflow-y: auto; }
.large-modal { width: 900px; }
.close { position: absolute; right: 20px; top: 20px; font-size: 20px; color: #94A3B8; cursor: pointer; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   BÖLÜM 9: MOBİL & PRINT AYARLARI
   ============================================================ */
@media (max-width: 768px) {
    body { font-size: 13px; background-color: #f8fafc; }
    .dashboard-container { flex-direction: column; height: auto; }
    .sidebar { width: 100%; height: auto; flex-direction: row; padding: 10px; position: sticky; top: 0; z-index: 100; overflow-x: auto; white-space: nowrap; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
    .sidebar .brand, .sidebar .user-info { display: none; }
    .sidebar nav { display: flex; gap: 8px; width: 100%; }
    .nav-btn { width: auto; margin: 0; padding: 8px 16px; font-size: 12px; background: rgba(255,255,255,0.1); border-radius: 20px; flex-shrink: 0; }
    .nav-btn.active { background: var(--primary); box-shadow: 0 2px 10px rgba(59,130,246,0.3); }
    .content { padding: 15px; padding-bottom: 80px; }
    .stats-grid, .wholesale-layout, .return-form-layout, .modal-wide .return-form-layout { grid-template-columns: 1fr !important; gap: 15px; display: flex; flex-direction: column; }
    .ws-right-col { width: 100%; }
    .sticky-card { position: relative; top: 0; }
    
    /* V-CARD DÖNÜŞÜMÜ (Responsive Tables) */
    table thead { display: none; }
    table tbody tr { display: block; background: #fff; border-radius: 12px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); border: 1px solid var(--border-color); padding: 15px; }
    table tbody td { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed #f1f5f9; text-align: right; font-size: 13px; }
    table tbody td:last-child { border-bottom: none; justify-content: center; padding-top: 15px; }
    table tbody td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 12px; text-align: left; margin-right: 10px; }

    /* Portal Mobil */
    .portal-hero h1 { font-size: 1.8rem; }
    .nav-flex { flex-direction: column; gap: 15px; }
    .portal-links { margin: 10px 0; }
    .radio-group { grid-template-columns: 1fr; }
    .timeline { font-size: 0.8rem; }
}

/* ROL TABANLI GİZLEME */
body[data-user-role="depo_sorumlusu"] .admin-only { display: none !important; }
body[data-user-role="personel"] .admin-only { display: none !important; }
body[data-user-role="izleyici"] .admin-only { display: none !important; }

/* Print */
.ws-table.print-table { table-layout: fixed; width: 100%; }
.ws-table.print-table th, .ws-table.print-table td { vertical-align: top; padding: 10px; word-wrap: break-word; white-space: normal; font-size: 13px; }
@media print { .sidebar, .toolbar-container, .btn-primary, .close { display: none !important; } .modal { position: absolute; background: white; } .modal-content { box-shadow: none; width: 100%; } }
