/*
 * ExpertConnect - Premium Style System
 * Implements modern responsive grid structures, dark/light modes,
 * and high-fidelity custom design systems.
 */

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

:root {
    /* Color Palette - Light Mode */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: rgba(37, 99, 235, 0.1);
    
    --secondary: #0F172A;
    --secondary-hover: #1E293B;
    
    --accent: #14B8A6;
    --accent-hover: #0D9488;
    --accent-light: rgba(20, 184, 166, 0.1);
    
    --bg-main: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F1F5F9;
    
    --border-color: #E2E8F0;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-on-primary: #FFFFFF;
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-success-light: rgba(16, 185, 129, 0.1);
    --color-warning: #F59E0B;
    --color-warning-light: rgba(245, 158, 11, 0.1);
    --color-danger: #EF4444;
    --color-danger-light: rgba(239, 68, 68, 0.1);
    --color-info: #3B82F6;
    --color-info-light: rgba(59, 130, 246, 0.1);
    
    /* Layout Constants */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-premium: 0 20px 25px -5px rgba(37, 99, 235, 0.05), 0 10px 10px -5px rgba(37, 99, 235, 0.02);
    --max-width: 1280px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-main: #0B0F19;
    --bg-surface: #1E293B;
    --bg-surface-hover: #334155;
    
    --border-color: #334155;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    
    --secondary: #FFFFFF;
    --secondary-hover: #E2E8F0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-premium: 0 20px 25px -5px rgba(0,0,0,0.45);
}

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

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-hover);
}

/* Core Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Dashboard Header */
.dashboard-header {
    margin: 40px 0 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Navigation Bar */
header.site-header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}
[data-theme="dark"] header.site-header {
    background-color: rgba(11, 15, 25, 0.8);
}

header .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 95px;
}

header .brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 4px 0;
}
header .brand img {
    height: 75px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.2s ease;
}
header .brand img:hover {
    opacity: 0.85;
}

header .nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

header .nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}
header .nav-links a:hover, header .nav-links a.active {
    color: var(--primary);
}

header .nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Common Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}
.btn-primary {
    background-color: var(--primary);
    color: var(--text-on-primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    color: var(--text-on-primary);
}
.btn-secondary {
    background-color: var(--secondary);
    color: var(--bg-surface);
}
.btn-secondary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
}
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-muted);
}
.btn-accent {
    background-color: var(--accent);
    color: #FFFFFF;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-icon:hover {
    background-color: var(--bg-surface-hover);
}

/* Hero Section */
.hero {
    padding: 80px 0 60px 0;
    text-align: center;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.05), transparent 60%),
                radial-gradient(circle at bottom left, rgba(20, 184, 166, 0.05), transparent 60%);
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}
.hero h1 span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 auto 40px auto;
}

/* Search Box Container */
.search-container {
    max-width: 760px;
    margin: 0 auto;
    background-color: var(--bg-surface);
    padding: 8px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}
.search-container input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-main);
}
.search-container .search-icon {
    display: flex;
    align-items: center;
    padding-left: 16px;
    color: var(--text-muted);
}

