/* ===========================================================
   TechSpot Design System
   Colors:  Purple #6D28D9 (primary) / #4C1D95 (deep) / #F5F3FF (tint)
            White #FFFFFF, Ink #1E1B2E, Gray #6B7280
   Type:    Sora (display) + Inter (body)
   =========================================================== */

:root {
    --purple: #6D28D9;
    --purple-dark: #4C1D95;
    --purple-light: #F5F3FF;
    --purple-mid: #A78BFA;
    --white: #FFFFFF;
    --ink: #1E1B2E;
    --gray: #6B7280;
    --gray-light: #E5E1F2;
    --success: #16A34A;
    --success-bg: #ECFDF3;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(76, 29, 149, 0.08);
    --shadow-lg: 0 16px 48px rgba(76, 29, 149, 0.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 .5em;
    color: var(--ink);
}

p { margin: 0 0 1em; color: var(--gray); }

a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--purple-dark); }

img { max-width: 100%; display: block; }

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

.section { padding: 64px 0; }

:focus-visible {
    outline: 3px solid var(--purple-mid);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}
.btn:active {
    transform: translateY(-1px) scale(0.97);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-primary { background: var(--purple); color: var(--white); box-shadow: 0 6px 18px rgba(109,40,217,.28); }
.btn-primary:hover { background: var(--purple-dark); color: var(--white); }

.btn-ghost { background: transparent; color: var(--purple); border: 1.5px solid var(--gray-light); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple-dark); }

.btn-white { background: var(--white); color: var(--purple-dark); }
.btn-white:hover { background: var(--purple-light); color: var(--purple-dark); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }

.btn-block { width: 100%; }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }

.inline-form { display: inline-block; }

/* ---------- Header / Nav ---------- */
.site-header {
    border-bottom: 1px solid var(--gray-light);
    position: sticky;
    top: 0;
    background: #ffffff; /* FIXED: Solid background */
    backdrop-filter: blur(8px);
    z-index: 1000; /* FIXED: Higher z-index so map never overlaps header */
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    padding-bottom: 16px;
}
.logo {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.logo span { color: var(--purple); }

.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { color: var(--ink); font-weight: 500; font-size: 0.95rem; }
.main-nav a:hover { color: var(--purple); }
.nav-user { color: var(--gray); font-size: 0.9rem; }
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--purple, #6D28D9);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

/* ---------- Flash messages ---------- */
.flash {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
}
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 48px; background: linear-gradient(180deg, var(--purple-light) 0%, var(--white) 100%); }
.hero-inner {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 48px;
    align-items: center;
}
.eyebrow {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple-dark);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 16px;
    letter-spacing: .02em;
}
.hero-copy h1 { font-size: 2.7rem; letter-spacing: -0.02em; }
.hero-sub { font-size: 1.05rem; max-width: 46ch; }

.hero-search {
    display: flex;
    gap: 10px;
    background: var(--white);
    padding: 8px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    max-width: 480px;
    margin-bottom: 32px;
}
.hero-search input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-family: inherit;
}

.hero-stats { display: flex; gap: 32px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: 'Sora', sans-serif; font-size: 1.4rem; color: var(--purple-dark); }
.hero-stats span { font-size: 0.82rem; color: var(--gray); }

/* Signature element: fanned stack of gig cards */
.hero-visual { position: relative; height: 340px; }
.stack-card {
    position: absolute;
    width: 240px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    left: 50%;
}
.card-back { top: 10px; transform: translateX(-70%) rotate(-9deg); opacity: .7; }
.card-mid { top: 55px; transform: translateX(-42%) rotate(4deg); opacity: .88; }
.card-front { top: 105px; transform: translateX(-58%) rotate(-2deg); }
.stack-tag {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple-dark);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.stack-title { font-family: 'Sora', sans-serif; font-weight: 600; margin-bottom: 8px; }
.stack-price { color: var(--purple); font-weight: 700; }
.stack-rating { color: var(--warning); font-size: 0.85rem; margin-top: 6px; }

/* ---------- Category chips ---------- */
.categories-strip { padding: 32px 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    background: var(--purple-light);
    color: var(--purple-dark);
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background .15s ease;
}
.chip:hover { background: var(--purple-mid); color: var(--white); }

/* ---------- Section headers ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head-spaced { margin-top: 56px; }
.link-arrow { font-weight: 600; font-size: 0.92rem; }
.page-head { margin-bottom: 32px; }
.page-head p { font-size: 1.02rem; }

/* ---------- Gig cards / grid ---------- */
.gig-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}
.gig-card {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 22px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    opacity: 0;
    transform: translateY(20px);
    animation: cardFadeIn 0.6s ease forwards;
}
.gig-card:hover { 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-8px) scale(1.015);
    border-color: var(--purple);
}

.gig-card img {
    transition: transform 0.4s ease;
}

