/* ===================================================
   22WEB CLIENT PORTAL STYLES
   Integrated with 22WEB Design System
=================================================== */

:root {
    --brand-blue: #0077A8;
    --brand-blue-hover: #006087;
    --brand-cyan: #0EA5E9;
    --brand-dark: #0F172A;
    --brand-slate: #1E293B;
    --bg-page: #F8FAFC;
    --bg-white: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-light: #94A3B8;
    --border-glass: rgba(0, 119, 168, 0.12);
    --border-light: rgba(226, 232, 240, 0.8);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-glass: 0 20px 40px -15px rgba(0, 119, 168, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    --shadow-card: 0 25px 50px -12px rgba(15, 23, 42, 0.08);

    /* Status Colors */
    --status-open: #F59E0B;
    --status-progress: #0EA5E9;
    --status-answered: #10B981;
    --status-closed: #64748B;
}

[data-theme="dark"] {
    --bg-page: #0B1120;
    --bg-white: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --text-light: #64748B;
    --border-glass: rgba(14, 165, 233, 0.2);
    --border-light: rgba(51, 65, 85, 0.8);
    --shadow-glass: 0 20px 40px -15px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Ambient Background Mesh */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-page);
    transition: background 0.4s ease;
}

.mesh-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    animation: orbFloat 22s infinite ease-in-out;
}

.mesh-orb--1 {
    width: 45vw;
    height: 45vw;
    background: #E0F2FE;
    top: -15%;
    left: -10%;
}

.mesh-orb--2 {
    width: 50vw;
    height: 50vw;
    background: #BAE6FD;
    bottom: -20%;
    right: -15%;
    animation-delay: -7s;
}

[data-theme="dark"] .mesh-orb--1 {
    background: #075985;
    opacity: 0.35;
}

[data-theme="dark"] .mesh-orb--2 {
    background: #0284C7;
    opacity: 0.25;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 7%) scale(1.06); }
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Portal Header */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 0;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition);
}

[data-theme="dark"] .portal-header {
    background: rgba(11, 17, 32, 0.85);
}

.portal-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-header__logo {
    height: 38px;
    width: auto;
    display: block;
}

.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 119, 168, 0.1);
    color: var(--brand-blue);
    border-radius: 100px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

[data-theme="dark"] .portal-badge {
    background: rgba(14, 165, 233, 0.15);
    color: var(--brand-cyan);
}

.portal-header__actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.back-to-site {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 8px 14px;
    border-radius: 100px;
    border: 1px solid transparent;
}

.back-to-site:hover {
    color: var(--brand-blue);
    background: rgba(0, 119, 168, 0.05);
    border-color: var(--border-glass);
}

[data-theme="dark"] .back-to-site:hover {
    color: var(--brand-cyan);
    background: rgba(14, 165, 233, 0.1);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.theme-toggle:hover {
    transform: scale(1.08) rotate(15deg);
    border-color: var(--brand-blue);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 800;
}

.user-name-role {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 100px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #ef4444;
    color: #fff;
}

/* Glass Surface Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

[data-theme="dark"] .glass-card {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 100px;
    transition: var(--transition);
}

.btn--primary {
    background: var(--brand-dark);
    color: #fff;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.2);
}

.btn--primary:hover {
    background: var(--brand-blue);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -5px rgba(0, 119, 168, 0.4);
}

[data-theme="dark"] .btn--primary {
    background: var(--brand-cyan);
    color: #0F172A;
}

[data-theme="dark"] .btn--primary:hover {
    background: #38BDF8;
}

.btn--outline {
    background: var(--bg-white);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.btn--outline:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.btn--sm {
    padding: 7px 14px;
    font-size: 0.82rem;
}

/* ===================================================
   AUTH VIEW (LOGIN SCREEN)
=================================================== */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
    position: relative;
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 60px -15px rgba(0, 119, 168, 0.15);
}

.auth-card__icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(0, 119, 168, 0.15), rgba(14, 165, 233, 0.25));
    border: 1px solid rgba(0, 119, 168, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 20px;
}

.auth-card__title {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.auth-card__subtitle {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.45;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 1rem;
    color: var(--text-light);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
    outline: none;
}

.toggle-password {
    position: absolute;
    right: 12px;
    padding: 4px;
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--text-main);
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
    animation: shake 0.3s ease;
}

