/* ============================================================
   ThasanAI Job Finder — Mobile-First, Full-Page Layout
   ============================================================ */

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

:root {
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-300: #86efac;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-green: 0 8px 32px -8px rgba(22, 163, 74, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

::selection { background: var(--green-100); color: var(--green-700); }
.text-green { color: var(--green-600); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    padding: 40px 20px 0;
    text-align: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--green-600);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 13px;
}

.brand-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--gray-900);
}

.brand-accent { color: var(--green-600); }

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.15;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.page-desc {
    font-size: 0.88rem;
    color: var(--gray-500);
    max-width: 340px;
    margin: 0 auto;
}

/* ============================================================
   SEARCH SECTION — full width, no card
   ============================================================ */
.search-section {
    padding: 28px 20px 32px;
}

.search-form {
    max-width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
}

.label-text {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gray-400);
}

.input-wrapper,
.select-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--gray-400);
    transition: color 0.2s var(--ease);
    pointer-events: none;
}

.form-group input {
    width: 100%;
    padding: 14px 14px 14px 40px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-900);
    transition: all 0.2s var(--ease);
}

.form-group input::placeholder { color: var(--gray-400); }

.form-group input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.input-wrapper:focus-within .input-icon { color: var(--green-600); }

.form-group select {
    width: 100%;
    padding: 14px 36px 14px 14px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-700);
    appearance: none;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.form-group select:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--gray-400);
    pointer-events: none;
    transition: color 0.2s var(--ease);
}

.select-wrapper:focus-within .select-arrow { color: var(--green-600); }

/* Search Button */
.search-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    box-shadow: var(--shadow-green);
}

.search-btn:hover {
    background: var(--green-700);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px -8px rgba(22, 163, 74, 0.4);
}

.search-btn:active { transform: translateY(0); }

.search-btn i {
    font-size: 15px;
    transition: transform 0.25s var(--ease);
}

.search-btn:hover i { transform: scale(1.15); }

/* ============================================================
   LOADING
   ============================================================ */
.loading {
    padding: 60px 20px;
    display: flex;
    justify-content: center;
}

.loading-container { text-align: center; }

.loading-spinner {
    position: relative;
    width: 68px;
    height: 68px;
    margin: 0 auto 24px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--green-50);
    border-radius: 50%;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--green-600);
    animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(2) {
    inset: 7px;
    border-right-color: var(--green-400);
    animation: spin 1.5s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
    inset: 14px;
    border-bottom-color: var(--green-300);
    animation: spin 1s linear infinite;
}

.spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--green-600);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 14px;
}

.loading-bar {
    width: 180px;
    height: 3px;
    background: var(--gray-200);
    border-radius: 3px;
    margin: 0 auto;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, var(--green-400), var(--green-600));
    border-radius: 3px;
    animation: barSlide 1.4s ease-in-out infinite;
}

@keyframes barSlide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(380%); }
}

/* ============================================================
   RESULTS
   ============================================================ */
.results-section {
    padding: 8px 20px 40px;
}

.results-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.results-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

.results-subtitle {
    font-size: 0.82rem;
    color: var(--gray-400);
}

.job-count {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--green-50);
    color: var(--green-700);
    border: 1px solid var(--green-100);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
}

/* Jobs Grid */
.jobs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

/* ============================================================
   JOB CARD
   ============================================================ */
.job-card {
    background: var(--white);
    border: 1.5px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.25s var(--ease);
    position: relative;
}

.job-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--green-400), var(--green-600));
    border-radius: 3px 0 0 3px;
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.job-card:hover {
    border-color: var(--green-200);
    box-shadow: 0 8px 28px -6px rgba(22, 163, 74, 0.1);
    transform: translateY(-3px);
}

.job-card:hover::before { opacity: 1; }

/* Card Header */
.job-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.company-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--gray-100);
    background: var(--gray-50);
    flex-shrink: 0;
}

.company-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--green-50);
    border: 1px solid var(--green-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--green-600);
    flex-shrink: 0;
    transition: all 0.25s var(--ease);
}

