/* ============================================================
   LN Service – Main Styles v4
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #09090b;
    --bg2:        #111113;
    --bg3:        #18181c;
    --bg4:        #1e1e24;
    --border:     #27272f;
    --border2:    #35353f;
    --text:       #ebebf0;
    --text-muted: #68687a;
    --text-dim:   #44444f;
    --accent:     #5865f2;
    --accent-h:   #4752c4;
    --accent-glow:rgba(88,101,242,.2);
    --cyan:       #38bdf8;
    --green:      #34d399;
    --yellow:     #fbbf24;
    --red:        #f87171;
    --radius:     10px;
    --radius-lg:  14px;
    --font-head:  'Rajdhani', sans-serif;
    --font-body:  'Inter', sans-serif;
}

html { height: 100%; }
body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* ── Announcement ─────────────────────────────────────────── */
.announcement-bar {
    background: #0e0e24;
    border-bottom: 1px solid #23234a;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .81rem;
    color: #7878c0;
    flex-shrink: 0;
}
.ann-close {
    margin-left: auto; background: none; border: none;
    color: #4444a0; cursor: pointer; font-size: .85rem; line-height: 1;
    transition: color .2s;
}
.ann-close:hover { color: #8888dd; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
    height: 54px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.logo-link    { display: flex; align-items: center; gap: 8px; }
.logo-text    { display: flex; flex-direction: column; line-height: 1.15; }
.logo-papa    { font-family: var(--font-head); font-size: .95rem; font-weight: 700; color: var(--cyan); letter-spacing: 3px; }
.logo-mod     { font-family: var(--font-head); font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: 2px; }
.logo-bolt    { color: var(--cyan); }
.topbar-subtitle { color: var(--text-dim); font-size: .72rem; border-left: 1px solid var(--border); padding-left: 12px; }
.topbar-right { display: flex; align-items: center; gap: 5px; }

.nav-icon-btn {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: .8rem;
    transition: border-color .15s, color .15s, background .15s;
}
.nav-icon-btn:hover { border-color: var(--border2); color: var(--text); background: var(--bg3); }

.nav-user {
    display: flex; align-items: center; gap: 7px;
    padding: 0 10px; border-left: 1px solid var(--border); margin-left: 3px;
}
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border2); }
.nav-username { font-weight: 600; font-size: .83rem; }

.btn-logout {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 4px 11px; border-radius: 6px; font-size: .78rem; cursor: pointer;
    white-space: nowrap; transition: all .15s; text-decoration: none; display: inline-flex; align-items: center;
}
.btn-logout:hover { border-color: var(--border2); color: var(--text); }