[data-theme="dark"] .auth-error {
    color: #f87171;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.demo-pills {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.demo-pills__label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.demo-pills__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.demo-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    background: rgba(0, 119, 168, 0.08);
    border: 1px solid rgba(0, 119, 168, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-blue);
    cursor: pointer;
    transition: var(--transition);
}

.demo-pill:hover {
    background: var(--brand-blue);
    color: #fff;
    transform: translateY(-1px);
}

[data-theme="dark"] .demo-pill {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.3);
    color: var(--brand-cyan);
}

[data-theme="dark"] .demo-pill:hover {
    background: var(--brand-cyan);
    color: #0F172A;
}

.auth-help {
    margin-top: 18px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auth-help a {
    color: var(--brand-blue);
    font-weight: 700;
}

[data-theme="dark"] .auth-help a {
    color: var(--brand-cyan);
}

/* ===================================================
   MAIN PORTAL DASHBOARD (CLIENT & ADMIN)
=================================================== */
.portal-main {
    padding: 36px 0 80px;
}

.welcome-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
    padding: 24px 30px;
    border-radius: var(--radius-lg);
}

.welcome-content h1 {
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.welcome-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.stats-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-pill {
    display: flex;
    flex-direction: column;
    padding: 10px 18px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    min-width: 120px;
}

.stat-pill__value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--brand-blue);
}

[data-theme="dark"] .stat-pill__value {
    color: var(--brand-cyan);
}

.stat-pill__label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Portal Navigation Tabs */
.portal-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
    overflow-x: auto;
}

.portal-nav__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.portal-nav__btn:hover {
    color: var(--brand-blue);
    background: rgba(0, 119, 168, 0.05);
}

.portal-nav__btn.active {
    background: var(--brand-dark);
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}

[data-theme="dark"] .portal-nav__btn.active {
    background: var(--brand-cyan);
    color: #0F172A;
}

.nav-badge {
    padding: 2px 7px;
    background: #ef4444;
    color: #fff;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 800;
}

/* Content Views */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* ===================================================
   ORDERS SECTION
=================================================== */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.order-card {
    padding: 28px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.order-card:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 119, 168, 0.12);
}

.order-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.order-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.order-id {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 119, 168, 0.1);
    color: var(--brand-blue);
    font-family: monospace;
}

[data-theme="dark"] .order-id {
    background: rgba(14, 165, 233, 0.15);
    color: var(--brand-cyan);
}

.order-category {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-badge--step1 { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.status-badge--step2 { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.status-badge--step3 { background: rgba(14, 165, 233, 0.15); color: #0284c7; }
.status-badge--step4 { background: rgba(168, 85, 247, 0.12); color: #9333ea; }
.status-badge--step5 { background: rgba(16, 185, 129, 0.15); color: #059669; }

.order-card__name {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.order-card__desc {
    font-size: 0.94rem;
    color: var(--text-muted);
    margin-bottom: 22px;
    max-width: 850px;
}

/* Step Pipeline (5 Stages) */
.pipeline-wrapper {
    margin: 22px 0;
    padding: 16px 0;
}

.pipeline-steps {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: relative;
    gap: 10px;
}

.pipeline-steps::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--border-light);
    z-index: 1;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    text-align: center;
}

.step-bubble {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 3px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 8px;
    transition: var(--transition);
}

.step-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.3;
}

.step-item.completed .step-bubble {
    background: #10B981;
    border-color: #10B981;
    color: #fff;
}

.step-item.completed .step-label {
    color: var(--text-main);
}

.step-item.active .step-bubble {
    background: var(--brand-blue);
    border-color: var(--brand-cyan);
    color: #fff;
    box-shadow: 0 0 0 5px rgba(14, 165, 233, 0.25);
    animation: activeStepPulse 2s infinite;
}

[data-theme="dark"] .step-item.active .step-bubble {
    background: var(--brand-cyan);
    color: #0F172A;
}

.step-item.active .step-label {
    color: var(--brand-blue);
    font-weight: 800;
}

[data-theme="dark"] .step-item.active .step-label {
    color: var(--brand-cyan);
}

@keyframes activeStepPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Progress bar */
.order-progress-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 18px 0;
}

.progress-track {
    flex: 1;
    height: 9px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-blue), var(--brand-cyan));
    border-radius: 100px;
    transition: width 0.6s ease;
}

.progress-percentage {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--brand-blue);
    min-width: 48px;
}