.job-card:hover .company-logo-placeholder {
    background: var(--green-600);
    color: var(--white);
    border-color: var(--green-600);
}

.job-info { flex: 1; min-width: 0; }

.job-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
    margin-bottom: 3px;
    transition: color 0.2s var(--ease);
}

.job-card:hover .job-info h3 { color: var(--green-600); }

.job-info .company {
    font-size: 0.82rem;
    color: var(--gray-500);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-info .company::before {
    content: '';
    width: 5px;
    height: 5px;
    background: var(--green-400);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Detail Chips */
.job-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.detail-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--gray-50);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 500;
}

.detail-chip i { font-size: 0.62rem; color: var(--gray-400); }

.salary-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--green-700);
}

.salary-chip i { font-size: 0.62rem; }

/* Card Actions */
.job-actions {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-50);
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--ease);
}

.btn-primary {
    background: var(--gray-900);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--green-600);
    box-shadow: var(--shadow-green);
}

.btn-secondary {
    background: var(--gray-50);
    color: var(--gray-600);
    border: 1px solid var(--gray-100);
}

.btn-secondary:hover {
    background: var(--green-50);
    color: var(--green-700);
    border-color: var(--green-200);
}

/* ============================================================
   ERROR
   ============================================================ */
.error-section {
    padding: 40px 20px;
}

.error-card {
    text-align: center;
    padding: 40px 24px;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
}

.error-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #fef2f2;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #ef4444;
}

.error-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.error-card p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 20px;
}

.error-btn {
    display: inline-flex;
    padding: 10px 24px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.error-btn:hover { background: var(--green-700); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 12px 24px;
    background: var(--gray-900);
    color: var(--white);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s var(--ease);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast i { color: var(--green-400); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
    .job-card { animation: fadeInUp 0.4s ease-out both; }
    .job-card:nth-child(1) { animation-delay: 0.02s; }
    .job-card:nth-child(2) { animation-delay: 0.04s; }
    .job-card:nth-child(3) { animation-delay: 0.06s; }
    .job-card:nth-child(4) { animation-delay: 0.08s; }
    .job-card:nth-child(5) { animation-delay: 0.1s; }
    .job-card:nth-child(6) { animation-delay: 0.12s; }
    .job-card:nth-child(7) { animation-delay: 0.14s; }
    .job-card:nth-child(8) { animation-delay: 0.16s; }
    .job-card:nth-child(9) { animation-delay: 0.18s; }
    .job-card:nth-child(10) { animation-delay: 0.2s; }

    .page-header { animation: fadeInUp 0.5s ease-out; }
    .search-form { animation: fadeInUp 0.5s ease-out 0.1s both; }
}

/* ============================================================
   TABLET — 640px+
   ============================================================ */
@media (min-width: 640px) {
    .page-header { padding: 48px 24px 0; }
    .page-title { font-size: 1.8rem; }
    .page-desc { max-width: 400px; }

    .search-section { padding: 32px 24px 36px; }

    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }

    .jobs-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .results-section { padding: 12px 24px 48px; }

    .results-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* ============================================================
   DESKTOP — 1024px+
   ============================================================ */
@media (min-width: 1024px) {
    .page-header {
        padding: 56px 40px 0;
        max-width: 960px;
        margin: 0 auto;
    }

    .page-title { font-size: 2.2rem; }
    .page-desc { font-size: 0.95rem; max-width: 480px; }

    .search-section {
        padding: 36px 40px 44px;
        max-width: 960px;
        margin: 0 auto;
    }

    .form-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .form-group-full {
        grid-column: 1 / 3;
    }

    .search-btn {
        padding: 18px;
        border-radius: var(--radius-lg);
    }

    .results-section {
        padding: 16px 40px 60px;
        max-width: 960px;
        margin: 0 auto;
    }

    .jobs-grid {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }

    .job-card { padding: 24px; }
    .error-section { max-width: 960px; margin: 0 auto; }
}

/* ============================================================
   WIDE DESKTOP — 1280px+
   ============================================================ */
@media (min-width: 1280px) {
    .page-header,
    .search-section,
    .results-section,
    .error-section {
        max-width: 1100px;
    }

    .jobs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
