/* Mersin E-İmza Merkezi ERP - Kurumsal Tema */
:root {
    --primary: #1a56db;
    --primary-dark: #1347b8;
    --primary-light: #e8effc;
    --secondary: #6b7280;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --bg: #f3f4f6;
    --bg-card: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --transition: .2s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary-light: #1e3a5f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e3a8a 0%, #1a56db 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand img {
    max-width: 60px;
    height: auto;
    background: #fff;
    border-radius: 10px;
    padding: 6px;
}
.sidebar-brand h2 { font-size: .9rem; font-weight: 600; margin-top: 4px; margin-bottom: 0; opacity: .9; line-height: 1.25; }

.sidebar-nav { padding: 4px 0 8px; }
.nav-section {
    padding: 6px 16px 2px;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .5;
    line-height: 1.2;
}
.nav-section:first-child { padding-top: 2px; }
.nav-item a {
    display: flex; align-items: center; gap: 9px;
    padding: 6px 16px;
    color: rgba(255,255,255,.8);
    font-size: .92rem;
    line-height: 1.35;
    transition: all var(--transition);
}
.nav-item a:hover, .nav-item a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item .icon { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }

.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text); }
.page-title { font-size: 1.2rem; font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 16px; }
.theme-toggle, .notif-btn {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 12px; cursor: pointer;
    font-size: 1rem; color: var(--text); transition: all var(--transition);
}
.theme-toggle:hover, .notif-btn:hover { background: var(--primary-light); }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff; font-size: .65rem;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.user-menu { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .85rem;
}

.content-area { padding: 24px; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    animation: fadeInUp .4s ease;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex; align-items: flex-start; gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition);
    animation: fadeInUp .4s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: .88rem; }
table th { background: var(--bg); font-weight: 600; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table tr:hover td { background: var(--primary-light); }
table .actions { white-space: nowrap; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: .9rem; background: var(--bg-card); color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.15); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 8px; font-size: .88rem;
    font-weight: 500; border: none; cursor: pointer;
    transition: all var(--transition); text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1da851; color: #fff; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* Badges */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: .75rem; font-weight: 500;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--bg); color: var(--text-muted); }

/* Alerts */
.alert {
    padding: 14px 18px; border-radius: 8px; margin-bottom: 16px;
    font-size: .9rem; display: flex; align-items: center; gap: 10px;
    animation: fadeIn .3s ease;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #a5f3fc; }

/* Pagination */
.pagination ul { display: flex; gap: 4px; list-style: none; justify-content: center; padding: 12px 0; }
.pagination li a, .pagination li.active {
    display: block; padding: 6px 12px; border-radius: 6px;
    border: 1px solid var(--border); font-size: .85rem;
}
.pagination li.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination li a:hover { background: var(--primary-light); }

/* Charts */
.chart-container { position: relative; height: 300px; padding: 10px; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }

/* Login */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 50%, #3b82f6 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
    animation: fadeInUp .5s ease;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { max-width: 200px; }
.login-logo h1 { font-size: 1.1rem; color: var(--primary); margin-top: 10px; }
.login-card h2 { text-align: center; margin-bottom: 24px; font-size: 1.3rem; color: var(--text); }

/* Public Pages */
.public-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8effc 100%);
    padding: 20px;
}
.public-card {
    background: #fff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
    text-align: center; animation: fadeInUp .5s ease;
}
.public-logo img { max-width: 220px; margin-bottom: 20px; }
.public-card h2 { color: var(--primary); margin-bottom: 8px; }
.public-info { background: var(--bg); border-radius: 10px; padding: 20px; margin: 20px 0; text-align: left; }
.public-info .info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.public-info .info-row:last-child { border-bottom: none; }
.public-info .label { color: var(--text-muted); font-size: .85rem; }
.public-info .value { font-weight: 600; }
.days-remaining { font-size: 2rem; font-weight: 700; color: var(--warning); margin: 16px 0; }
.days-remaining.expired { color: var(--danger); }
.days-remaining.safe { color: var(--success); }

/* Filters */
.filters-bar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin-bottom: 20px; padding: 16px; background: var(--bg-card);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.filters-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* Empty State */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: .4; }

/* Detail Grid */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.detail-item { padding: 10px 0; }
.detail-item .label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-item .value { font-size: .95rem; font-weight: 500; margin-top: 2px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 20px; cursor: pointer; font-size: .9rem; font-weight: 500;
    color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; visibility: hidden; transition: all var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card); border-radius: 12px; padding: 24px;
    width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    transform: scale(.9); transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Print */
@media print {
    .sidebar, .top-header, .btn, .filters-bar { display: none !important; }
    .main-content { margin-left: 0 !important; }
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.2rem; }
    .form-row { grid-template-columns: 1fr; }
    .login-card, .public-card { padding: 24px; }
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; } .gap-2 { gap: 12px; } .align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* Alış satır tablosu */
.purchase-lines-table { width: 100%; min-width: 960px; }
.purchase-lines-table th { font-size: .75rem; white-space: nowrap; }
.purchase-lines-table td { vertical-align: middle; padding: 8px 6px; }
.purchase-lines-table .form-control { min-width: 90px; font-size: .85rem; padding: 8px 10px; }
.purchase-lines-table .product-picker { position: relative; min-width: 240px; }
.product-picker-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; text-align: left; cursor: pointer; background: var(--bg-card);
}
.product-picker-trigger .product-picker-label {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .85rem;
}
.product-picker-trigger .product-picker-label:not(.has-value) { color: var(--text-muted); }
.product-picker-chevron { font-size: .75rem; opacity: .6; flex-shrink: 0; }
.product-picker.locked .product-picker-trigger {
    cursor: default; background: var(--bg); color: var(--text);
    border-color: var(--border); pointer-events: none;
}
.product-picker.locked .product-picker-chevron { display: none; }
.product-picker-panel {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 2px);
    padding: 8px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: var(--shadow); z-index: 200;
}
.product-picker-panel.open { display: block; }
.product-picker-search { margin-bottom: 6px; min-width: 0 !important; }
.product-search-results {
    max-height: 220px; overflow-y: auto; margin: 0; padding: 0; list-style: none;
}
.product-search-results li {
    padding: 8px 10px; font-size: .82rem; cursor: pointer; line-height: 1.35;
    border-radius: 6px;
}
.product-search-results li:hover { background: var(--primary-light); }
.product-search-results li.empty { color: var(--text-muted); cursor: default; }
.product-search-results li.empty:hover { background: transparent; }
.purchase-lines-table .category-display { display: inline-block; min-width: 90px; font-size: .85rem; }
.purchase-lines-table .vat-amount-display,
.purchase-lines-table .total-display { background: var(--bg); font-weight: 600; }
.purchase-lines-table tfoot td { border-top: 2px solid var(--border); padding-top: 12px; }
