/* ============================================
   ConSEOlente Ticket System - Frontend CSS
   ============================================ */

:root {
    --cst-primary: #0a2540;
    --cst-primary-light: #1a3a5c;
    --cst-accent: #0070f3;
    --cst-accent-hover: #0060d0;
    --cst-success: #10b981;
    --cst-warning: #f59e0b;
    --cst-danger: #ef4444;
    --cst-info: #6366f1;
    --cst-bg: #f8fafc;
    --cst-card: #ffffff;
    --cst-border: #e2e8f0;
    --cst-text: #1e293b;
    --cst-text-muted: #64748b;
    --cst-radius: 12px;
    --cst-radius-sm: 8px;
    --cst-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --cst-shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --cst-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
}

/* App Container */
.cst-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px 40px;
    color: var(--cst-text);
    line-height: 1.6;
}

/* ---- Auth ---- */
.cst-auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 16px;
}

.cst-auth-card {
    background: var(--cst-card);
    border-radius: var(--cst-radius);
    box-shadow: var(--cst-shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.cst-auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.cst-auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--cst-primary);
    margin: 0 0 6px;
}

.cst-auth-header p {
    color: var(--cst-text-muted);
    margin: 0;
    font-size: 14px;
}

.cst-auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.cst-auth-footer a {
    color: var(--cst-accent);
    text-decoration: none;
}

/* ---- Top Bar ---- */
.cst-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--cst-border);
    flex-wrap: wrap;
    gap: 12px;
}

.cst-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cst-topbar-brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--cst-primary);
}

.cst-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}

.cst-nav-link {
    color: var(--cst-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--cst-radius-sm);
    transition: all .2s;
}

.cst-nav-link:hover,
.cst-nav-link.active {
    color: var(--cst-accent);
    background: rgba(0,112,243,.06);
}

.cst-ticket-counter {
    background: var(--cst-bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--cst-text-muted);
}

.cst-counter-num {
    font-weight: 700;
    color: var(--cst-accent);
}

.cst-user-name {
    font-weight: 600;
    color: var(--cst-primary);
}

.cst-logout-link {
    color: var(--cst-danger);
    text-decoration: none;
    font-size: 13px;
}

/* ---- Welcome Card ---- */
.cst-welcome-card {
    background: linear-gradient(135deg, var(--cst-primary) 0%, var(--cst-primary-light) 100%);
    color: #fff;
    border-radius: var(--cst-radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cst-welcome-text h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.cst-welcome-text p {
    margin: 0;
    opacity: .8;
    font-size: 14px;
    color: #fff;
}

.cst-mini-stat {
    text-align: right;
}

.cst-mini-stat-num {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.cst-mini-stat-label {
    font-size: 12px;
    opacity: .8;
    display: block;
    margin-bottom: 6px;
}

.cst-progress-bar {
    width: 160px;
    height: 6px;
    background: rgba(255,255,255,.2);
    border-radius: 3px;
    overflow: hidden;
    margin-left: auto;
}

.cst-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 3px;
    transition: width .4s ease;
}

/* ---- Buttons ---- */
.cst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--cst-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
    gap: 6px;
}

.cst-btn-primary {
    background: var(--cst-accent);
    color: #fff;
}

.cst-btn-primary:hover {
    background: var(--cst-accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--cst-shadow-md);
}

.cst-btn-secondary {
    background: var(--cst-bg);
    color: var(--cst-text);
    border: 1px solid var(--cst-border);
}

.cst-btn-secondary:hover {
    background: var(--cst-border);
    color: var(--cst-text);
}

.cst-btn-full {
    width: 100%;
}

.cst-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ---- Form ---- */
.cst-form-group {
    margin-bottom: 18px;
}

.cst-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--cst-text);
}

.cst-form-group input,
.cst-form-group select,
.cst-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--cst-border);
    border-radius: var(--cst-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
    background: #fff;
    color: var(--cst-text);
    box-sizing: border-box;
}

.cst-form-group input:focus,
.cst-form-group select:focus,
.cst-form-group textarea:focus {
    outline: none;
    border-color: var(--cst-accent);
    box-shadow: 0 0 0 3px rgba(0,112,243,.1);
}

.cst-form-card {
    background: var(--cst-card);
    border-radius: var(--cst-radius);
    padding: 28px;
    box-shadow: var(--cst-shadow);
}

.cst-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ---- Tickets List ---- */
.cst-tickets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cst-ticket-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--cst-card);
    border-radius: var(--cst-radius-sm);
    border: 1px solid var(--cst-border);
    text-decoration: none;
    color: var(--cst-text);
    transition: all .2s;
    gap: 12px;
    flex-wrap: wrap;
}

