/* =============================================
   TTS — Expanscience Laboratuvarları
   Bootstrap 5 override & brand styles
   ============================================= */

/* Fonts */
@font-face {
    font-family: 'Recoleta';
    font-style: normal;
    font-weight: 400;
    src: url("../fonts/recoleta/recoleta-medium.woff") format("woff"),url("../fonts/recoleta/recoleta-medium.ttf") format("truetype")
}

@font-face {
    font-family: 'Recoleta';
    font-style: normal;
    font-weight: 300;
    src: url("../fonts/recoleta/recoleta-regular.woff") format("woff"),url("../fonts/recoleta/recoleta-regular.ttf") format("truetype")
}

/* CSS Variables */
:root {
    --brand-primary:     #1c5f86;
    --brand-primary-rgb: 30, 58, 95;
    --brand-accent:      #c8a96e;
    --sidebar-width:     260px;
    --topbar-height:     60px;
}

/* Base */
body {
    font-family: 'Work Sans', system-ui, sans-serif;
    background-color: #f0f2f5;
    -webkit-font-smoothing: antialiased;
    color: var(--brand-primary);
}

h1, h2, h3, h4, h5,
.recoleta { font-family: 'Recoleta', Georgia, sans-serif; }

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--brand-primary);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform .25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: 60px;
    background-color: #ffffff;
    text-align: center;
}
.sidebar-brand img  { height: 34px; object-fit: contain; }
.sidebar-brand-text { color: #fff; font-family: 'Recoleta', serif; font-size: 15px; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-label {
    padding: 14px 18px 4px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: rgba(255,255,255,.65);
    font-size: 13.5px;
    text-decoration: none;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.sidebar-link:hover  { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-link.active { color: #fff; background: rgba(200,169,110,.15); border-left-color: var(--brand-accent); }
.sidebar-link i      { font-size: 16px; flex-shrink: 0; width: 18px; text-align: center; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: background .15s;
    min-width: 0;
}
.sidebar-user:hover { background: rgba(255,255,255,.08); }
.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--brand-accent);
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-username { font-size: 13px; font-weight: 500; color: #fff; line-height: 1.2; }
.sidebar-userrole { font-size: 11px; color: rgba(255,255,255,.4); }
.sidebar-logout {
    color: rgba(255,255,255,.4);
    font-size: 18px;
    padding: 7px;
    border-radius: 6px;
    text-decoration: none;
    transition: all .15s;
}
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,.1); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1029;
}

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

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1020;
}
.topbar-title {
    font-family: 'Recoleta', serif;
    font-size: 19px;
    font-weight: 500;
    color: var(--brand-primary);
    margin: 0;
}
.topbar-menu-btn { display: none; }

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

/* ── Cards ── */
.card { border: 1px solid #e3e6ea; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-header { background: #fff; border-bottom: 1px solid #e3e6ea; border-radius: 12px 12px 0 0 !important; padding: 14px 20px; }
.card-header .card-title { font-family: 'Recoleta', serif; font-size: 16px; font-weight: 500; margin: 0; }

/* ── Stat cards ── */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    border: 1px solid #e3e6ea;
    background: #fff;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: #6b7280; margin-top: 2px; }

/* ── Buttons ── */
.btn-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}
.btn-primary:hover {
    background-color: #2d5a9e !important;
    border-color: #2d5a9e !important;
}

/* ── Ticket number ── */
.ticket-no {
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
    background: #f0f2f5;
    border: 1px solid #dde1e7;
    padding: 2px 7px;
    border-radius: 4px;
    color: #4b5563;
    white-space: nowrap;
}

/* ── Conversation (support style) ── */
.conversation { max-height: 500px; overflow-y: auto; scroll-behavior: smooth; }
.msg-wrap { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.msg-wrap.mine { flex-direction: row-reverse; }
.msg-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.msg-avatar.mine { background: var(--brand-accent); color: var(--brand-primary); }
.msg-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
}
.msg-bubble.theirs { background: #f0f2f5; border-radius: 4px 14px 14px 14px; color: #1a2332; }
.msg-bubble.mine   { background: var(--brand-primary); color: #fff; border-radius: 14px 4px 14px 14px; }
.msg-bubble.internal { background: #fef9ec; border: 1px dashed #f59e0b; border-radius: 4px 14px 14px 14px; color: #92400e; }
.msg-meta { font-size: 11px; color: #9ca3af; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.msg-meta .sender { font-weight: 600; color: #6b7280; }
.msg-bubble.mine + .msg-meta { text-align: right; justify-content: flex-end; }
.internal-tag { font-size: 10px; padding: 1px 6px; background: #f59e0b; color: #fff; border-radius: 10px; font-weight: 600; }

/* ── File drop zone ── */
.file-drop {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    position: relative;
}
.file-drop:hover, .file-drop.dragover { border-color: var(--brand-primary); background: rgba(30,58,95,.04); }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: #f0f2f5;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
    padding: 4px 10px;
}

/* ── Sidebar note ── */
.note-item { background: #f8f9fa; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.note-item .note-time { font-size: 11px; color: #9ca3af; }

/* ── Category cascade ── */
.category-cascade { display: flex; flex-direction: column; gap: 8px; }

/* ── History timeline ── */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content:''; position:absolute; left:5px; top:4px; bottom:4px; width:2px; background:#e3e6ea; }
.timeline-item { position: relative; margin-bottom: 12px; font-size: 12.5px; }
.timeline-item::before { content:''; position:absolute; left:-18px; top:4px; width:8px; height:8px; border-radius:50%; background: var(--brand-primary); }
.timeline-user { font-weight: 600; }
.timeline-time { color: #9ca3af; font-size: 11px; }

/* ── Permission grid ── */
.permission-check { padding: 8px 12px; border: 1px solid #e3e6ea; border-radius: 8px; background: #f8f9fa; transition: all .15s; cursor: pointer; }
.permission-check:hover { border-color: var(--brand-primary); background: rgba(30,58,95,.04); }
.permission-check input:checked ~ span { color: var(--brand-primary); font-weight: 500; }

/* ── Auth page ── */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(145deg, #12243a 0%, #1e3a5f 55%, #2d5a9e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card-wrap { width: 100%; max-width: 440px; }
.auth-logo-area { text-align: center; margin-bottom: 28px; }
.auth-logo-area img { height: 48px; filter: brightness(0) invert(1); object-fit: contain; }
.auth-logo-area .brand-name { color: #fff; font-family: 'Recoleta', serif; font-size: 22px; }
.auth-card { background: #fff; border-radius: 16px; padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-260px); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrapper { margin-left: 0; }
    .topbar-menu-btn { display: flex !important; }
    .page-content { padding: 16px; }
}
@media (max-width: 575.98px) {
    .auth-card { padding: 24px; }
    .msg-bubble { max-width: 88%; }
}