/* Home Stats Banner */
.stats-banner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 50px 0;
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.stat-card {
    text-align: center;
}
.stat-card h3 {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}
.stat-card p {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Category grid */
.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.grid-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}
.category-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.category-card .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.category-card h3 {
    font-size: 18px;
    font-weight: 600;
}
.category-card p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Expert Cards Grid */
.grid-experts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}
.expert-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.expert-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.expert-card .card-header {
    padding: 24px;
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}
.expert-card .avatar-wrapper {
    position: relative;
}
.expert-card img.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}
.expert-card .verified-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--bg-surface);
}
.expert-card .header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.expert-card .name {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
}
.expert-card .title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.expert-card .rating {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.expert-card .rating i {
    color: #F59E0B;
}

.expert-card .card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.expert-card .bio {
    font-size: 14px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.expert-card .skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.expert-card .tag {
    font-size: 11px;
    font-weight: 500;
    background-color: var(--bg-surface-hover);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
}

.expert-card .card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(248, 250, 252, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
[data-theme="dark"] .expert-card .card-footer {
    background-color: rgba(30, 41, 59, 0.4);
}
.expert-card .rate {
    font-size: 14px;
    color: var(--text-muted);
}
.expert-card .rate span {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* Directory Page Layout */
.directory-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    margin: 40px 0;
    align-items: start;
}
.filter-sidebar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    position: sticky;
    top: 96px;
}
.filter-group {
    margin-bottom: 20px;
}
.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-group select, .filter-group input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}
.filter-group select:focus, .filter-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Detail Page Layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    margin: 40px 0;
}
.detail-main {
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.profile-hero {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px;
    display: flex;
    gap: 32px;
    position: relative;
}
.profile-hero img.large-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}
.profile-hero .hero-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}
.profile-hero h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--secondary);
    margin-bottom: 6px;
}
.profile-hero .headline {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.profile-hero .meta-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.profile-hero .meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}
.profile-hero .meta-item i {
    color: var(--primary);
}

.profile-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
}
.profile-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--secondary);
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

/* Sidebar Calendar Card */
.booking-sticky-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.booking-sticky-card .price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.booking-sticky-card .price {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

/* Review Styles */
.review-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}
.review-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}
.reviewer-name {
    font-weight: 600;
    font-size: 14px;
}
.review-stars {
    color: #F59E0B;
}
.review-text {
    font-size: 14px;
    color: var(--text-muted);
}

/* Form Styles */
.form-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px;
    max-width: 600px;
    margin: 40px auto;
}
.form-card h2 {
    font-size: 24px;
    margin-bottom: 24px;
    font-weight: 700;
    text-align: center;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}
.dash-stat-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.dash-stat-box .icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.dash-stat-box .info {
    display: flex;
    flex-direction: column;
}
.dash-stat-box .num {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff !important;
}
.dash-stat-box .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

/* Tables */
.table-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table-card .card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 16px;
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.data-table th, table.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
table.data-table th {
    background-color: rgba(248, 250, 252, 0.6);
    color: var(--text-muted);
    font-weight: 600;
}
[data-theme="dark"] table.data-table th {
    background-color: rgba(30, 41, 59, 0.6);
}
table.data-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-pending {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}
.badge-accepted {
    background-color: var(--color-info-light);
    color: var(--color-info);
}
.badge-completed {
    background-color: var(--color-success-light);
    color: var(--color-success);
}
.badge-rejected, .badge-cancelled {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}
.badge-paid {
    background-color: var(--accent-light);
    color: var(--accent);
}
.badge-unpaid {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 600px;
    margin: 30px 0;
}
.chat-sidebar {
    background-color: var(--bg-surface);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.chat-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}
.chat-user-item:hover, .chat-user-item.active {
    background-color: var(--bg-surface-hover);
}
.chat-user-item img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.chat-user-item .info {
    flex: 1;
    overflow: hidden;
}
.chat-user-item .name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-user-item .snippet {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-area {
    background-color: var(--bg-surface);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}
.chat-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: var(--bg-main);
}
.message-bubble {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}
.message-bubble.incoming {
    align-self: flex-start;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}
.message-bubble.outgoing {
    align-self: flex-end;
    background-color: var(--primary);
    color: var(--text-on-primary);
    border-bottom-right-radius: 2px;
}
.chat-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}
.chat-input-wrapper {
    display: flex;
    gap: 12px;
}
.chat-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-main);
    outline: none;
}
.chat-input-wrapper input:focus {
    border-color: var(--primary);
}

/* Notifications Dropdown / List */
.notification-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}
.notification-item.unread {
    border-left: 4px solid var(--primary);
    background-color: rgba(37, 99, 235, 0.02);
}
.notification-text {
    flex: 1;
}
.notification-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}
.notification-text p {
    font-size: 13px;
    color: var(--text-muted);
}
.notification-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Footer Section */
footer.site-footer {
    margin-top: 80px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    padding: 48px 0;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* Responsive Helper Classes (used by PHP pages) */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.booking-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.avail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
}
.cta-heading { font-size: 32px; }

