/* ArmoredGate Support — Dark Theme */
:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #1a1a25;
    --border: #1e1e2e;
    --border-light: #2a2a3a;
    --text: #e0e0e8;
    --text-dim: #7a7a8e;
    --accent: #39ff14;
    --accent-dim: #39ff1440;
    --blue: #4da6ff;
    --yellow: #ffd700;
    --orange: #ff8c00;
    --red: #ff3333;
    --green: #39ff14;
    --radius: 8px;
    --radius-lg: 12px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { font-size: 15px; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.mono { font-family: 'JetBrains Mono', monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.logo:hover { text-decoration: none; }
.logo-icon { font-size: 1.4rem; }
.logo-text { color: var(--accent); }
.logo-sub { color: var(--text-dim); font-weight: 400; }

.nav { display: flex; gap: 0.25rem; }

.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-hover);
    text-decoration: none;
}

.nav-link-dim { opacity: 0.6; }

/* Main */
.main {
    flex: 1;
    padding: 2rem 1.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container.narrow {
    max-width: 640px;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.footer-link { color: var(--text-dim); }
.footer-link:hover { color: var(--accent); }

/* Typography */
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }

.back-link {
    display: inline-block;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.back-link:hover { color: var(--accent); }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.card-body {
    padding: 1.25rem;
}

.description {
    white-space: pre-wrap;
    line-height: 1.7;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    background: var(--surface);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.clickable-row { cursor: pointer; transition: background 0.1s; }
.clickable-row:hover { background: var(--surface-hover); }

.subject-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}

.badge-internal {
    background: #ff880020;
    color: var(--orange);
    border: 1px solid #ff880040;
}

/* Chips */
.quick-filters { margin-top: 2rem; }
.quick-filters h3 { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 0.75rem; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    font-size: 0.85rem;
    transition: all 0.15s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip-green { border-color: var(--green); color: var(--green); }
.chip-blue { border-color: var(--blue); color: var(--blue); }
.chip-yellow { border-color: var(--yellow); color: var(--yellow); }
.chip-orange { border-color: var(--orange); color: var(--orange); }
.chip-red { border-color: var(--red); color: var(--red); }

/* Forms */
.form { margin-top: 1rem; }

.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

.required { color: var(--red); }

.input, .select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a8e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2rem;
}

.textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 1rem;
    height: 1rem;
}

.form-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .select, .filter-bar .input {
    width: auto;
    min-width: 140px;
}

.filter-bar .input { flex: 1; min-width: 200px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--surface-hover); border-color: var(--text-dim); text-decoration: none; }

.btn-primary {
    background: var(--accent);
    color: #0a0a0f;
    border-color: var(--accent);
    font-weight: 600;
}

.btn-primary:hover { background: #2ee00f; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-dim { opacity: 0.6; }

/* Ticket Detail */
.ticket-header { margin-bottom: 1.5rem; }

.ticket-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ticket-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.ticket-subject {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.ticket-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.ticket-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.comment-internal {
    border-left: 3px solid var(--orange);
}

.sidebar-details { font-size: 0.9rem; }

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-dim); white-space: nowrap; }

/* Timeline */
.timeline { font-size: 0.85rem; }

.timeline-event {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
}

.timeline-event:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1.5rem;
    bottom: -0.5rem;
    width: 1px;
    background: var(--border);
}

.timeline-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.timeline-content { flex: 1; }
.timeline-actor { font-weight: 600; }
.timeline-time { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.15rem; }

/* Success */
.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.ticket-confirm {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.confirm-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.confirm-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #ff333320;
    border: 1px solid #ff333340;
    color: var(--red);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-dim);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    html { font-size: 14px; }
    
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .nav { overflow-x: auto; width: 100%; }
    
    .ticket-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .select, .filter-bar .input {
        width: 100%;
        min-width: auto;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .ticket-title-row {
        flex-direction: column;
        gap: 0.25rem;
    }
}