.gig-card:hover img {
    transform: scale(1.05);
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered entrance animation for gig cards */
.gig-grid .gig-card:nth-child(1) { animation-delay: 0.1s; }
.gig-grid .gig-card:nth-child(2) { animation-delay: 0.2s; }
.gig-grid .gig-card:nth-child(3) { animation-delay: 0.3s; }
.gig-grid .gig-card:nth-child(4) { animation-delay: 0.4s; }
.gig-grid .gig-card:nth-child(5) { animation-delay: 0.5s; }
.gig-grid .gig-card:nth-child(6) { animation-delay: 0.6s; }
.gig-card h3 { font-size: 1.08rem; margin: 6px 0 4px; color: var(--ink); }
.gig-card-top { margin-bottom: 4px; }
.gig-category {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple-dark);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}
.gig-provider { font-size: 0.86rem; color: var(--gray); margin-bottom: 14px; }
.gig-card-bottom { display: flex; align-items: center; justify-content: space-between; }
.gig-price { font-weight: 700; color: var(--purple-dark); font-family: 'Sora', sans-serif; }
.gig-rating { font-size: 0.82rem; color: var(--warning); }
.gig-rating-new { color: var(--gray); font-style: italic; }
.gig-card-owned { display: flex; flex-direction: column; }
.owned-actions { display: flex; gap: 8px; margin-top: 14px; }

.empty-note { background: var(--purple-light); padding: 18px 20px; border-radius: 10px; color: var(--gray); }
.result-count { font-size: 0.88rem; margin-bottom: 18px; }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
    padding: 12px 16px;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
}
.filter-bar input { flex: 1; min-width: 200px; }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step-num { font-family: 'Sora', sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--purple-mid); }
.step h3 { margin-top: 6px; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--purple-dark); padding: 56px 0; margin-top: 24px; }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta-inner h2, .cta-inner p { color: var(--white); }
.cta-inner p { color: rgba(255,255,255,.78); margin-bottom: 0; }

/* ---------- Auth forms ---------- */
.auth-section { padding: 56px 0 88px; }
.auth-container { display: flex; justify-content: center; }
.auth-card {
    background: var(--white);
    border: 1px solid var(--gray-light);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}
.auth-card-wide { max-width: 620px; }
.auth-sub { margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-weight: 600; font-size: 0.88rem; margin-top: 10px; }
.auth-form .optional { font-weight: 400; color: var(--gray); }
.auth-form input, .auth-form select, .auth-form textarea {
    padding: 12px 14px;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.12);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}
.auth-form button { margin-top: 20px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 0.9rem; }

.role-toggle { display: flex; gap: 10px; margin-bottom: 10px; }
.role-option {
    flex: 1;
    border: 1.5px solid var(--gray-light);
    border-radius: 10px;
    padding: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.role-option.active { border-color: var(--purple); background: var(--purple-light); color: var(--purple-dark); }
.role-option input { margin-right: 6px; }

.star-select { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; font-size: 1.6rem; }
.star-select input { display: none; }
.star-select label { color: var(--gray-light); cursor: pointer; }
.star-select input:checked ~ label,
.star-select label:hover,
.star-select label:hover ~ label { color: var(--warning); }

/* ---------- Details page ---------- */
.link-back { display: inline-block; margin-bottom: 20px; font-weight: 500; font-size: 0.9rem; }
.details-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; }
.details-main h1 { margin-top: 10px; font-size: 1.8rem; }
.details-meta { margin: 10px 0 24px; }
.details-desc { white-space: pre-line; }
.review-list { display: flex; flex-direction: column; gap: 16px; }
.review-item { border: 1px solid var(--gray-light); border-radius: 10px; padding: 16px 18px; }
.review-top { display: flex; justify-content: space-between; margin-bottom: 6px; }

.price-card, .provider-card {
    background: var(--purple-light);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.price-tag { font-family: 'Sora', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--purple-dark); margin-bottom: 16px; }