/* ── Page layout ──────────────────────────────────────────── */
.page-wrap { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* ── Sidebar (dashboard) ──────────────────────────────────── */
.sidebar {
    width: 252px; min-width: 252px;
    background: var(--bg2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 14px 10px; gap: 7px;
    overflow-y: auto;
}
.sidebar-section-title {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1.2px; color: var(--text-dim); padding: 2px 5px;
}
.btn-new-ticket {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--accent); color: #fff; border: none; border-radius: 7px;
    padding: 8px 14px; font-size: .83rem; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-new-ticket:hover { background: var(--accent-h); transform: translateY(-1px); }
.sidebar-empty {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 28px 10px; color: var(--text-dim); font-size: .8rem; text-align: center;
}
.sidebar-empty .icon { font-size: 1.8rem; opacity: .3; }
.ticket-item {
    background: transparent; border: 1px solid var(--border); border-radius: 7px;
    padding: 9px 11px; cursor: pointer; transition: border-color .15s, background .15s;
    text-decoration: none; display: block;
}
.ticket-item:hover  { border-color: var(--border2); background: var(--bg3); }
.ticket-item.active { background: #111130; }
.ticket-item-num   { font-size: .67rem; color: var(--text-dim); font-family: monospace; margin-bottom: 2px; }
.ticket-item-title { font-size: .83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-item-meta  { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: .7rem; }

/* ── Main area ────────────────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Welcome state ────────────────────────────────────────── */
.welcome-state {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 13px; color: var(--text-muted); text-align: center; padding: 40px;
}
.welcome-state .big-icon { font-size: 3rem; opacity: .18; }
.welcome-state h2 { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--text); }

/* ── Ticket detail header ─────────────────────────────────── */
.ticket-detail-header {
    padding: 14px 22px; border-bottom: 1px solid var(--border);
    background: var(--bg2); flex-shrink: 0;
}
.ticket-detail-header h2 { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; }
.ticket-detail-meta {
    display: flex; gap: 10px; margin-top: 5px; font-size: .74rem;
    color: var(--text-muted); flex-wrap: wrap; align-items: center;
}

/* ── Messages ─────────────────────────────────────────────── */
.messages-area {
    flex: 1; overflow-y: auto; padding: 18px 22px;
    display: flex; flex-direction: column; gap: 13px; min-height: 0;
}
.message-bubble { display: flex; gap: 9px; max-width: 80%; }
.message-bubble.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; margin-top: 2px; }
.msg-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.msg-author { font-size: .7rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.msg-text {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 12px; font-size: .84rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.message-bubble.mine  .msg-text { background: #111130; border-color: #252558; }
.message-bubble.staff .msg-text { background: #0c1f14; border-color: #183028; }
.msg-time { font-size: .68rem; color: var(--text-dim); }
.message-bubble.mine .msg-time { text-align: right; }

/* ── Input area ───────────────────────────────────────────── */
.msg-input-wrap {
    flex-shrink: 0; background: var(--bg2); border-top: 1px solid var(--border);
}
.file-preview-strip {
    display: none; flex-wrap: wrap; gap: 6px; padding: 9px 18px 0;
}
.file-preview-strip.has-files { display: flex; }
.file-chip {
    display: flex; align-items: center; gap: 5px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px 3px 8px;
    font-size: .72rem; color: var(--text-muted); max-width: 180px;
}
.file-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip-rm {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-size: .78rem; padding: 0; line-height: 1; flex-shrink: 0; transition: color .15s;
}
.file-chip-rm:hover { color: var(--red); }
.msg-input-row {
    display: flex; align-items: flex-end; gap: 7px; padding: 11px 18px 13px;
}
.msg-input-row textarea {
    flex: 1; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-family: var(--font-body); font-size: .84rem;
    padding: 8px 11px; resize: none; outline: none; height: 66px;
    transition: border-color .15s; line-height: 1.5;
}
.msg-input-row textarea:focus { border-color: var(--accent); }
.btn-upload {
    background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: 7px; width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all .15s;
}
.btn-upload:hover    { border-color: var(--accent); color: var(--text); }
.btn-upload.has-file { border-color: var(--green); color: var(--green); background: #0a1f12; }
.btn-send {
    background: var(--accent); color: #fff; border: none; border-radius: 7px;
    padding: 8px 16px; font-weight: 600; font-size: .83rem; cursor: pointer;
    white-space: nowrap; align-self: flex-end; transition: background .15s;
    height: 36px;
}
.btn-send:hover { background: var(--accent-h); }
.btn-send.staff { background: var(--cyan); color: #000; }
.btn-send.staff:hover { background: #29a9e0; }

/* ── Attachments ──────────────────────────────────────────── */
.attach-wrap { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; max-width: 260px; }
.attach-img-link { display: block; border-radius: 7px; overflow: hidden; border: 1px solid var(--border); cursor: zoom-in; }
.attach-img { display: block; max-width: 100%; max-height: 240px; object-fit: contain; background: var(--bg); transition: opacity .15s; }
.attach-img:hover { opacity: .88; }
.attach-meta { font-size: .68rem; color: var(--text-dim); }
.attach-file { margin-top: 5px; max-width: 240px; }
.attach-file-link {
    display: flex; align-items: center; gap: 8px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px;
    text-decoration: none; color: var(--text); transition: border-color .15s;
}
.attach-file-link:hover { border-color: var(--accent); }
.attach-icon { font-size: 1.3rem; flex-shrink: 0; }
.attach-file-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.attach-name { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { font-size: .68rem; color: var(--text-dim); }
.attach-dl { color: var(--text-muted); font-size: .85rem; flex-shrink: 0; }

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,.93); z-index: 9999;
    display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 7px; object-fit: contain; }

/* ── Login ────────────────────────────────────────────────── */
.login-page {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 35%, #0c0c22 0%, #09090b 65%);
}
.login-card {
    background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg);
    padding: 40px 32px; text-align: center; width: 100%; max-width: 390px;
    box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; gap: 1px; }
.login-logo .logo-papa { font-size: 1.7rem; }
.login-logo .logo-mod  { font-size: 1.7rem; }
.login-card h1 { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; margin-bottom: 9px; letter-spacing: .5px; }
.login-card p  { color: var(--text-muted); font-size: .83rem; line-height: 1.6; margin-bottom: 22px; }
.btn-discord {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    padding: 12px 24px; font-size: .92rem; font-weight: 600; cursor: pointer;
    text-decoration: none; width: 100%; transition: background .15s, transform .1s;
    box-shadow: 0 3px 14px var(--accent-glow);
}
.btn-discord:hover { background: var(--accent-h); transform: translateY(-1px); }
.discord-icon { width: 19px; height: 19px; }

/* ── Footer ───────────────────────────────────────────────── */
footer {
    padding: 11px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
    display: flex; gap: 16px; align-items: center; justify-content: center;
    font-size: .73rem; color: var(--text-dim);
}
footer a:hover { color: var(--text-muted); }
.footer-copy { opacity: .4; margin-left: 8px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg);
    width: 90%; max-width: 530px; max-height: 90vh; overflow-y: auto; padding: 22px;
    transform: scale(.96) translateY(6px); transition: transform .18s;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h2 { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.modal-close {
    background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: .85rem;
    display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

/* ── Category grid ────────────────────────────────────────── */
.category-label { font-size: .7rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 11px; }
.category-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cat-card {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
    padding: 13px; cursor: pointer; text-align: center;
    transition: border-color .15s, background .12s, transform .12s;
}
.cat-card:hover { transform: translateY(-2px); background: var(--bg4); }
.cat-card .cat-icon { font-size: 1.6rem; margin-bottom: 6px; }
.cat-card .cat-name { font-weight: 700; font-size: .82rem; margin-bottom: 3px; }
.cat-card .cat-desc { font-size: .72rem; color: var(--text-muted); line-height: 1.35; }
.cat-card.disabled  { opacity: .4; cursor: not-allowed; }
.cat-card.disabled:hover { transform: none; }

/* ── Forms ────────────────────────────────────────────────── */
.ticket-form { display: flex; flex-direction: column; gap: 13px; }
.form-group  { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 7px;
    color: var(--text); font-family: var(--font-body); font-size: .84rem;
    padding: 8px 11px; outline: none; transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 88px; }
.form-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 4px; }
.btn-back {
    background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: .82rem; transition: all .15s;
}
.btn-back:hover { border-color: var(--border2); color: var(--text); }
.btn-submit {
    background: var(--accent); color: #fff; border: none; border-radius: 6px;
    padding: 7px 18px; font-weight: 600; font-size: .82rem; cursor: pointer; transition: background .15s;
}
.btn-submit:hover { background: var(--accent-h); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { border-radius: 7px; padding: 9px 13px; font-size: .82rem; margin-bottom: 14px; }
.alert-error   { background: #1f0a0a; border: 1px solid #4a1515; color: var(--red); }
.alert-success { background: #0a1f10; border: 1px solid #154a25; color: var(--green); }

/* ── Status badge ─────────────────────────────────────────── */
.s-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 20px; font-size: .7rem; font-weight: 600; white-space: nowrap;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */

/* ── Hamburger Menu ───────────────────────────────────────── */
.hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    width: 34px; height: 34px;
    cursor: pointer;
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Sidebar mobile overlay ───────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 49;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
    /* Topbar */
    .topbar { padding: 0 14px; gap: 6px; }
    .topbar-subtitle { display: none; }
    .nav-username { display: none; }
    .hamburger { display: flex; }

    /* Nav collapse */
    .topbar-right { gap: 5px; }
    .nav-icon-btn { width: 30px; height: 30px; font-size: .8rem; }
    .btn-logout { padding: 4px 9px; font-size: .75rem; }
    .nav-user { padding: 0 6px; border-left: none; }

    /* Page wrap — stack vertically */
    .page-wrap {
        flex-direction: column;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    /* Sidebar — slide in from left on mobile */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 280px !important;
        min-width: 280px !important;
        height: 100vh !important;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .25s ease;
        border-right: 1px solid var(--border2);
        box-shadow: 4px 0 24px rgba(0,0,0,.5);
        padding-top: 20px;
    }
    .sidebar.open { transform: translateX(0); }

    /* Main fills screen */
    .ticket-detail,
    main {
        height: calc(100vh - 56px);
        min-height: 0;
    }

    /* Messages area */
    .messages-area {
        padding: 14px 14px;
        gap: 12px;
    }

    /* Message bubbles full width on mobile */
    .message-bubble { max-width: 92%; }

    /* Input area */
    .msg-input-area { padding: 10px 14px 12px; gap: 7px; }
    .msg-input-area textarea { height: 56px; font-size: .82rem; }
    .btn-send { padding: 7px 13px; font-size: .8rem; }
    .btn-upload { width: 34px; height: 34px; font-size: 1rem; }

    /* Ticket detail header */
    .ticket-detail-header { padding: 12px 14px; }
    .ticket-detail-header h2 { font-size: 1rem; }
    .ticket-detail-meta { gap: 7px; font-size: .72rem; }

    /* Category grid */
    .category-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .cat-card { padding: 10px; }
    .cat-card .cat-icon { font-size: 1.4rem; margin-bottom: 5px; }

    /* Modal */
    .modal { padding: 18px; }
    .modal-header h2 { font-size: 1.1rem; }

    /* Footer */
    footer { padding: 10px 14px; gap: 12px; font-size: .72rem; }
    footer .footer-copy { display: none; }
}

@media (max-width: 480px) {
    .category-grid { grid-template-columns: 1fr; }
    .cat-card .cat-desc { display: none; }
    .message-bubble { max-width: 98%; }
    .btn-new-ticket { font-size: .8rem; padding: 8px 12px; }
}

/* ── Admin Mobile ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
    .admin-header-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .search-input { width: 100%; }
    .search-form { flex-wrap: wrap; width: 100%; }
}

@media (max-width: 768px) {
    .admin-wrap { flex-direction: column; min-height: 0; overflow: visible; }

    .admin-sidebar {
        width: 100% !important;
        min-width: unset !important;
        height: auto !important;
        position: static !important;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 6px;
        overflow: visible;
    }
    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 0;
        gap: 4px;
    }
    .admin-nav-item { padding: 5px 10px; font-size: .78rem; }
    .admin-sidebar-stats { display: none; }

    .admin-main { padding: 14px; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }

    .ticket-table th:nth-child(3),
    .ticket-table td:nth-child(3),
    .ticket-table th:nth-child(6),
    .ticket-table td:nth-child(6) { display: none; }

    /* Ticket detail on mobile */
    .admin-wrap[data-page="ticket"] { flex-direction: column; }
    aside.admin-sidebar[style*="sticky"] {
        position: static !important;
        width: 100% !important;
        max-height: none !important;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .ticket-info-panel { flex-direction: row; flex-wrap: wrap; gap: 0; }
    .tip-section { width: 50%; border-bottom: 1px solid var(--border); padding: 8px; }

    .messages-area { min-height: 300px; max-height: 50vh !important; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .sc-num { font-size: 1.4rem; }
    .ticket-table th:nth-child(4),
    .ticket-table td:nth-child(4),
    .ticket-table th:nth-child(7),
    .ticket-table td:nth-child(7) { display: none; }
    .tip-section { width: 100%; }
}
