/* ============================================================
   Velocity Helpdesk — Customer Portal
   A warmer, more spacious "modern SaaS" register distinct from
   the admin's data-dense utility styling. Same brand orange,
   bigger radii, soft gradient backdrop, floating cards.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    --ink: #201a15;
    --ink-soft: #7a6d60;
    --paper: #fff9f4;
    --card: #ffffff;
    --line: #f0e6da;
    --orange: #ff6a1a;
    --orange-2: #ff8c42;
    --orange-dark: #e4550a;
    --orange-wash: #fff1e8;

    --open: #e67e22;
    --progress: #2d9cdb;
    --wait: #9b59b6;
    --resolved: #219653;
    --closed: #8a7f74;

    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow-soft: 0 4px 20px rgba(32, 26, 21, 0.06);
    --shadow-lift: 0 14px 40px rgba(255, 106, 26, 0.14);
}

* { box-sizing: border-box; }

body.portal {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(ellipse 900px 500px at 85% -10%, rgba(255,140,66,0.16), transparent 60%),
        radial-gradient(ellipse 700px 500px at -10% 20%, rgba(255,106,26,0.08), transparent 55%),
        var(--paper);
    -webkit-font-smoothing: antialiased;
}

/* Login page illustration - full-bleed, centered behind the card (like
   Velocity Track's login), rather than anchored to one edge. */
.login-bg-illustration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    max-width: none;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}
@media (max-width: 700px) {
    .login-bg-illustration { display: none; }
}

h1, h2, h3, .brand { font-family: 'Poppins', sans-serif; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.brand { text-decoration: none; display: inline-block; }
.brand:hover { text-decoration: none; }
a { color: var(--orange-dark); text-decoration: none; }

/* ---------- Top nav ---------- */
.portal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.portal-nav .brand { font-size: 1.25rem; color: var(--ink); }
.portal-nav .brand span { color: var(--orange); }
.portal-nav .links { display: flex; align-items: center; gap: 22px; font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }
.portal-nav .links a.active { color: var(--orange-dark); }
.portal-nav .links a:hover { color: var(--orange-dark); text-decoration: none; }

.portal-wrap { max-width: 900px; margin: 0 auto; padding: 10px 32px 80px; position: relative; z-index: 1; }
.portal-wrap.narrow { max-width: 460px; }

/* ---------- Hero ---------- */
.portal-hero { text-align: center; padding: 30px 10px 36px; }
.portal-hero h1 { font-size: 1.9rem; margin-bottom: 8px; }
.portal-hero p { color: var(--ink-soft); font-size: 1rem; margin: 0; }
.hero-flex { text-align: left; display: flex; justify-content: space-between; align-items: center; padding-left: 0; padding-right: 0; gap: 16px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 26px; border-radius: 50px; font-weight: 600; font-size: 0.92rem;
    border: none; cursor: pointer; text-decoration: none; font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-2)); color: #fff; box-shadow: var(--shadow-lift); }
.btn-primary:hover { transform: translateY(-1px); text-decoration: none; }
.btn-outline { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--orange); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 0.82rem; border-radius: 30px; }

/* ---------- Cards ---------- */
.glass-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--line);
    padding: 32px;
}

/* Real frosted-glass effect - translucent + blurred, so the background
   illustration shows through softly instead of a solid opaque card. */
.glass-card.glass-effect {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(32, 26, 21, 0.12);
}

/* ---------- Auth pages ---------- */
.auth-card { margin-top: 20px; }
.auth-card label { display: block; font-size: 0.84rem; font-weight: 600; margin: 16px 0 6px; }
.auth-card input {
    width: 100%; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-md);
    font-family: inherit; font-size: 0.94rem; background: #fefdfb;
}
.auth-card input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-wash); }
.auth-switch { text-align: center; margin-top: 22px; font-size: 0.88rem; color: var(--ink-soft); }
.auth-divider { display: flex; align-items: center; text-align: center; color: var(--ink-soft); font-size: 0.8rem; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--line); }
.auth-divider span { padding: 0 12px; }

/* ---------- Password show/hide toggle ---------- */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    border-radius: 8px;
}
.password-toggle:hover { color: var(--ink); background: var(--orange-wash); }
.error-msg { background: #fdecec; color: #c0392b; padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.86rem; margin-bottom: 8px; }
.success-msg { background: #eafaf1; color: #1e8449; padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.86rem; margin-bottom: 8px; }

/* ---------- Ticket cards (My Tickets list) ---------- */
.ticket-card {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line);
    border-radius: var(--radius-md); padding: 18px 22px; margin-bottom: 12px;
    box-shadow: var(--shadow-soft); transition: transform 0.15s ease;
    text-decoration: none; color: var(--ink);
}
.ticket-card:hover { transform: translateY(-2px); text-decoration: none; }
.ticket-card .tnum { font-weight: 700; font-size: 0.95rem; }
.ticket-card .tsub { color: var(--ink-soft); font-size: 0.85rem; margin-top: 3px; }
.ticket-card .tmeta { color: var(--ink-soft); font-size: 0.78rem; margin-top: 6px; }

.ticket-card.st-open { border-left-color: var(--open); }
.ticket-card.st-in_progress { border-left-color: var(--progress); }
.ticket-card.st-waiting_customer, .ticket-card.st-waiting_parts { border-left-color: var(--wait); }
.ticket-card.st-resolved { border-left-color: var(--resolved); }
.ticket-card.st-closed { border-left-color: var(--closed); }

.pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 5px 13px;
    border-radius: 20px; font-size: 0.76rem; font-weight: 700; color: #fff; white-space: nowrap;
}

