/* ═══════════════════════════════════════════════
   SUPPORT CENTER - Modern CSS
═══════════════════════════════════════════════ */

:root {
    --primary: #C0392B;
    --primary-dark: #96281B;
    --primary-light: #fdf1ef;
    --secondary: #E67E22;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    
    --bg: #f7f4f0;
    --surface: #ffffff;
    --surface-2: #faf7f4;
    --border: #ede8e1;
    --border-dark: #d9d2c9;
    
    --text: #1a1410;
    --text-soft: #3d3530;
    --text-muted: #7a706a;
    --text-faint: #b8afa9;
    
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl: 24px;
    
    --sh-sm: 0 2px 8px rgba(26,20,16,.08);
    --sh-md: 0 4px 16px rgba(26,20,16,.10);
    --sh-lg: 0 8px 32px rgba(26,20,16,.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════
   NAVIGATION
═══════════════════════════════════════════════ */
.sg-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--sh-sm);
}

.sg-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.sg-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-brand .chili {
    font-size: 1.5rem;
    animation: sway 3s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.sg-nav-spacer { flex: 1; }

.sg-nav-actions {
    display: flex;
    gap: 10px;
}

.sg-nav-pill {
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-soft);
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sg-nav-pill:hover {
    background: var(--border);
    color: var(--text);
}

.sg-nav-pill.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.sg-nav-pill.primary:hover {
    background: var(--primary-dark);
}

.sg-nav-pill.danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* ═══════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════ */
.sg-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .sg-page {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */
.sg-sidebar {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 84px;
    box-shadow: var(--sh-sm);
}

@media (max-width: 992px) {
    .sg-sidebar {
        position: static;
    }
}

.sl-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.sl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--r-lg);
    text-decoration: none;
    color: var(--text-soft);
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sl-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sl-item.active {
    background: var(--primary);
    color: #fff;
}

.sl-item i {
    width: 20px;
    font-size: 0.9rem;
}

.sl-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ═══════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════ */
main {
    min-width: 0;
}

/* ═══════════════════════════════════════════════
   STATS CARDS
═══════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 20px;
    text-align: center;
    box-shadow: var(--sh-sm);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2rem;
    color: var(--primary);
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════
   FILTER & SEARCH
═══════════════════════════════════════════════ */
.filter-bar {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--sh-sm);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-soft);
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.filter-tab:hover {
    background: var(--border);
}

.filter-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.search-box {
    position: relative;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   TICKET LIST
═══════════════════════════════════════════════ */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 20px;
    box-shadow: var(--sh-sm);
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
    gap: 12px;
}

.ticket-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.ticket-subject {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.ticket-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.ticket-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ticket-last-message {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--r-md);
    font-size: 0.85rem;
    color: var(--text-soft);
    line-height: 1.5;
}

.ticket-unread-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    margin-left: 8px;
}

/* ═══════════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════════ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-open {
    background: rgba(52, 152, 219, 0.15);
    color: #3498DB;
}

.status-waiting {
    background: rgba(243, 156, 18, 0.15);
    color: #F39C12;
}

.status-answered {
    background: rgba(39, 174, 96, 0.15);
    color: #27AE60;
}

.status-closed {
    background: rgba(149, 165, 166, 0.15);
    color: #95A5A6;
}

/* ═══════════════════════════════════════════════
   TICKET DETAIL (Chat-like)
═══════════════════════════════════════════════ */
.ticket-detail-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 24px;
    box-shadow: var(--sh-sm);
    margin-bottom: 20px;
}

.ticket-info-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.ticket-info-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.ticket-info-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.chat-message.customer {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-message.admin .chat-avatar {
    background: var(--info);
}

.chat-bubble {
    background: var(--surface-2);
    border-radius: var(--r-xl);
    padding: 16px;
    position: relative;
}

.chat-message.customer .chat-bubble {
    background: var(--primary);
    color: #fff;
}

.chat-sender {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: 0.8;
}

.chat-text {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.chat-time {
    font-size: 0.7rem;
    margin-top: 8px;
    opacity: 0.6;
}

.chat-attachment {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--r-md);
}

.chat-attachment a {
    color: inherit;
    text-decoration: underline;
}

/* Reply Form */
.reply-form {
    background: var(--surface-2);
    border-radius: var(--r-xl);
    padding: 20px;
}

.reply-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 12px;
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.reply-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-2);
}

/* ═══════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════ */
.form-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 32px;
    box-shadow: var(--sh-sm);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    font-size: 0.9rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* ═══════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-sm);
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
.sg-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sg-nav-actions .lbl {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-message {
        max-width: 90%;
    }
}