/* ============================================================
   Nearpeer — Public Portal Styles
   ============================================================ */

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

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

:root {
    --bg: #eef0f5;
    --card-bg: #ffffff;
    --sidebar-bg: #f7f8fa;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #111827;
    --accent-hover: #374151;
    --brand-gradient: linear-gradient(135deg, #f97316 0%, #ec4899 40%, #1f94b2 100%);
    --border: #e5e7eb;
    --input-border: #d1d5db;
    --input-focus: #1f95b2;
    --shadow-card: 0 20px 60px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.06);
    --radius-card: 24px;
    --radius-input: 12px;
    --radius-btn: 50px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-primary);
}

/* ── Background decoration ───────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 10%, rgba(139,92,246,.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 80%, rgba(249,115,22,.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Main card ────────────────────────────────────────────── */
.portal-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 580px;
    width: 100%;
    max-width: 920px;
    overflow: hidden;
}

/* ── Left sidebar ─────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-gradient);
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-section { margin-bottom: 32px; }

.sidebar-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.sidebar-section p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 10px;
    transition: color .2s;
}
.sidebar-link:hover { color: var(--text-primary); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 28px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    gap: 14px;
}

.sidebar-social {
    width: 36px;
    height: 36px;
    background: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform .2s, background .2s;
}
.sidebar-social:hover { transform: translateY(-2px); background: #374151; }
.sidebar-social svg { width: 16px; height: 16px; fill: white; }

/* ── Right content panel ─────────────────────────────────── */
.content-panel {
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
}

/* ── Brand avatar (top of content) ───────────────────────── */
.brand-avatar {
    width: 48px;
    height: 48px;
    background: var(--brand-gradient);
    border-radius: 50%;
    margin-bottom: 28px;
    flex-shrink: 0;
}

