:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #f97316;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

/* Layout stability: stop left-then-center jump and horizontal shake */
html {
    width: 100%;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ========== HEADER ========== */
.header {
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 100%;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Make ALL navigation links look the same (no permanent blue highlight on Login) */
.nav a,
.nav a.btn-primary,
.nav a.btn-secondary,
.nav a.btn-small {
    color: var(--text) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    background: transparent !important;
    border: none !important;
    transition: all 0.2s !important;
    display: inline-block !important;
    box-shadow: none !important;
}

.nav a:hover,
.nav a.btn-primary:hover,
.nav a.btn-secondary:hover {
    color: var(--primary) !important;
    background: #eff6ff !important;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    z-index: 120;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

/* ========== BUTTONS (for the rest of the site) ========== */
.btn-primary, .btn-secondary, .btn-small, .btn-whatsapp, .btn-report {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.875rem;
    background: var(--primary);
    color: white;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
}

.btn-whatsapp:hover {
    background: #128c7e;
}

.btn-report {
    background: transparent;
    color: var(--error);
    border: 2px solid var(--error);
    font-size: 0.85rem;
}

.btn-report:hover {
    background: var(--error);
    color: white;
}

.btn-close-job {
    background: var(--error);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-close-job:hover {
    background: #b91c1c;
}

.full {
    width: 100%;
}

/* ========== HERO CAROUSEL – brighter images + readable text ========== */
.hero-carousel {
    position: relative;
    height: 520px;
    overflow: hidden;
    width: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.35) 50%,
        rgba(0, 0, 0, 0.45) 100%
    );
}

.carousel-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #ffffff;
    padding: 28px 32px;
    max-width: 820px;
    background: rgba(0, 0, 0, 0.42);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.carousel-content h1,
.carousel-content h2 {
    font-size: 2.8rem;
    margin-bottom: 16px;
    color: #ffffff !important;
    text-shadow:
        0 2px 10px rgba(0, 0, 0, 0.85),
        0 1px 3px rgba(0, 0, 0, 0.9);
    font-weight: 700;
}

.carousel-content p {
    font-size: 1.25rem;
    opacity: 1;
    margin-bottom: 28px;
    color: #f8fafc !important;
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.8),
        0 1px 2px rgba(0, 0, 0, 0.9);
}

.carousel-dots {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 3;
}

.carousel-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.2);
}

/* ========== SECTIONS ========== */
section {
    padding: 60px 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--text);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    min-height: 120px;
}

.category-card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.category-card h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.category-card p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.worker-grid, .job-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    min-height: 120px;
}

.worker-card, .job-card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    text-align: center;
}

.worker-card:hover, .job-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.worker-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.worker-card h3, .job-card h3 {
    margin-bottom: 4px;
}

