/* ==========================================================================
   Servis Portalı - Kurumsal tema (Bootstrap 5.3 üzerine)
   ========================================================================== */
:root {
    --brand-900: #0b1f3a;
    --brand-800: #0f2a4a;
    --brand-700: #163a63;
    --brand-600: #1d4e89;
    --brand-500: #2a64ad;
    --accent: #f28c28;
    --surface: #f4f6fa;
    --border: #e3e8ef;
    --sidebar-w: 260px;
    --bs-primary: #1d4e89;
    --bs-primary-rgb: 29, 78, 137;
    --bs-link-color: #1d4e89;
    --bs-link-color-rgb: 29, 78, 137;
    --bs-link-hover-color: #163a63;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .925rem;
}

body { background: var(--surface); color: #1f2937; }

.btn-primary {
    --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-800); --bs-btn-active-border-color: var(--brand-800);
    --bs-btn-disabled-bg: var(--brand-500); --bs-btn-disabled-border-color: var(--brand-500);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
}
.text-bg-primary { background-color: var(--brand-600) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(29, 78, 137, .15);
}
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-label { font-weight: 600; font-size: .82rem; color: #374151; margin-bottom: .3rem; }

/* ---------- Uygulama iskeleti ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 1.5rem; }
.app-footer { padding: 1rem 1.5rem; color: #9ca3af; font-size: .8rem; border-top: 1px solid var(--border); background: #fff; }

/* ---------- Kenar menüsü ---------- */
.sidebar {
    background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-800) 100%);
    color: #cbd5e1;
    width: var(--sidebar-w);
    --bs-offcanvas-width: var(--sidebar-w);
    --bs-offcanvas-bg: var(--brand-900);
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; }
}
.sidebar.offcanvas-lg { display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; padding: 1.15rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand a { color: #fff; }
.brand-icon {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-size: 1.15rem; flex-shrink: 0;
}
.brand-icon-lg { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 12px; }
.brand-text { margin-left: .7rem; font-weight: 600; font-size: 1.02rem; line-height: 1.2; }
.sidebar-nav { padding: .75rem .75rem; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-section {
    text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #7b8ba3; padding: 1.1rem .75rem .4rem; font-weight: 600;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .75rem; color: #cbd5e1; padding: .6rem .75rem; border-radius: 8px; margin-bottom: 2px;
    font-weight: 500; transition: background-color .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .85; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand-600); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-footer { padding: 1rem 1.25rem; font-size: .8rem; color: #94a3b8; border-top: 1px solid rgba(255, 255, 255, .08); }

/* ---------- Üst bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; min-height: 64px; padding: .5rem 1.5rem;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; color: var(--brand-800); }
.btn-user { display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; padding: .25rem .5rem; }
.btn-user:hover { background: var(--surface); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--brand-600); color: #fff; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}

/* ---------- Kartlar ---------- */
.card { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 42, 74, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); padding: .9rem 1.25rem; font-weight: 600; color: var(--brand-800); }
.card-header:first-child { border-radius: 12px 12px 0 0; }
.card-body { padding: 1.25rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.section-title { font-size: .95rem; font-weight: 600; color: var(--brand-800); margin-bottom: .75rem; }

/* Sayı kartları */
.stat-card { padding: 1.1rem 1.25rem; height: 100%; }
.stat-card .stat-label { font-size: .78rem; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--brand-800); line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: .8rem; color: #9ca3af; }
.stat-card .stat-icon {
    width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(29, 78, 137, .08); color: var(--brand-600); font-size: 1.2rem;
}
.tip-card { border-left: 4px solid var(--bs-secondary); }
.tip-card.tip-success { border-left-color: var(--bs-success); }
.tip-card.tip-danger { border-left-color: var(--bs-danger); }
.tip-card.tip-warning { border-left-color: var(--bs-warning); }
.tip-card.tip-info { border-left-color: var(--bs-info); }
.tip-card.tip-primary { border-left-color: var(--brand-600); }
.tip-card.tip-dark { border-left-color: var(--bs-dark); }

/* ---------- Tablolar ---------- */
.table-modern { margin-bottom: 0; }
.table-modern > thead th {
    background: #f8fafc; color: #475569; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
    border-bottom: 1px solid var(--border); white-space: nowrap; padding: .7rem .75rem; position: sticky; top: 0;
}
.table-modern > tbody td { padding: .7rem .75rem; vertical-align: top; border-color: #eef1f5; }
.table-modern > tbody tr:hover > * { background-color: #f8fbff; }
.col-tespit { min-width: 380px; width: 40%; white-space: pre-line; line-height: 1.45; }
.col-nowrap { white-space: nowrap; }
.seri-link { font-family: Consolas, "Courier New", monospace; font-weight: 600; text-decoration: none; }
.seri-link:hover { text-decoration: underline; }
.tip-rozet { font-weight: 600; font-size: .72rem; padding: .35em .7em; }
.text-bg-warning.tip-rozet { color: #5c3d00 !important; }

/* Mobilde tablo satırlarını karta dönüştür */
@media (max-width: 767.98px) {
    .content { padding: 1rem .75rem; }
    .topbar { padding: .5rem .75rem; }
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { background: #fff; border: 1px solid var(--border); border-radius: 10px; margin: 0 0 .75rem; padding: .5rem .25rem; }
    .table-cards > tbody td { border: 0; padding: .3rem .75rem; display: flex; gap: .75rem; }
    .table-cards > tbody td::before { content: attr(data-label); flex: 0 0 38%; font-weight: 600; color: #6b7280; font-size: .78rem; }
    .table-cards > tbody td.col-tespit { min-width: 0; display: block; }
    .table-cards > tbody td.col-tespit::before { display: block; margin-bottom: .2rem; }
    .table-cards > tbody td[data-label=""]::before { display: none; }
}

/* Filtre paneli */
.filter-card .form-control, .filter-card .form-select { font-size: .875rem; }
.tip-secim { display: flex; flex-wrap: wrap; gap: .4rem; }
.tip-secim input[type=checkbox] { display: none; }
.tip-secim label {
    border: 1px solid var(--border); border-radius: 50rem; padding: .3rem .85rem; cursor: pointer; font-size: .82rem; background: #fff;
    user-select: none; transition: all .15s;
}
.tip-secim input[type=checkbox]:checked + label { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.tip-secim span { display: inline-block; }

/* Sayfalama */
.pagination { --bs-pagination-active-bg: var(--brand-600); --bs-pagination-active-border-color: var(--brand-600); --bs-pagination-color: var(--brand-600); margin: 0; }

/* Zaman çizelgesi (makine geçmişi) */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ""; position: absolute; left: .55rem; top: .25rem; bottom: .25rem; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before {
    content: ""; position: absolute; left: -1.53rem; top: .3rem; width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: 3px solid var(--brand-600);
}
.timeline-item .tl-meta { font-size: .82rem; color: #6b7280; }
.timeline-item .tl-body { white-space: pre-line; margin-top: .35rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: .65rem .85rem; }

.makine-baslik { background: linear-gradient(135deg, var(--brand-800), var(--brand-600)); color: #fff; border: 0; }
.makine-baslik .lbl { font-size: .75rem; opacity: .7; text-transform: uppercase; letter-spacing: .05em; }
.makine-baslik .val { font-size: 1.15rem; font-weight: 600; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #6b7280; }
.empty-state i { font-size: 2.5rem; color: #cbd5e1; display: block; margin-bottom: .75rem; }

/* ---------- Giriş ekranları ---------- */
.auth-body { background: #fff; }
.auth-wrapper { display: flex; min-height: 100vh; }
.auth-side {
    flex: 0 0 44%; background: linear-gradient(150deg, var(--brand-900) 0%, var(--brand-700) 60%, var(--brand-600) 100%);
    color: #fff; padding: 3.5rem; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
    border: 60px solid rgba(255, 255, 255, .04);
}
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2.25rem; box-shadow: 0 10px 30px rgba(15, 42, 74, .08); }
.auth-card .form-control { padding: .7rem .9rem; }
.kod-input { letter-spacing: .6em; font-size: 1.6rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Detay ---------- */
.detay-liste dt { font-size: .78rem; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.detay-liste dd { margin-bottom: 1rem; font-size: .95rem; }

/* ---------- Yazdırma ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .btn, .pagination, .filter-card { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
}
