/* ============================================================
   Kurumsal Vekaletname — Application Stylesheet
   Gold & Black enterprise UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #17160f;
    --sidebar-border: rgba(181,155,72,0.15);
    --sidebar-text: #9a9180;
    --sidebar-text-hover: #f0e8d0;
    --sidebar-active-bg: rgba(181,155,72,0.15);
    --sidebar-active-text: #d4b866;
    --sidebar-active-border: #b59b48;
    --topbar-height: 60px;
    --accent: #b59b48;
    --accent-hover: #9a8237;
    --accent-light: rgba(181,155,72,0.1);
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
}

/* ── Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1030;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Logo area */
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #b59b48, #9a8237);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(181,155,72,0.4);
}

.sidebar-logo-text { min-width: 0; }
.sidebar-logo-text h5 { margin: 0; font-size: 15px; font-weight: 700; color: #f1f5f9; line-height: 1.2; }
.sidebar-logo-text small { font-size: 10px; color: var(--sidebar-text); letter-spacing: 0.5px; text-transform: uppercase; }

/* Section labels */
.sidebar-section {
    padding: 20px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--sidebar-text);
    opacity: 0.5;
    flex-shrink: 0;
}

/* Nav items */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 4px 10px;
    flex-shrink: 0;
}

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--sidebar-text-hover);
    border-left-color: rgba(255,255,255,0.1);
}

.sidebar-nav li a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-active-border);
}

.sidebar-nav li a i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav li a .nav-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 10px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

/* ── Main Wrapper ───────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ─────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.breadcrumb-topbar {
    margin: 0;
    font-size: 13px;
    background: none;
    padding: 0;
}

.breadcrumb-topbar .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-topbar .breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-topbar .breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }

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

.topbar-user {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 5px 10px;
    border-radius: 8px; transition: background 0.15s;
}
.topbar-user:hover { background: var(--body-bg); }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b59b48, #9a8237);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
}

.user-info { line-height: 1.3; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── Page Content ───────────────────────── */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0; line-height: 1.3; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; }

/* ── Cards ──────────────────────────────── */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.card-header .card-title { margin: 0; font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; background: #fafbfc; border-top: 1px solid var(--border-color); }

/* ── Stat Cards ─────────────────────────── */
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 4px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.stat-card.primary::after { background: var(--accent); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.info::after { background: var(--info); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-icon.primary { background: rgba(181,155,72,0.1); color: var(--accent); }
.stat-icon.success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.info { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon.danger { background: rgba(239,68,68,0.1); color: var(--danger); }

.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Tables ─────────────────────────────── */
.table {
    margin-bottom: 0;
    font-size: 13.5px;
    color: var(--text-primary);
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges / Status Pills ──────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-draft { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.badge-published { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-archived { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-generated { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-printed { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-exported { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-active { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-inactive { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Buttons ────────────────────────────── */
.btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 7px 16px;
    transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }

.btn-outline-primary { border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

.btn-soft-primary { background: var(--accent-light); color: var(--accent); border: none; }
.btn-soft-primary:hover { background: var(--accent); color: white; }

.btn-soft-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: none; }
.btn-soft-danger:hover { background: var(--danger); color: white; }

.btn-soft-success { background: rgba(16,185,129,0.1); color: var(--success); border: none; }
.btn-soft-success:hover { background: var(--success); color: white; }

.btn-soft-warning { background: rgba(245,158,11,0.1); color: var(--warning); border: none; }
.btn-soft-warning:hover { background: var(--warning); color: white; }

/* ── Forms ──────────────────────────────── */
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-control, .form-select {
    font-size: 13.5px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text-primary);
    background: white;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(181,155,72,0.12);
    outline: none;
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
textarea.form-control { resize: vertical; min-height: 80px; }

.input-group-text { background: #f8fafc; border-color: #d1d5db; font-size: 13px; color: var(--text-secondary); }

/* ── Form Card ──────────────────────────── */
.form-card { max-width: 800px; }
.form-section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }

/* ── Alerts / Notifications ─────────────── */
.alert { border-radius: var(--radius-sm); font-size: 13.5px; border: none; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--success); }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }

/* ── Action Row ─────────────────────────── */
.action-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }

/* ── Empty State ────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 48px; color: var(--text-muted); margin-bottom: 12px; opacity: 0.5; }
.empty-state h5 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ── Search/Filter Bar ──────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box .form-control { padding-left: 34px; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

/* ── Login Page ─────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #17160f 0%, #2a2518 50%, #17160f 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #b59b48, #9a8237);
    padding: 32px 32px 24px;
    text-align: center;
    color: white;
}

.login-logo {
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px;
    margin-bottom: 14px;
    backdrop-filter: blur(10px);
}

.login-header h3 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-header p { font-size: 13px; opacity: 0.8; margin: 0; }

.login-body { padding: 28px 32px 32px; }

/* ── Toastr overrides ───────────────────── */
#toast-container > div {
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    opacity: 0.97 !important;
    font-size: 13.5px !important;
}

/* ── DataTables overrides ───────────────── */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 13px;
    margin-left: 6px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 13px;
    margin: 0 6px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    font-size: 12px !important;
    padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

/* ── Misc Utilities ─────────────────────── */
.text-accent { color: var(--accent); }
.bg-accent { background: var(--accent); }
.border-accent { border-color: var(--accent) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }

.rounded-pill-sm { border-radius: 20px; }

.divider { border-top: 1px solid var(--border-color); margin: 20px 0; }

.version-tag {
    display: inline-flex; align-items: center;
    background: #f1f5f9; color: var(--text-secondary);
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
    font-family: monospace;
    border: 1px solid #e2e8f0;
}

/* ── Sidebar Sign-out button ────────────── */
.sidebar-signout-btn {
    all: unset;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: #8b95a9;
    font-size: 13.5px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s;
}
.sidebar-signout-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}
.sidebar-signout-btn i { font-size: 15px; width: 18px; text-align: center; }

/* ── POA Status Badges ───────────────────── */
.badge-draft     { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.badge-onreview  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-approved  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-printed   { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-cancelled { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Timeline (POA Log) ─────────────────── */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { display: flex; gap: 16px; padding: 0 0 20px 0; position: relative; }
.timeline-dot {
    width: 30px; height: 30px; min-width: 30px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    position: relative; z-index: 1;
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--border-color);
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-action { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ── Power Checklist ────────────────────── */
.power-check-group { display: flex; flex-direction: column; gap: 6px; }
.power-check-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.12s;
    background: white;
}
.power-check-item:hover { border-color: var(--accent); background: var(--accent-light); }
.power-check-item.checked { border-color: var(--accent); background: rgba(181,155,72,0.06); }
.power-check-item input[type=checkbox] { margin-top: 1px; accent-color: var(--accent); width: 16px; height: 16px; }
.power-check-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }

/* ── Language Switcher ──────────────────── */
.lang-btn { font-size: 12px; padding: 4px 10px; border-radius: 6px; }

/* ── Detail Page ────────────────────────── */
.detail-field { margin-bottom: 12px; }
.detail-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.detail-value { font-size: 13.5px; color: var(--text-primary); }

/* ── Expiry indicator ───────────────────── */
.expiry-warn { color: var(--warning); font-weight: 600; }
.expiry-danger { color: var(--danger); font-weight: 600; }
.expiry-ok { color: var(--success); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .page-content { padding: 16px; }
}
