/* ── Support Center — Redesign ──────────────────────────────── */

@keyframes spFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideInRight {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateX(20px); }
}

@keyframes progressBar {
    from { width: 100%; }
    to   { width: 0%; }
}

body {
    font-family: var(--font-family);
    background: #f1f5f9;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* ── Hero ── */






.sp-btn-new {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.sp-btn-new:hover {
    background: var(--primary-dark, #4f46e5);
    transform: translateY(-1px);
}

/* ── Page body ── */
.sp-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 48px;
    animation: spFadeUp 0.35s ease;
}

/* ── Info Banner ── */
.sp-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.sp-info-icon {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
}

.sp-info-banner p {
    margin: 0;
    font-size: 13px;
    color: #3730a3;
    line-height: 1.55;
}

.sp-info-banner strong { color: #1e1b4b; }

/* ── Loading ── */
.sp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.sp-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Ticket Card ── */
.ticket-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    position: relative;
    overflow: hidden;
    display: block;
}

.ticket-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 3px 0 0 3px;
    opacity: 0;
    transition: opacity 0.15s;
}

.ticket-card:hover {
    border-color: rgba(99,102,241,0.3);
    box-shadow: 0 4px 16px rgba(99,102,241,0.08);
    transform: translateY(-1px);
}

.ticket-card:hover::before { opacity: 1; }
.ticket-card:active { transform: translateY(0); }

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ticket-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 12px;
    letter-spacing: 0.4px;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
}

.ticket-subject {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14.5px;
    margin: 0;
    line-height: 1.4;
}

.ticket-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ticket-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-open      { background: #e0f2fe; color: #0369a1; }
.badge-assigned  { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #ede9fe; color: #6d28d9; }
.badge-resolved  { background: #dcfce7; color: #166534; }
.badge-closed    { background: #f1f5f9; color: #64748b; }

.badge-urgent { background: #fee2e2; color: #b91c1c; }
.badge-high   { background: #ffedd5; color: #c2410c; }
.badge-normal { background: #e0f2fe; color: #0369a1; }
.badge-low    { background: #f1f5f9; color: #64748b; }

/* ── Empty State ── */
.sp-empty {
    background: #fff;
    border-radius: 12px;
    border: 1.5px dashed var(--border);
    padding: 60px 32px;
    text-align: center;
}

.sp-empty-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: var(--text-muted);
}

.sp-empty h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.sp-empty p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0 0 22px;
}

/* ── Ticket Detail (in view modal) ── */
.sp-ticket-info {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sp-ticket-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.sp-ticket-row strong {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 80px;
}

.sp-badges-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sp-msgs-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* ── Message Bubbles ── */
.message-bubble {
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    max-width: 85%;
    font-size: 13.5px;
    line-height: 1.55;
}

.message-user {
    background: #f1f5f9;
    border: 1px solid var(--border);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-admin {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid rgba(99,102,241,0.15);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-internal {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    font-style: italic;
    max-width: 100%;
    border-radius: 10px;
}

.message-sender {
    font-size: 11.5px;
    font-weight: 700;
    margin-bottom: 5px;
    opacity: 0.7;
}

.message-text { color: var(--text-primary); }

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── Reply section ── */
.sp-reply {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sp-reply label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sp-reply textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
    resize: vertical;
    min-height: 88px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
}

.sp-reply textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.sp-reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.sp-closed-note {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 15px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
}

/* ── Modal ── */
.sp-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15,15,30,0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.sp-modal-panel {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
    animation: modalIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
    border: 1px solid var(--border);
    flex-shrink: 0;
    margin: auto;
}

.sp-modal-panel-lg { max-width: 680px; }

.sp-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sp-modal-header-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.sp-modal-hicon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.sp-modal-hicon-alt {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.sp-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
    line-height: 1.3;
}

.sp-modal-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
}

.sp-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.sp-modal-close:hover { background: #fee2e2; color: #dc2626; }

.sp-modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.sp-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ── Form ── */
.sp-form-group {
    margin-bottom: 16px;
}

.sp-form-group:last-of-type { margin-bottom: 0; }

.sp-form-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sp-form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

.sp-required { color: #ef4444; font-weight: 700; }

.sp-form-group input,
.sp-form-group select,
.sp-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    box-sizing: border-box;
}

.sp-form-group input::placeholder,
.sp-form-group textarea::placeholder { color: var(--text-muted); }

.sp-form-group input:focus,
.sp-form-group select:focus,
.sp-form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.sp-form-group textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.55;
}

.sp-btn-cancel {
    padding: 9px 18px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.sp-btn-cancel:hover { background: #f1f5f9; }

.sp-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    font-family: inherit;
}

.sp-btn-submit:hover {
    background: var(--primary-dark, #4f46e5);
    transform: translateY(-1px);
}

/* ── Generic btn classes (used in JS-generated HTML) ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark, #4f46e5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover { background: #e2e8f0; }

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    width: calc(100% - 40px);
}

.toast {
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 4.7s forwards;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progressBar 5s linear forwards;
}

.toast-success { border-left-color: #22c55e; color: #166534; }
.toast-error   { border-left-color: #ef4444; color: #991b1b; }
.toast-info    { border-left-color: #6366f1; color: #3730a3; }
.toast-warning { border-left-color: #f59e0b; color: #92400e; }

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: #dcfce7; }
.toast-error   .toast-icon { background: #fee2e2; }
.toast-info    .toast-icon { background: #e0e7ff; }
.toast-warning .toast-icon { background: #fef3c7; }

.toast-content { flex: 1; min-width: 0; }
.toast-title   { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.toast-message { font-size: 12.5px; opacity: 0.85; line-height: 1.4; }

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.toast-close:hover { background: rgba(0,0,0,0.08); color: var(--text-primary); }

/* ── Footer ── */
.sp-footer {
    border-top: 1px solid var(--border-soft, #e2e8f0);
    padding-top: 24px;
    margin-top: 32px;
    text-align: center;
}

.sp-footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.sp-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.sp-footer-links a:hover { color: var(--primary); }

.sp-footer-copy {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .sp-page { padding: 20px 16px 40px; }
    .sp-form-row2 { grid-template-columns: 1fr; }
    .sp-modal-panel { max-height: 95vh; }
    .sp-modal-header { padding: 16px 16px 14px; }
    .sp-modal-body { padding: 16px; }
    .message-bubble { max-width: 96%; }
    .toast-container { top: 12px; right: 12px; left: 12px; max-width: none; width: calc(100% - 24px); }
}