.worker-category, .job-category {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.worker-location, .job-location {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.worker-rating {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.job-budget {
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.job-status {
    display: inline-block;
    padding: 4px 14px;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.how-it-works {
    background: white;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    text-align: center;
}

.step-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.step h3 {
    margin-bottom: 8px;
}

.footer {
    background: var(--text);
    color: white;
    text-align: center;
    padding: 24px;
    width: 100%;
}

/* ========== AUTH / FORMS ========== */
.auth-page {
    padding: 40px 20px;
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.auth-box {
    max-width: 480px;
    margin: 0 auto;
    background: var(--card);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Password show/hide support (used on login.html) */
.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrap input {
    width: 100%;
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 4px 8px;
    line-height: 1;
}

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

.message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.message.error {
    display: block;
    background: #fef2f2;
    color: var(--error);
}

.message.success {
    display: block;
    background: #f0fdf4;
    color: var(--success);
}

.message.warning {
    display: block;
    background: #fffbeb;
    color: var(--warning);
}

/* ========== SEARCH / JOBS ========== */
.search-page, .jobs-page {
    padding: 40px 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.search-filters, .jobs-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.search-filters input,
.search-filters select,
.jobs-filters input,
.jobs-filters select {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

/* ========== PROFILE / JOB DETAIL ========== */
.profile-page, .job-detail-page {
    padding: 40px 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.profile-header, .job-detail-header {
    display: flex;
    gap: 24px;
    align-items: center;
    background: var(--card);
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h1, .job-detail-header h1 {
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-category, .job-detail-category {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.125rem;
}

.profile-location, .job-detail-location {
    color: var(--text-light);
    margin: 4px 0;
}

.profile-rating {
    margin-top: 8px;
}

.profile-body, .job-detail-body {
    display: grid;
    gap: 24px;
}

.profile-section, .job-description, .apply-section, .client-info {
    background: var(--card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-section h3, .job-description h3, .apply-section h3, .client-info h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.profile-section a {
    margin-top: 12px;
    margin-right: 12px;
}

.review {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.review:last-child {
    border-bottom: none;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.loading, .empty, .error {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.error {
    color: var(--error);
}

.job-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-light);
    margin-bottom: 16px;
}

.job-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.apply-section {
    text-align: center;
}

.apply-section p {
    margin-bottom: 16px;
    color: var(--text-light);
}

/* ========== DASHBOARD ========== */
.dashboard-page {
    padding: 40px 20px;
    min-height: calc(100vh - 64px);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.dashboard-page h1 {
    margin-bottom: 32px;
    font-size: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.dashboard-section {
    background: var(--card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text);
    text-align: left;
}

.job-row, .dispute-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: #fff;
    flex-wrap: wrap;
}

.empty-dashboard {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-available {
    background: #dcfce7;
    color: #166534;
}

.status-closed {
    background: #fee2e2;
    color: #991b1b;
}

/* ========== ADMIN ========== */
.admin-page {
    padding: 40px 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 1.8rem;
    margin-bottom: 4px;
    color: var(--primary);
}

.stat-card p {
    color: var(--text-light);
    font-size: 0.85rem;
}

.admin-section {
    background: var(--card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    text-align: left;
}

/* ========== NOTIFICATIONS ========== */
.nav-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    flex-shrink: 0;
}

.nav-bell:hover {
    background: #eff6ff;
}

.bell-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--error);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 18px;
    box-sizing: border-box;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 64px;
    right: 20px;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 200;
}

.notification-dropdown.active {
    display: block;
}

.notification-header {
    padding: 14px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.notification-list {
    padding: 8px;
}

.notification-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
}

.notification-item:hover {
    background: #f1f5f9;
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-msg {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.notification-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
}

/* ========== SHARE FAB ========== */
.share-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    z-index: 90;
}

.share-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

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

.share-modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.share-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.share-btn {
    flex: 1;
    text-align: center;
    min-width: 100px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
        pointer-events: auto !important;
    }

    .nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        gap: 4px;
        z-index: 110;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    .nav.active {
        display: flex !important;
    }

    .nav a,
    .nav a.btn-primary,
    .nav a.btn-secondary {
        width: 100%;
        text-align: left;
        padding: 12px 16px !important;
    }

    .hero-carousel {
        height: 420px;
    }

    .carousel-content {
        padding: 20px 18px;
        margin: 0 12px;
    }

    .carousel-content h1,
    .carousel-content h2 {
        font-size: 1.8rem;
    }

    .carousel-content p {
        font-size: 1rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    /* Prevent filter bar from forcing horizontal scroll / shake */
    .search-filters,
    .jobs-filters {
        flex-direction: column;
    }

    .search-filters input,
    .search-filters select,
    .jobs-filters input,
    .jobs-filters select {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }

    .worker-grid,
    .job-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== ADMIN SECTION NAV (buttons, sticky) — ADDED ========== */
.admin-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 64px;
    z-index: 90;
    background: var(--card);
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-nav-btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    transition: all 0.2s;
}

.admin-nav-btn:hover {
    background: #eff6ff;
    color: var(--primary);
    border-color: var(--primary);
}

.admin-nav-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.admin-back-top {
    margin-top: 16px;
    text-align: right;
}

.admin-back-top a {
    color: var(--primary);
    font-size: 0.9rem;
    text-decoration: none;
}

@media (max-width: 768px) {
    .admin-section-nav {
        top: 64px;
        gap: 6px;
    }
    .admin-nav-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}