[data-theme="dark"] .progress-percentage {
    color: var(--brand-cyan);
}

/* Links and Meta */
.order-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

.order-meta-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.meta-item strong {
    color: var(--text-main);
}

.order-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.order-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    transition: var(--transition);
}

.order-link-chip:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    transform: translateY(-1px);
}

/* ===================================================
   TICKETS SECTION
================================================== */
.tickets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}

.tickets-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    transition: var(--transition);
}

.filter-btn.active, .filter-btn:hover {
    background: var(--brand-dark);
    color: #fff;
    border-color: var(--brand-dark);
}

[data-theme="dark"] .filter-btn.active {
    background: var(--brand-cyan);
    color: #0F172A;
    border-color: var(--brand-cyan);
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ticket-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    gap: 16px;
}

.ticket-item:hover {
    transform: translateX(4px);
    border-color: var(--brand-cyan);
}

.ticket-item-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket-item-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-id {
    font-size: 0.8rem;
    font-weight: 800;
    font-family: monospace;
    color: var(--brand-blue);
}

[data-theme="dark"] .ticket-id {
    color: var(--brand-cyan);
}

.ticket-priority-pill {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.priority-regular { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.priority-high { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.priority-urgent { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

.ticket-item-subject {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.ticket-item-preview {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 700px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-item-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ticket-time {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* Status Chip */
.ticket-status {
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-open { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.status-in_progress { background: rgba(14, 165, 233, 0.15); color: #0284c7; }
.status-answered { background: rgba(16, 185, 129, 0.15); color: #059669; }
.status-closed { background: rgba(100, 116, 139, 0.15); color: #64748b; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    border-radius: var(--radius-md);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 14px;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ===================================================
   MODALS & DIALOGS
=================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    border-radius: var(--radius-lg);
    background: var(--bg-white);
    position: relative;
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.3);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .modal-card {
    background: #1E293B;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

[data-theme="dark"] .modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 22px;
}

/* Chat / Ticket Thread Drawer */
.chat-modal-card {
    max-width: 720px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(0, 0, 0, 0.02);
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header-title {
    font-size: 1.15rem;
    font-weight: 800;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    position: relative;
    line-height: 1.5;
    font-size: 0.94rem;
}

.chat-bubble--client {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand-blue), #0284c7);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble--admin {
    align-self: flex-start;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .chat-bubble--admin {
    background: #0F172A;
    border-color: rgba(255, 255, 255, 0.1);
}

.chat-bubble-sender {
    font-size: 0.76rem;
    font-weight: 800;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-bubble--admin .chat-bubble-sender {
    color: var(--brand-blue);
}

[data-theme="dark"] .chat-bubble--admin .chat-bubble-sender {
    color: var(--brand-cyan);
}

.chat-bubble-time {
    font-size: 0.72rem;
    margin-top: 6px;
    opacity: 0.7;
    align-self: flex-end;
}

.chat-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

[data-theme="dark"] .chat-footer {
    background: #1E293B;
}

.chat-input {
    flex: 1;
    resize: none;
    height: 52px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-light);
    background: var(--bg-page);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--brand-cyan);
}

/* ===================================================
   ADMIN SPECIFIC STYLES
=================================================== */
.admin-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.admin-table th {
    background: rgba(0, 0, 0, 0.03);
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

[data-theme="dark"] .admin-table th {
    background: rgba(255, 255, 255, 0.04);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.admin-table tr:hover td {
    background: rgba(0, 119, 168, 0.03);
}

.action-btns-group {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.btn-icon--danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Toast Notifications */
.portal-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    background: var(--brand-dark);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
    z-index: 300;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-toast.active {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .portal-header__brand .portal-badge {
        display: none;
    }

    .pipeline-steps {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pipeline-steps::before {
        display: none;
    }

    .step-item {
        flex-direction: row;
        gap: 12px;
        text-align: left;
    }

    .step-bubble {
        margin-bottom: 0;
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-item-meta {
        width: 100%;
        justify-content: space-between;
    }

    .welcome-strip {
        padding: 20px;
    }
}