.provider-name { font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.provider-bio { font-size: 0.9rem; }
.other-gigs { list-style: none; padding: 0; margin: 0; font-size: 0.88rem; }
.other-gigs li { padding: 6px 0; border-top: 1px solid rgba(109,40,217,.12); }

/* ---------- Dashboard / hire cards ---------- */
.hire-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.hire-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 20px 24px;
    flex-wrap: wrap;
}
.hire-card-main h3 { margin: 6px 0 2px; font-size: 1.05rem; }
.hire-meta { font-size: 0.86rem; margin: 0; }
.hire-card-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.status-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 4px 10px;
    border-radius: 999px;
}
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-active { background: var(--purple-light); color: var(--purple-dark); }
.status-completed { background: var(--success-bg); color: var(--success); }
.status-declined { background: var(--danger-bg); color: var(--danger); }
.status-denied { background: var(--danger-bg); color: var(--danger); }
.status-waiting_payment { background: #dbeafe; color: #1d4ed8; }
.status-approved { background: #dbeafe; color: #1d4ed8; }
.status-processing { background: #dbeafe; color: #1d4ed8; }
.status-otp_required { background: var(--warning-bg); color: var(--warning); }
.status-paid { background: var(--success-bg); color: var(--success); }
.status-rejected { background: var(--danger-bg); color: var(--danger); }
.status-failed { background: var(--danger-bg); color: var(--danger); }

.waiting-note { font-size: 0.86rem; color: var(--gray); font-style: italic; }
.reviewed-note { font-size: 0.86rem; color: var(--success); font-weight: 600; }

/* ---------- Messaging thread ---------- */
.thread-card {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    overflow: hidden;
}
.thread-head { background: var(--purple-light); padding: 18px 24px; }
.thread-head h2 { margin: 0 0 2px; font-size: 1.15rem; }
.thread-head p { margin: 0; font-size: 0.86rem; }
.thread-messages { padding: 24px; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.message-bubble { max-width: 70%; padding: 10px 16px; border-radius: 14px; }
.message-bubble p { margin: 4px 0 0; color: inherit; }
.message-sender { font-size: 0.72rem; font-weight: 700; opacity: .7; }
.message-time { display: block; font-size: 0.68rem; opacity: .6; margin-top: 4px; }
.message-mine { background: var(--purple); color: var(--white); align-self: flex-end; }
.message-theirs { background: var(--purple-light); color: var(--ink); align-self: flex-start; }
.thread-form { display: flex; gap: 12px; padding: 18px 24px; border-top: 1px solid var(--gray-light); }
.thread-form textarea {
    flex: 1;
    resize: none;
    padding: 12px 14px;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    font-family: inherit;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--purple-dark); color: rgba(255,255,255,.85); margin-top: 64px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 56px 24px; }
.footer-brand p { color: rgba(255,255,255,.65); max-width: 32ch; }
.footer-col h4 { color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.footer-col a { display: block; color: rgba(255,255,255,.75); margin-bottom: 8px; font-size: 0.92rem; }
.footer-col a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 18px 0; font-size: 0.82rem; color: rgba(255,255,255,.6); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .gig-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: 1fr; }
    .details-layout { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 24px 24px;
        gap: 14px;
        border-bottom: 1px solid var(--gray-light);
        display: none;
    }
    .main-nav.open { display: flex; }
    .gig-grid { grid-template-columns: 1fr; }
    .hero-copy h1 { font-size: 2rem; }
    .cta-inner { flex-direction: column; align-items: flex-start; }
    .hire-card { flex-direction: column; align-items: flex-start; }
}

/* ===========================================================
   Phase 1: Fluid Animations & Improved Signup
   =========================================================== */

/* Form grid for two-column fields */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* Enhanced role toggle with smooth swap animation */
.role-toggle {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.role-option {
    flex: 1;
    border: 2px solid var(--gray-light);
    border-radius: 16px;
    padding: 22px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--white);
    position: relative;
    overflow: hidden;
}

.role-option:hover {
    border-color: var(--purple-mid);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.12);
}

.role-option.active {
    border-color: var(--purple);
    background: var(--purple-light);
    color: var(--purple-dark);
    box-shadow: 0 10px 25px rgba(109, 40, 217, 0.25);
    transform: scale(1.03);
}

.role-option strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.role-option small {
    color: #666;
    font-size: 0.82rem;
}

/* Active indicator line animation */
.role-option.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--purple);
    animation: slideIn 0.4s ease forwards;
}

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

/* Fluid animations for auth forms */
.auth-form input,
.auth-form select,
.auth-form textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.1);
    transform: translateY(-1px);
}

/* Staggered fade-in animation for form elements */
.auth-form > * {
    animation: fadeSlideUp 0.4s ease forwards;
    opacity: 0;
}
.auth-form > *:nth-child(1) { animation-delay: 0.05s; }
.auth-form > *:nth-child(2) { animation-delay: 0.1s; }
.auth-form > *:nth-child(3) { animation-delay: 0.15s; }
.auth-form > *:nth-child(4) { animation-delay: 0.2s; }
.auth-form > *:nth-child(5) { animation-delay: 0.25s; }

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

/* Homepage hero enhancement - richer background with relevant image */
.hero {
    background: linear-gradient(rgba(245, 243, 255, 0.88), rgba(237, 233, 254, 0.82)), 
                url('../images/hero-students.jpg') center/cover no-repeat;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(109,40,217,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Subtle animation on hero stats */
.hero-stats div {
    transition: transform 0.3s ease;
}
.hero-stats div:hover {
    transform: translateY(-3px);
}

/* Required field indicator */
.required {
    color: var(--danger);
    font-weight: 700;
}
