/* =====================================================================
   TicketDesk ITSM — uygulama stilleri
   Bootstrap 5.3 üzerine ince bir katman
   ===================================================================== */

:root {
    --td-sidebar-width: 260px;
    --td-topbar-height: 58px;
    --td-radius: 10px;
    --td-brand: #4f46e5;
    --td-brand-dark: #4338ca;
    --td-portal: #0d9488;
    --td-surface: #f5f6fa;
    --td-border: #e5e7eb;
    --td-text-muted: #6b7280;
}

body {
    background: var(--td-surface);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #111827;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

.text-muted-sm { font-size: 12px; color: var(--td-text-muted); }

/* ---------------------------------------------------------------------
   Kenar çubuğu
   --------------------------------------------------------------------- */
.td-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--td-sidebar-width);
    background: #111827;
    color: #d1d5db;
    overflow-y: auto;
    z-index: 1040;
    transition: transform .2s ease;
}
.td-sidebar::-webkit-scrollbar { width: 6px; }
.td-sidebar::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.td-sidebar .td-brand {
    display: flex; align-items: center; gap: .6rem;
    height: var(--td-topbar-height);
    padding: 0 1.1rem;
    color: #fff; font-weight: 700; font-size: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky; top: 0; background: #111827; z-index: 2;
}
.td-sidebar .td-brand i { font-size: 20px; color: var(--td-brand); }

.td-sidebar .nav-section {
    padding: 1rem 1.1rem .35rem;
    font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: #6b7280;
}

.td-sidebar .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem 1.1rem;
    color: #d1d5db; font-size: 13.5px; border-left: 3px solid transparent;
}
.td-sidebar .nav-link i { width: 18px; font-size: 15px; text-align: center; }
.td-sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.td-sidebar .nav-link.active {
    background: rgba(79,70,229,.16); color: #fff;
    border-left-color: var(--td-brand); font-weight: 600;
}
.td-sidebar .nav-link .badge { margin-left: auto; font-size: 10px; }

.td-portal-theme .td-sidebar .td-brand i,
.td-portal-theme .td-sidebar .nav-link.active { color: #5eead4; }
.td-portal-theme .td-sidebar .nav-link.active {
    background: rgba(13,148,136,.2); border-left-color: var(--td-portal);
}

/* ---------------------------------------------------------------------
   Üst çubuk ve içerik
   --------------------------------------------------------------------- */
.td-main { margin-left: var(--td-sidebar-width); min-height: 100vh; }

.td-topbar {
    height: var(--td-topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--td-border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 1030;
}

.td-content { padding: 1.25rem; }

.td-page-title { font-size: 20px; font-weight: 700; margin: 0; }

@media (max-width: 991.98px) {
    .td-sidebar { transform: translateX(-100%); }
    .td-sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .td-main { margin-left: 0; }
    .td-backdrop {
        position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035;
    }
}

/* ---------------------------------------------------------------------
   Kartlar ve tablolar
   --------------------------------------------------------------------- */
.card {
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius);
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--td-border);
    font-weight: 600;
    padding: .75rem 1rem;
    border-radius: var(--td-radius) var(--td-radius) 0 0 !important;
}

.table { font-size: 13.5px; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--td-text-muted); font-weight: 700;
    background: #fafafa; border-bottom: 1px solid var(--td-border);
    white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f8fafc; }
.table td { vertical-align: middle; }

/* İstatistik kartı */
.stat-card { display: flex; align-items: center; gap: .9rem; padding: 1rem; }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: grid; place-items: center; font-size: 20px; flex: 0 0 auto;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--td-text-muted); }

/* ---------------------------------------------------------------------
   Rozetler
   --------------------------------------------------------------------- */
