/* NetEsnaf B2B Customer Panel - Style */

/* ============================================================
   CSS Variables / Theme
   ============================================================ */
:root,
[data-theme="light"] {
    --primary: #1E40AF;
    --primary-light: #3B82F6;
    --primary-bg: #EFF6FF;
    --accent: #F59E0B;
    --accent-bg: #FFFBEB;
    --success: #059669;
    --success-bg: #D1FAE5;
    --error: #DC2626;
    --error-bg: #FEE2E2;
    --warning: #D97706;
    --warning-bg: #FEF3C7;
    --info: #0284C7;
    --info-bg: #E0F2FE;

    --bg: #F8FAFC;
    --bg-alt: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-width: 260px;
    --topbar-height: 60px;
}

[data-theme="dark"] {
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --primary-bg: rgba(59,130,246,.15);
    --accent: #FBBF24;
    --accent-bg: rgba(251,191,36,.15);
    --success: #34D399;
    --success-bg: rgba(52,211,153,.15);
    --error: #F87171;
    --error-bg: rgba(248,113,113,.15);
    --warning: #FBBF24;
    --warning-bg: rgba(251,191,36,.15);
    --info: #38BDF8;
    --info-bg: rgba(56,189,248,.15);

    --bg: #0F172A;
    --bg-alt: #1E293B;
    --bg-card: #1E293B;
    --bg-sidebar: #1E293B;
    --border: #334155;
    --border-light: #1E293B;

    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.4);
}


/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

table { border-collapse: collapse; width: 100%; }


/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4, h5 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}


/* ============================================================
   Layout: Sidebar + Main
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s ease;
}

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}


/* Sidebar Header */
.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none !important;
}

.logo-img { height: 40px; width: auto; }

.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--tema-renk, var(--primary)), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 16px;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -2px;
}


/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-section { margin-bottom: 8px; }

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
    text-decoration: none !important;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text);
    background: var(--bg-alt);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-bg);
    border-left-color: var(--primary);
}

.nav-icon { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }


/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 12px 0;
}

.sidebar-user { padding: 4px 20px 8px; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-code { font-size: 11px; color: var(--text-muted); }

.logout-btn { color: var(--error) !important; }
.logout-btn:hover { background: var(--error-bg) !important; }


/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}


/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.theme-toggle:hover { background: var(--bg-alt); color: var(--text); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }


/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title { font-size: 15px; font-weight: 600; }

.card-link { font-size: 13px; font-weight: 500; }

.card-body { padding: 20px; }

.card-body-np { padding: 0; }

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* Stat Cards (Dashboard) */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }


/* ============================================================
   Table
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table thead th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg-alt); }

.table tbody tr:last-child td { border-bottom: none; }

.clickable-row { cursor: pointer; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }


/* ============================================================
   Badge
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }


/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }

.btn-error { background: var(--error); color: #fff; }
.btn-error:hover { opacity: .9; }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-alt); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }


/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

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

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-error { border-color: var(--error) !important; }
.form-error-text { font-size: 12px; color: var(--error); margin-top: 4px; }

.form-actions { display: flex; gap: 12px; margin-top: 20px; }


/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }


/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }

.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 20px; }

.empty-state-sm {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}


/* ============================================================
   Detail Page
   ============================================================ */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-header h2 { font-size: 20px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.detail-item { }
.detail-item-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.detail-item-value { font-size: 14px; font-weight: 500; }

.detail-section { margin-top: 24px; }
.detail-section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }


/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    transition: all .15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }


/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-input,
.filter-bar .form-select { min-width: 160px; }


/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    font-size: 13px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none !important;
}

.pagination a:hover { background: var(--bg-alt); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; cursor: not-allowed; }


/* ============================================================
   Share Link Box
   ============================================================ */
.share-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-top: 12px;
}

.share-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    outline: none;
}


/* ============================================================
   Product Card (Urun Katalog)
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow .15s;
    cursor: pointer;
}

.product-card:hover { box-shadow: var(--shadow-md); }

.product-card-body { padding: 14px; }
.product-card-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.product-card-code { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.product-card-price { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; color: var(--primary); }
.product-card-stock { font-size: 11px; margin-top: 4px; }


/* ============================================================
   Loading / Spinner
   ============================================================ */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 20px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}


/* ============================================================
   Siparis Olustur
   ============================================================ */
.order-items-table .qty-input {
    width: 70px;
    text-align: center;
    padding: 5px 8px;
}

.order-summary {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.order-summary-row.total {
    font-size: 16px;
    font-weight: 700;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 2px solid var(--border);
}


/* ============================================================
   Checklist (Servis)
   ============================================================ */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.checklist-item:last-child { border-bottom: none; }

.checklist-done { color: var(--success); }
.checklist-pending { color: var(--text-muted); }


/* ============================================================
   Public Share Page
   ============================================================ */
.public-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.public-header {
    text-align: center;
    margin-bottom: 32px;
}

.public-header .logo-icon {
    margin: 0 auto 12px;
}

.public-header h1 { font-size: 20px; }
.public-header p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.public-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
}

.print-btn { margin-bottom: 20px; }


/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .menu-toggle { display: block; }

    .content { padding: 16px; }

    .topbar { padding: 0 16px; }

    .stat-cards { grid-template-columns: 1fr 1fr; }

    .detail-grid { grid-template-columns: 1fr; }

    .form-row { grid-template-columns: 1fr; }

    .filter-bar { flex-direction: column; }
    .filter-bar .form-input,
    .filter-bar .form-select { min-width: 100%; }

    .table { font-size: 12px; }
    .table thead th,
    .table tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }

    .detail-header { flex-direction: column; }
    .detail-actions { width: 100%; }
    .detail-actions .btn { flex: 1; }
}


/* ============================================================
   Utilities
   ============================================================ */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-1 { flex: 1; }
.fw-600 { font-weight: 600; }
.fs-sm { font-size: 12px; }
.hidden { display: none !important; }