.cst-ticket-card:hover {
    border-color: var(--cst-accent);
    box-shadow: var(--cst-shadow-md);
    transform: translateY(-1px);
    color: var(--cst-text);
}

.cst-ticket-card.cst-has-new {
    border-left: 3px solid var(--cst-accent);
}

.cst-ticket-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.cst-ticket-id {
    color: var(--cst-text-muted);
    font-weight: 600;
    font-size: 13px;
    min-width: 40px;
}

.cst-ticket-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.cst-ticket-date {
    font-size: 12px;
    color: var(--cst-text-muted);
}

.cst-ticket-card-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cst-new-badge {
    background: var(--cst-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.cst-replies-count {
    font-size: 12px;
    color: var(--cst-text-muted);
}

/* ---- Badges ---- */
.cst-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cst-badge-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.cst-badge-in_progress {
    background: #fef3c7;
    color: #92400e;
}

.cst-badge-answered {
    background: #d1fae5;
    color: #065f46;
}

.cst-badge-closed {
    background: #f1f5f9;
    color: #64748b;
}

.cst-priority-normal { background: #f1f5f9; color: #475569; }
.cst-priority-high { background: #fef3c7; color: #92400e; }
.cst-priority-urgent { background: #fee2e2; color: #991b1b; }

/* ---- Conversation ---- */
.cst-view-ticket h2 {
    margin: 0;
    font-size: 20px;
}

.cst-back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--cst-accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.cst-ticket-detail-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cst-border);
}

.cst-ticket-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cst-ticket-id-big {
    color: var(--cst-text-muted);
    font-size: 18px;
    font-weight: 700;
}

.cst-ticket-detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cst-conversation {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.cst-msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.cst-msg-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.cst-msg-admin {
    align-self: flex-start;
}

.cst-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.cst-msg-mine .cst-msg-avatar {
    background: var(--cst-accent);
    color: #fff;
}

.cst-msg-admin .cst-msg-avatar {
    background: var(--cst-primary);
    color: #fff;
}

.cst-msg-content {
    background: var(--cst-card);
    border: 1px solid var(--cst-border);
    border-radius: var(--cst-radius);
    padding: 14px 18px;
}

.cst-msg-mine .cst-msg-content {
    background: #eef6ff;
    border-color: #c7ddf5;
}

.cst-msg-admin .cst-msg-content {
    background: #fff;
}

.cst-msg-sender {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.cst-msg-time {
    font-size: 11px;
    color: var(--cst-text-muted);
    margin-bottom: 6px;
}

.cst-msg-text {
    font-size: 14px;
    line-height: 1.6;
}

.cst-msg-text p {
    margin: 0 0 8px;
}

.cst-msg-text p:last-child {
    margin-bottom: 0;
}

/* Reply Section */
.cst-reply-section {
    background: var(--cst-card);
    border-radius: var(--cst-radius);
    border: 1px solid var(--cst-border);
    padding: 20px;
}

.cst-reply-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.cst-reply-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--cst-border);
    border-radius: var(--cst-radius-sm);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.cst-reply-section textarea:focus {
    outline: none;
    border-color: var(--cst-accent);
}

/* ---- Alerts ---- */
.cst-alert {
    padding: 14px 18px;
    border-radius: var(--cst-radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.cst-alert-error { background: #fee2e2; color: #991b1b; }
.cst-alert-warning { background: #fef3c7; color: #92400e; }
.cst-alert-success { background: #d1fae5; color: #065f46; }
.cst-alert-info { background: #e0e7ff; color: #3730a3; }

/* ---- Messages ---- */
.cst-message {
    padding: 12px 16px;
    border-radius: var(--cst-radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}

.cst-message.success { background: #d1fae5; color: #065f46; }
.cst-message.error { background: #fee2e2; color: #991b1b; }

/* ---- Empty State ---- */
.cst-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--cst-text-muted);
}

.cst-empty-state h3 {
    margin: 16px 0 6px;
    color: var(--cst-text);
    font-size: 18px;
}

.cst-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ---- New Ticket ---- */
.cst-new-ticket h2 {
    margin: 0 0 4px;
    font-size: 22px;
}

.cst-subtitle {
    color: var(--cst-text-muted);
    font-size: 14px;
    margin: 0 0 20px;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .cst-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .cst-topbar-right {
        flex-wrap: wrap;
    }
    .cst-welcome-card {
        flex-direction: column;
        text-align: center;
    }
    .cst-mini-stat {
        text-align: center;
    }
    .cst-progress-bar {
        margin: 0 auto;
    }
    .cst-ticket-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .cst-ticket-card-right {
        margin-top: 8px;
    }
    .cst-msg {
        max-width: 95%;
    }
    .cst-form-actions {
        flex-direction: column;
    }
    .cst-auth-card {
        padding: 28px 20px;
    }
}