/* ── Step heading ─────────────────────────────────────────── */
.step-heading h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.2;
}
.step-heading p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ── Progress steps ───────────────────────────────────────── */
.steps-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 32px;
}
.step-dot {
    height: 4px;
    border-radius: 4px;
    flex: 1;
    background: var(--border);
    transition: background .4s;
}
.step-dot.active { background: var(--text-primary); }
.step-dot.done   { background: #1f95b2; }

/* ── Category grid ────────────────────────────────────────── */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.category-card {
    position: relative;
    padding: 18px 20px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    background: #fff;
}
.category-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    transform: translateY(-1px);
}
.category-card.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.category-card.selected::after {
    content: '';
    position: absolute;
    top: 10px; right: 10px;
    width: 18px; height: 18px;
    background: var(--text-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/12px no-repeat;
    border-radius: 50%;
}

.category-icon {
    font-size: 22px;
    margin-bottom: 10px;
    display: block;
}
.category-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.category-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Form fields ──────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-group textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* ── Priority pills ───────────────────────────────────────── */
.priority-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.priority-pill {
    padding: 7px 18px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    background: #fff;
    color: var(--text-secondary);
}
.priority-pill:hover { border-color: #9ca3af; color: var(--text-primary); }
.priority-pill.selected { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
.priority-pill.selected.low    { background: #1f95b2; border-color: #1f95b2; }
.priority-pill.selected.medium { background: #1f95b2; border-color: #1f95b2; }
.priority-pill.selected.high   { background: #f59e0b; border-color: #f59e0b; }
.priority-pill.selected.urgent { background: #ef4444; border-color: #ef4444; }

/* ── File drop zone ───────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 16px;
    background: #fafafa;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: #1f95b2;
    background: rgba(99,102,241,.04);
}
.drop-zone .dz-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.drop-zone p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.drop-zone span { color: #1f95b2; font-weight: 500; }
.drop-zone input[type="file"] { display: none; }

.file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.file-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: #f3f4f6;
    border-radius: 50px;
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}
.file-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    transition: color .2s;
}
.file-chip button:hover { color: #ef4444; }

/* ── Navigation buttons ───────────────────────────────────── */
.step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 24px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    text-decoration: none;
}
.btn-back:hover { border-color: #9ca3af; color: var(--text-primary); }

.btn-next {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, transform .15s;
}
.btn-next:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-next:disabled { background: #9ca3af; cursor: not-allowed; transform: none; }

/* ── Success screen ───────────────────────────────────────── */
.success-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 0;
    flex: 1;
}
.success-icon {
    width: 72px; height: 72px;
    background: #e0f2f7;
    color: #1f95b2;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    margin-bottom: 24px;
    animation: pop-in .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes pop-in { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success-screen h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.success-screen p  { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.ticket-id-box {
    background: #f9fafb;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 20px 28px;
    margin-bottom: 24px;
    width: 100%;
}
.ticket-id-box small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.ticket-id-display {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--text-primary);
}
.copy-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    margin-left: 12px;
    font-family: inherit;
    transition: all .2s;
}
.copy-btn:hover { background: #f3f4f6; color: var(--text-primary); }
.copy-btn.copied { background: #e0f2f7; border-color: #8cd3e6; color: #115566; }

.success-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-outline {
    padding: 10px 22px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-secondary);
    background: #fff;
    transition: all .2s;
    text-decoration: none;
}
.btn-outline:hover { border-color: #9ca3af; color: var(--text-primary); }

/* ── Status check (track mode) ────────────────────────────── */
.track-container {
    max-width: 540px;
    margin: 0 auto;
    width: 100%;
}
.track-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.track-input-group input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.track-input-group input:focus { border-color: var(--input-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }

.ticket-card {
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.ticket-card:hover { border-color: #9ca3af; box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.ticket-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ticket-card h4 { font-size: 14px; font-weight: 600; }
.ticket-card p  { font-size: 13px; color: var(--text-secondary); }

/* ── Thread (read-only) ───────────────────────────────────── */
.thread-container {
    border: 1.5px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 16px;
}
.thread-header {
    background: #f9fafb;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.thread-header h3 { font-size: 15px; font-weight: 600; }
.thread-body { padding: 20px; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}
.bubble.customer {
    background: #f3f4f6;
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.bubble.admin {
    background: var(--text-primary);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.bubble.system {
    align-self: center;
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    padding: 4px 0;
}
.bubble-meta {
    font-size: 11px;
    opacity: .6;
    margin-top: 4px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-open       { background: #dbeafe; color: #1d4ed8; }
.badge-inprogress { background: #ede9fe; color: #7c3aed; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-resolved   { background: #e0f2f7; color: #115566; }
.badge-closed     { background: #f3f4f6; color: #374151; }
.badge-low        { background: #e0f2f7; color: #115566; }
.badge-medium     { background: #ede9fe; color: #7c3aed; }
.badge-high       { background: #fef3c7; color: #92400e; }
.badge-urgent     { background: #fee2e2; color: #991b1b; }

/* ── Tab switcher ─────────────────────────────────────────── */
.mode-tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 32px;
}
.mode-tab {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    transition: all .2s;
}
.mode-tab.active { background: #fff; color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ── Error message ────────────────────────────────────────── */
.error-msg {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Step transition animation ────────────────────────────── */
.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: slide-in .3s ease;
}
@keyframes slide-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 720px) {
    body { padding: 0; align-items: flex-start; }
    .portal-card {
        grid-template-columns: 1fr;
        border-radius: 0;
        min-height: 100vh;
    }
    .sidebar { display: none; }
    .content-panel { padding: 32px 24px; }
    .form-row { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
    .category-grid { grid-template-columns: 1fr; }
}

/* ── Feedback & Satisfaction Survey ──────────────────────── */
.emojis-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 32px 0 48px;
    width: 100%;
    position: relative;
}
.emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.emoji-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
    padding: 0;
    line-height: 1;
    filter: grayscale(1);
    opacity: 0.45;
}
.emoji-btn:hover {
    transform: scale(1.15);
    border-color: #cbd5e1;
    background: #f1f5f9;
    filter: grayscale(0.2);
    opacity: 0.85;
}
.emoji-btn.active {
    transform: scale(1.25);
    border-color: #a7f3d0;
    background: linear-gradient(135deg, #fef08a 0%, #86efac 100%);
    box-shadow: 0 10px 20px -3px rgba(134, 239, 172, 0.4),
                0 0 0 8px rgba(134, 239, 172, 0.15),
                0 0 0 16px rgba(134, 239, 172, 0.08),
                0 0 0 24px rgba(134, 239, 172, 0.03);
    filter: grayscale(0);
    opacity: 1;
}

.emoji-label {
    position: absolute;
    top: 68px;
    left: 50%;
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    z-index: 10;
}
.emoji-label::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: transparent transparent #1e293b transparent;
}
.emoji-btn:hover + .emoji-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Show active tooltip by default if row is not hovered */
.emojis-row:not(:hover) .emoji-btn.active + .emoji-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Hide the active tooltip if the row is hovered but not on the hovered item itself */
.emojis-row:hover .emoji-label {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
}
.emojis-row .emoji-item:hover .emoji-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.feedback-comment-wrapper {
    width: 100%;
    margin-top: 12px;
    margin-bottom: 24px;
    text-align: left;
}
.feedback-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 120px;
    box-sizing: border-box;
    background: #f8fafc;
}
.feedback-textarea:focus {
    border-color: #10b981;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

/* Image-based icon overrides */
.category-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}
.emoji-btn img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    pointer-events: none;
    transition: transform 0.3s ease;
}