/* Payment page: 2-col layout on desktop */
.payment-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}
.payment-providers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* Expert profile: experience/certs side-by-side on desktop */
.exp-certs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* =============================================
   RESPONSIVE DESIGN SYSTEM
   Breakpoints:
   - xs: < 400px   (Small phones)
   - sm: < 576px   (Phones)
   - md: < 768px   (Large phones / small tablets)
   - lg: < 992px   (Tablets)
   - xl: < 1200px  (Small desktops)
============================================= */

/* ==========================================
   MOBILE HAMBURGER MENU — always hidden on desktop
========================================== */
.mobile-menu-btn { display: none !important; }
.nav-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 98;
}
.nav-mobile-overlay.active { display: block; }


/* ==========================================
   TABLET (≤ 992px)
========================================== */
@media (max-width: 992px) {

    /* Layout grids collapse */
    .directory-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .booking-sticky-card, .filter-sidebar {
        position: relative;
        top: 0;
    }

    /* Filter sidebar becomes collapsible row */
    .filter-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
        padding: 16px;
    }
    .filter-sidebar h3 { grid-column: 1 / -1; margin: 0; }

    /* Hero */
    .hero h1 { font-size: 38px; }
    .hero p  { font-size: 16px; }

    /* Dashboard grid: 2 columns on tablet */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Admin double-column panels */
    div[style*="grid-template-columns: 1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px !important;
    }

    /* Expert profile hero */
    .profile-hero {
        padding: 28px;
        gap: 20px;
    }
    .profile-hero h1 { font-size: 26px; }

    /* Expert grid: 2 columns */
    .grid-experts {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }

    /* Stats banner */
    .stats-banner {
        gap: 16px;
        padding: 24px;
    }

    /* Data tables: allow horizontal scroll */
    .table-card { overflow-x: auto; }
    .data-table { min-width: 600px; }

    /* Exp certs side by side stays */
    .exp-certs-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Payment layout stacks */
    .payment-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}