.badge-soft {
    display: inline-block;
    padding: .22em .6em;
    font-size: 11.5px; font-weight: 600; line-height: 1.5;
    border-radius: 999px;
    color: var(--bg, #6c757d);
    background: color-mix(in srgb, var(--bg, #6c757d) 13%, white);
    border: 1px solid color-mix(in srgb, var(--bg, #6c757d) 26%, white);
    white-space: nowrap;
}

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }

/* ---------------------------------------------------------------------
   SLA göstergesi
   --------------------------------------------------------------------- */
.sla-bar { height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.sla-bar > span { display: block; height: 100%; border-radius: 3px; transition: width .3s; }
.sla-ok   > span { background: #10b981; }
.sla-warn > span { background: #f59e0b; }
.sla-risk > span { background: #f97316; }
.sla-breach > span { background: #ef4444; }

/* ---------------------------------------------------------------------
   Talep zaman çizelgesi
   --------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 0; list-style: none; margin: 0; }

.reply {
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius);
    margin-bottom: .85rem;
    background: #fff;
    overflow: hidden;
}
.reply-head {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .85rem;
    background: #fafafa;
    border-bottom: 1px solid var(--td-border);
    font-size: 12.5px;
}
.reply-body { padding: .85rem; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.reply-body p:last-child { margin-bottom: 0; }

.reply.internal { border-color: #fcd34d; background: #fffbeb; }
.reply.internal .reply-head { background: #fef3c7; border-bottom-color: #fcd34d; }
.reply.customer .reply-head { background: #eff6ff; border-bottom-color: #bfdbfe; }
.reply.system   { border-style: dashed; }
.reply.system .reply-head { background: #f3f4f6; }
.reply.escalation { border-color: #fca5a5; }
.reply.escalation .reply-head { background: #fee2e2; border-bottom-color: #fca5a5; }
.reply.resolution { border-color: #6ee7b7; }
.reply.resolution .reply-head { background: #d1fae5; border-bottom-color: #6ee7b7; }

/* Geçmiş listesi */
.history-item {
    display: flex; gap: .6rem; padding: .45rem 0;
    border-bottom: 1px dashed var(--td-border); font-size: 12.5px;
}
.history-item:last-child { border-bottom: none; }

/* ---------------------------------------------------------------------
   Kanban
   --------------------------------------------------------------------- */
.kanban { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kanban-col {
    flex: 0 0 285px; background: #eef0f4; border-radius: var(--td-radius);
    max-height: calc(100vh - 190px); display: flex; flex-direction: column;
}
.kanban-col-head {
    padding: .6rem .8rem; font-weight: 600; font-size: 13px;
    display: flex; align-items: center; gap: .45rem;
    border-bottom: 2px solid transparent;
}
.kanban-col-body { overflow-y: auto; padding: .55rem; display: flex; flex-direction: column; gap: .5rem; }
.kanban-card {
    background: #fff; border: 1px solid var(--td-border); border-radius: 8px;
    padding: .6rem .7rem; font-size: 12.5px; border-left: 3px solid #cbd5e1;
}
.kanban-card:hover { box-shadow: 0 3px 10px rgba(16,24,40,.09); }
.kanban-card .kc-title { font-weight: 600; color: #111827; display: block; margin-bottom: .3rem; line-height: 1.35; }

/* ---------------------------------------------------------------------
   Giriş ekranları
   --------------------------------------------------------------------- */
.auth-wrapper {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%);
}
.auth-card {
    width: 100%; max-width: 430px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 20px 55px rgba(0,0,0,.3);
    overflow: hidden;
}
.auth-card .auth-head { padding: 1.75rem 1.75rem .5rem; text-align: center; }
.auth-card .auth-body { padding: 1rem 1.75rem 1.75rem; }
.auth-logo {
    width: 54px; height: 54px; border-radius: 14px;
    background: var(--td-brand); color: #fff;
    display: grid; place-items: center; font-size: 26px; margin: 0 auto .8rem;
}
.auth-portal .auth-wrapper { background: linear-gradient(135deg, #042f2e 0%, #115e59 45%, #0d9488 100%); }
.auth-portal .auth-logo { background: var(--td-portal); }

/* Tek kullanımlık kod alanı */
.otp-input {
    letter-spacing: .7em; text-align: center;
    font-size: 24px; font-weight: 700; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    padding-left: .7em;
}

/* Şifre güç göstergesi */
.pw-meter { height: 5px; border-radius: 3px; background: #e5e7eb; overflow: hidden; margin-top: .4rem; }
.pw-meter > span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }

/* Cihaz kartı */
.device-card {
    border: 1px solid var(--td-border); border-radius: var(--td-radius);
    padding: .9rem; display: flex; gap: .85rem; align-items: flex-start; background: #fff;
}
.device-card .device-icon {
    width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    font-size: 19px; flex: 0 0 auto;
}
.device-card.current { border-color: #6ee7b7; background: #f0fdf4; }

/* ---------------------------------------------------------------------
   Yardımcılar
   --------------------------------------------------------------------- */
.form-label { font-size: 12.5px; font-weight: 600; margin-bottom: .28rem; color: #374151; }
.form-text { font-size: 11.5px; }
.form-control, .form-select { font-size: 13.5px; }
.form-control:focus, .form-select:focus {
    border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79,70,229,.13);
}
.required::after { content: " *"; color: #dc2626; }

.btn { font-size: 13.5px; }
.btn-sm { font-size: 12.5px; }
.btn-brand { background: var(--td-brand); border-color: var(--td-brand); color: #fff; }
.btn-brand:hover { background: var(--td-brand-dark); border-color: var(--td-brand-dark); color: #fff; }

.filter-bar {
    background: #fff; border: 1px solid var(--td-border);
    border-radius: var(--td-radius); padding: .75rem; margin-bottom: 1rem;
}

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--td-text-muted); }
.empty-state i { font-size: 40px; opacity: .35; display: block; margin-bottom: .6rem; }

.search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--td-border); border-radius: 8px;
    box-shadow: 0 10px 30px rgba(16,24,40,.14); z-index: 1050;
    max-height: 380px; overflow-y: auto;
}
.search-results a {
    display: block; padding: .5rem .75rem; border-bottom: 1px solid #f3f4f6; color: #111827; font-size: 13px;
}
.search-results a:hover { background: #f8fafc; }
.search-results a:last-child { border-bottom: none; }

.notif-item { display: flex; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.notif-item.unread { background: #eef2ff; }

.sticky-side { position: sticky; top: calc(var(--td-topbar-height) + 1rem); }

.rating-star { font-size: 26px; color: #d1d5db; cursor: pointer; transition: color .15s, transform .1s; }
.rating-star:hover, .rating-star.on { color: #f59e0b; }
.rating-star:hover { transform: scale(1.12); }

@media print {
    .td-sidebar, .td-topbar, .no-print { display: none !important; }
    .td-main { margin-left: 0; }
    .card { box-shadow: none; }
}