/* ---------- Empty state ---------- */
.empty-portal { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-portal .icon { font-size: 2.6rem; margin-bottom: 12px; }
.empty-portal h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- New ticket form ---------- */
.form-grid label { display: block; font-size: 0.86rem; font-weight: 600; margin: 16px 0 6px; }
.form-grid input, .form-grid select, .form-grid textarea {
    width: 100%; min-width: 0; padding: 12px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-md);
    font-family: inherit; font-size: 0.92rem; background: #fefdfb;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-wash);
}
.field-row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

/* ---------- Journey rail (bigger, friendlier version) ---------- */
.rail-modern { display: flex; margin: 26px 0 8px; }
.rail-modern .step { flex: 1; text-align: center; position: relative; }
.rail-modern .dot {
    width: 20px; height: 20px; border-radius: 50%; background: var(--line);
    margin: 0 auto 10px; position: relative; z-index: 2; border: 4px solid var(--card);
    box-shadow: 0 0 0 2px var(--line);
}
.rail-modern .step.done .dot, .rail-modern .step.current .dot { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.rail-modern .step.current .dot { box-shadow: 0 0 0 5px var(--orange-wash), 0 0 0 2px var(--orange); }
.rail-modern .step::after {
    content: ''; position: absolute; top: 9px; left: 50%; width: 100%; height: 3px;
    background: var(--line); z-index: 1; border-radius: 2px;
}
.rail-modern .step:last-child::after { display: none; }
.rail-modern .step.done::after { background: var(--orange); }
.rail-modern .label { font-size: 0.76rem; font-weight: 700; color: var(--ink-soft); }
.rail-modern .step.done .label, .rail-modern .step.current .label { color: var(--ink); }

/* ---------- Ticket detail / timeline ---------- */
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.timeline-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.timeline-item .avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem;
}
.timeline-item.staff .avatar { background: #eaf4fc; color: #2d75a6; }
.timeline-item.customer .avatar { background: var(--orange-wash); color: var(--orange-dark); }
.timeline-item .meta { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 3px; }
.reply-box textarea { min-height: 90px; }

/* ---------- Chat attachments (photos/videos inline in replies) ---------- */
.chat-attach-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    border: 1.5px dashed var(--line);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
}
.chat-attach-label:hover { border-color: var(--orange); color: var(--ink); }
.chat-media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-media-thumb {
    width: 140px; height: 140px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    cursor: pointer;
}
.chat-media-video {
    max-width: 260px;
    max-height: 200px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #000;
}

.info-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 0.87rem; }
.info-line span:first-child { color: var(--ink-soft); }
.info-line span:last-child { font-weight: 600; text-align: right; }

/* ============================================================
   RESPONSIVE - tablet and below (~900px)
   ============================================================ */
@media (max-width: 900px) {
    .portal-nav, .portal-wrap { padding-left: 24px; padding-right: 24px; }
}

/* ============================================================
   RESPONSIVE - mobile (~640px and below: phones)
   ============================================================ */
@media (max-width: 640px) {
    .portal-nav {
        flex-wrap: wrap;
        gap: 10px;
        padding-left: 18px; padding-right: 18px;
    }
    .portal-nav .links { gap: 16px; flex-wrap: wrap; }
    .portal-wrap { padding-left: 18px; padding-right: 18px; }

    .hero-flex { flex-direction: column; align-items: flex-start; gap: 14px; }
    .hero-flex .btn { width: 100%; justify-content: center; }

    .field-row-2 { grid-template-columns: 1fr; }
    .ticket-card { flex-direction: column; align-items: flex-start; gap: 10px; }
    .glass-card { padding: 22px; }

    .rail-modern .step { min-width: 60px; }
    .rail-modern .label { font-size: 0.68rem; }

    .detail-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ============================================================
   RESPONSIVE - small phones (~420px and below)
   ============================================================ */
@media (max-width: 420px) {
    .portal-hero h1 { font-size: 1.5rem; }
    .glass-card { padding: 18px; }
    .rail-modern .dot { width: 16px; height: 16px; }
    .rail-modern .label { font-size: 0.6rem; }
    .btn { padding: 11px 18px; font-size: 0.86rem; }
}