/* ==========================================
   LARGE PHONES (≤ 768px)
========================================== */
@media (max-width: 768px) {

    /* Container */
    .container { padding: 0 16px; }

    /* Navbar */
    header .navbar { height: 68px; }
    header .brand img { height: 52px; }

    /* Show hamburger */
    .mobile-menu-btn { display: inline-flex !important; }

    /* Nav links become slide-down mobile menu */
    header .nav-links {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        background-color: var(--bg-surface);
        padding: 20px 24px 28px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.18);
        border-bottom: 1px solid var(--border-color);
        gap: 4px;
        z-index: 99;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        animation: slideDown 0.25s ease;
    }
    header .nav-links.active { display: flex; }
    header .nav-links a {
        font-size: 15px;
        font-weight: 600;
        padding: 12px 8px;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        gap: 10px;
    }
    header .nav-links li:last-child a { border-bottom: none; }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Shrink action buttons in nav */
    header .nav-actions { gap: 8px; }
    header .nav-actions .btn-secondary,
    header .nav-actions .btn-primary,
    header .nav-actions .btn-outline {
        padding: 6px 12px;
        font-size: 13px;
    }
    header .nav-actions .btn-icon {
        width: 36px; height: 36px; font-size: 14px;
    }
    header .nav-actions .btn-outline { display: none; } /* hide Login on mobile if logged in */

    /* Hero */
    .hero { padding: 40px 0 28px; }
    .hero h1 { font-size: 28px; letter-spacing: -0.01em; line-height: 1.2; }
    .hero p  { font-size: 14px; margin-bottom: 24px; }

    /* CTA */
    .cta-heading { font-size: 22px !important; }

    /* Helper grids collapse */
    .settings-grid      { grid-template-columns: 1fr; }
    .booking-form-row   { grid-template-columns: 1fr; }
    .avail-row          { grid-template-columns: 1fr; gap: 6px; }
    .exp-certs-grid     { grid-template-columns: 1fr; gap: 16px; }

    /* Search bar stacks */
    .search-container {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    .search-container .btn { width: 100%; justify-content: center; }

    /* Stats banner: single column cards */
    .stats-banner {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    .stat-card {
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 20px;
        display: flex;
        align-items: center;
        gap: 16px;
        text-align: left;
    }
    .stat-card h3 { font-size: 28px; margin: 0; }

    /* Category grid: 2 columns on tablets, 1 on small phones */
    .grid-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    /* Expert grid: 1 column */
    .grid-experts {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Expert profile hero stacks */
    .profile-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px 16px;
        gap: 16px;
    }
    .profile-hero img.large-avatar { width: 96px; height: 96px; }
    .profile-hero h1 { font-size: 22px; margin-bottom: 4px; }
    .profile-hero .meta-row { justify-content: center; gap: 12px; }
    .profile-hero .headline { font-size: 14px; }

    /* Profile cards */
    .profile-card { padding: 20px 16px; }
    .profile-card h2 { font-size: 17px; }

    /* Booking sticky */
    .booking-sticky-card { padding: 20px 16px; gap: 16px; }
    .booking-sticky-card .price { font-size: 24px; }

    /* Section titles */
    .section-title {
        font-size: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Dashboard stat: 2 col on medium phones */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .dash-stat-box { padding: 16px; gap: 12px; }
    .dash-stat-box .icon { width: 44px; height: 44px; font-size: 18px; }
    .dash-stat-box .num  { font-size: 20px; }
    .dash-stat-box .label { font-size: 11px; }

    /* Auth forms */
    .form-card {
        padding: 28px 20px;
        margin: 20px 0;
        border-radius: var(--radius-md);
    }

    /* Notification items */
    .notification-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
    }

    /* Tables scroll */
    .table-card { overflow-x: auto; }
    .data-table { min-width: 560px; }

    /* Chat stacks */
    .chat-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 520px;
    }
    .chat-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border-color); }
    .chat-area { min-height: 380px; }

    /* Payment layout */
    .payment-layout { grid-template-columns: 1fr; gap: 20px; }

    /* Footer */
    footer.site-footer { padding: 28px 0; margin-top: 40px; }
}


/* ==========================================
   SMALL PHONES (≤ 576px)
========================================== */
@media (max-width: 576px) {

    .container { padding: 0 12px; }

    /* Hero very compact */
    .hero h1 { font-size: 24px; }
    .hero p  { font-size: 13px; }

    /* Category: 1 column */
    .grid-categories { grid-template-columns: 1fr; gap: 12px; }

    /* Expert card compact */
    .expert-card .card-body   { padding: 16px; }
    .expert-card .card-header { padding: 16px; }
    .expert-card .card-footer {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .expert-card .card-footer .btn { width: 100%; justify-content: center; }

    /* Profile hero */
    .profile-hero h1 { font-size: 20px; }
    .profile-hero .meta-row { gap: 8px; flex-direction: column; align-items: center; }
    .profile-hero .meta-item { font-size: 13px; }

    /* Dashboard stat: 1 column on small phones */
    .dashboard-grid { grid-template-columns: 1fr; }

    /* Tables */
    .data-table { min-width: 500px; font-size: 13px; }
    .data-table td, .data-table th { padding: 10px 12px; }

    /* Admin Payout table — make key columns visible, hide less important */
    .data-table td div[style*="flex"] { flex-wrap: wrap; }

    /* Booking form rows */
    .booking-form .form-row { grid-template-columns: 1fr !important; }

    /* Settings */
    .settings-grid { grid-template-columns: 1fr !important; }

    /* Chat */
    .chat-footer { padding: 10px 12px; }

    /* Auth card */
    .form-card {
        padding: 24px 14px;
        margin: 12px 0;
        border-radius: var(--radius-md);
    }

    /* Profile cards */
    .profile-card { padding: 16px 12px; }

    /* Availability row */
    .avail-row { padding: 8px 10px; }

    /* Nav actions shrink */
    header .nav-actions { gap: 6px; }
    header .nav-actions .btn-icon { width: 36px; height: 36px; font-size: 13px; }

    /* Remove hover lift on touch (avoids jitter) */
    .expert-card:hover,
    .category-card:hover,
    .btn-primary:hover,
    .btn-accent:hover {
        transform: none;
    }

    /* Payout number in admin: shrink inline form */
    .data-table input[name="payout_phone"] { width: 90px !important; font-size: 11px; }
}


/* ==========================================
   EXTRA SMALL PHONES (≤ 400px)
========================================== */
@media (max-width: 400px) {
    .hero h1 { font-size: 21px; }
    .hero p  { font-size: 12px; }
    header .brand img { height: 44px; }
    .btn { padding: 9px 12px; font-size: 13px; }
    .stat-card h3 { font-size: 24px; }
    .profile-hero img.large-avatar { width: 76px; height: 76px; }
    .dash-stat-box .num { font-size: 18px; }
    .form-card { padding: 20px 12px; }
/* ==========================================
   iPHONE / STANDARD MOBILE (≤ 390px)
   Target: iPhone SE, iPhone 12 mini, most Androids
========================================== */
@media (max-width: 390px) {

    /* === NAVBAR === */
    header .navbar { height: 60px; padding: 0 12px; }
    header .brand img { height: 44px; }
    header .nav-actions { gap: 6px; }
    header .nav-actions .btn-icon { width: 34px; height: 34px; font-size: 13px; }
    header .nav-actions .btn-secondary,
    header .nav-actions .btn-primary,
    header .nav-actions .btn-outline { padding: 6px 10px; font-size: 12px; }

    /* Mobile menu slide-down position */
    header .nav-links { top: 60px; padding: 16px 18px 22px; }
    header .nav-links a { font-size: 14px; padding: 11px 6px; }

    /* === CONTAINER === */
    .container { padding: 0 10px; }

    /* === HERO === */
    .hero { padding: 32px 0 20px; }
    .hero h1 { font-size: 22px; line-height: 1.25; margin-bottom: 14px; }
    .hero p  { font-size: 13px; margin-bottom: 20px; line-height: 1.55; }

    /* Search box compact */
    .search-container { padding: 10px; gap: 8px; border-radius: var(--radius-sm); }
    .search-container input { padding: 10px 12px; font-size: 14px; }
    .search-container .btn { padding: 10px 14px; font-size: 13px; }

    /* === STATS === */
    .stats-banner { gap: 10px; }
    .stat-card { padding: 14px 12px; gap: 12px; border-radius: var(--radius-sm); }
    .stat-card h3 { font-size: 24px; }
    .stat-card p  { font-size: 12px; }

    /* === CATEGORIES === */
    .grid-categories { grid-template-columns: 1fr; gap: 16px; }
    .category-card { padding: 20px; gap: 12px; align-items: center; text-align: center; }
    .category-card h3 { font-size: 16px; margin-top: 4px; }
    .category-card p  { font-size: 13px; }
    .category-card .icon-wrapper { width: 48px; height: 48px; font-size: 20px; }

    /* === EXPERT CARDS === */
    .grid-experts { gap: 16px; }
    .expert-card { border-radius: var(--radius-lg); }
    .expert-card .card-header { padding: 16px 20px; gap: 14px; }
    .expert-card img.avatar { width: 56px; height: 56px; }
    .expert-card .name  { font-size: 16px; margin-bottom: 2px; }
    .expert-card .title { font-size: 13px; }
    .expert-card .rating { font-size: 13px; margin-top: 2px; }
    .expert-card .card-body { padding: 16px 20px; gap: 14px; }
    .expert-card .bio { font-size: 14px; line-height: 1.5; -webkit-line-clamp: 3; }
    .expert-card .skills-tags { gap: 8px; }
    .expert-card .tag { font-size: 11px; padding: 4px 8px; }
    .expert-card .card-footer { padding: 16px 20px; gap: 12px; flex-direction: column; }
    .expert-card .card-footer .btn { width: 100%; font-size: 14px; padding: 12px; }
    .expert-card .rate { font-size: 13px; width: 100%; text-align: center; }
    .expert-card .rate span { font-size: 18px; }

    /* === SECTION TITLES === */
    .section-title { font-size: 18px; gap: 6px; margin-bottom: 16px; }

    /* === EXPERT PROFILE PAGE === */
    .profile-hero { padding: 20px 12px; gap: 12px; }
    .profile-hero img.large-avatar { width: 80px; height: 80px; border-width: 2px; }
    .profile-hero h1 { font-size: 18px; margin-bottom: 4px; }
    .profile-hero .headline { font-size: 12px; margin-bottom: 8px; }
    .profile-hero .meta-row { gap: 8px; }
    .profile-hero .meta-item { font-size: 12px; gap: 5px; }
    .profile-card { padding: 16px 12px; }
    .profile-card h2 { font-size: 15px; margin-bottom: 12px; padding-left: 10px; }

    /* Booking sidebar */
    .booking-sticky-card { padding: 16px 12px; gap: 12px; }
    .booking-sticky-card .price { font-size: 22px; }

    /* === DASHBOARD STAT BOXES === */
    .dashboard-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 24px; }
    .dash-stat-box { padding: 14px; gap: 10px; border-radius: var(--radius-sm); }
    .dash-stat-box .icon { width: 40px; height: 40px; font-size: 16px; border-radius: var(--radius-sm); }
    .dash-stat-box .num  { font-size: 18px; }
    .dash-stat-box .label { font-size: 10px; }

    /* === TABLE CARDS === */
    .table-card .card-header { padding: 14px 12px; font-size: 14px; }
    .data-table { min-width: 460px; font-size: 12px; }
    .data-table td, .data-table th { padding: 9px 10px; }

    /* Badges smaller */
    .badge { font-size: 10px; padding: 3px 8px; }

    /* === FORMS === */
    .form-card { padding: 20px 12px; margin: 12px 0; }
    .form-card h2 { font-size: 20px; margin-bottom: 18px; }
    .form-group label { font-size: 12px; margin-bottom: 6px; }
    .form-group input,
    .form-group textarea,
    .form-group select { padding: 10px 12px; font-size: 15px; }
    .btn { padding: 10px 14px; font-size: 13px; }

    /* === MESSAGES / CHAT === */
    .chat-layout { min-height: 480px; }
    .chat-sidebar { max-height: 170px; }
    .chat-area { min-height: 310px; }
    .chat-header { padding: 12px 14px; font-size: 14px; }
    .chat-body { padding: 14px; gap: 12px; }
    .message-bubble { max-width: 85%; padding: 10px 14px; font-size: 13px; }
    .chat-footer { padding: 10px 12px; }
    .chat-input-wrapper input { padding: 10px 12px; font-size: 14px; }
    .chat-user-item { padding: 10px 14px; gap: 10px; }
    .chat-user-item img { width: 38px; height: 38px; }
    .chat-user-item .name { font-size: 13px; }
    .chat-user-item .snippet { font-size: 11px; }

    /* === NOTIFICATIONS === */
    .notification-item { padding: 12px; gap: 6px; border-radius: var(--radius-sm); }
    .notification-text h4 { font-size: 13px; }
    .notification-text p  { font-size: 12px; }

    /* === PAYMENT PAGE === */
    .payment-layout { gap: 14px; }
    div[style*="font-size: 24px"][style*="font-weight: 800"] { font-size: 20px !important; letter-spacing: 2px; }

    /* === SETTINGS PAGE === */
    .settings-grid { grid-template-columns: 1fr; gap: 0; }
    .avail-row { padding: 8px; border-radius: var(--radius-sm); }

    /* === FOOTER === */
    footer.site-footer { padding: 22px 0; margin-top: 32px; font-size: 12px; }
}


/* ==========================================
   VERY SMALL PHONES (≤ 320px)
   Target: iPhone 5/SE 1st gen, old Galaxy
========================================== */
@media (max-width: 320px) {

    /* Navbar very compact */
    header .navbar { height: 56px; }
    header .brand img { height: 40px; }
    header .nav-actions { gap: 4px; }
    header .nav-actions .btn-icon { width: 32px; height: 32px; font-size: 12px; }
    header .nav-actions .btn-secondary,
    header .nav-actions .btn-primary,
    header .nav-actions .btn-outline { padding: 4px 8px; font-size: 11px; }
    header .nav-links { top: 56px; padding: 14px 14px 18px; }

    .container { padding: 0 8px; }

    /* Hero ultra-compact */
    .hero { padding: 24px 0 16px; }
    .hero h1 { font-size: 19px; }
    .hero p  { font-size: 12px; }

    /* Stats */
    .stat-card { padding: 14px 12px; }
    .stat-card h3 { font-size: 22px; }

    /* Category cards */
    .category-card { padding: 16px; gap: 10px; }
    .category-card .icon-wrapper { width: 44px; height: 44px; font-size: 18px; }

    /* Expert cards tightest but beautiful */
    .expert-card .card-header { padding: 14px 16px; gap: 12px; }
    .expert-card img.avatar { width: 48px; height: 48px; }
    .expert-card .name { font-size: 14px; margin-bottom: 2px; }
    .expert-card .title { font-size: 12px; }
    .expert-card .rating { font-size: 12px; }
    .expert-card .card-body { padding: 14px 16px; gap: 12px; }
    .expert-card .bio { font-size: 13px; line-height: 1.4; -webkit-line-clamp: 3; }
    .expert-card .tag { font-size: 10px; padding: 3px 6px; }
    .expert-card .card-footer { padding: 14px 16px; gap: 10px; flex-direction: column; }
    .expert-card .card-footer .btn { width: 100%; font-size: 13px; padding: 10px; }
    .expert-card .rate { font-size: 12px; width: 100%; text-align: center; }
    .expert-card .rate span { font-size: 16px; }

    /* Profile hero */
    .profile-hero img.large-avatar { width: 68px; height: 68px; }
    .profile-hero h1 { font-size: 16px; }
    .profile-hero .headline { font-size: 11px; }

    /* Dashboard */
    .dash-stat-box .num { font-size: 16px; }
    .dash-stat-box .icon { width: 36px; height: 36px; font-size: 14px; }

    /* Forms */
    .form-card h2 { font-size: 18px; }
    .btn { font-size: 12px; padding: 9px 12px; }

    /* Chat */
    .message-bubble { max-width: 90%; font-size: 12px; padding: 8px 12px; }
    .chat-user-item img { width: 34px; height: 34px; }

    /* Tables */
    .data-table { min-width: 400px; font-size: 11px; }
    .data-table td, .data-table th { padding: 7px 8px; }

    /* Badges */
    .badge { font-size: 9px; padding: 2px 6px; }

    /* Payment number display */
    div[style*="font-size: 24px"][style*="font-weight: 800"] { font-size: 18px !important; }

    /* Footer */
    footer.site-footer { font-size: 11px; }
}


/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}
/* Hide on desktop */
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-icon { width: 44px; height: 44px; }
    .chat-user-item { padding: 14px 18px; }
    .form-group input,
    .form-group select,
    .form-group textarea { font-size: 16px; } /* prevents iOS zoom */
}

/* Smooth scroll on mobile */
@media (max-width: 768px) {
    html { scroll-behavior: smooth; }
    body { -webkit-overflow-scrolling: touch; }
}




