:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 0.75rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.brand-logo {
    width: 34px;
    height: 34px;
    display: block;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    margin: 2.5px 0;
    transition: 0.3s;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}

.nav-links a:hover { color: var(--primary); background: var(--primary-light); }

.nav-user {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
}

.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    min-height: calc(100vh - 64px - 64px);
}

.footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.25rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

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

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

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-lg); }

.grid {
    display: grid;
    gap: 1rem;
}

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

@media (max-width: 767px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: 1fr; }
}

@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

textarea.form-control { min-height: 120px; resize: vertical; }

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-accepted { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #e0e7ff; color: #3730a3; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #e2e8f0; color: #475569; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 600px;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    background: #f1f5f9;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--muted);
    margin-bottom: 1.25rem;
}

.hero {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 2.5rem 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero h1 { margin: 0 0 0.75rem; font-size: 1.75rem; font-weight: 800; }

.hero p { margin: 0 0 1.5rem; opacity: 0.9; font-size: 1.05rem; }

.search-bar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-bar input { flex: 1; }

.provider-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.provider-card h3 { margin: 0 0 0.5rem; font-size: 1.15rem; font-weight: 700; }

.provider-card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; flex: 1; }

.provider-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rating { color: #f59e0b; font-weight: 700; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.actions .btn-outline.active,
.actions .btn-outline:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
}

.sidebar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    height: fit-content;
}

.sidebar a {
    display: block;
    padding: 0.625rem 0.875rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.sidebar a:hover, .sidebar a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.chatbot {
    max-width: 800px;
    margin: 0 auto;
}

.chat-window {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    height: 420px;
    overflow-y: auto;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.message {
    margin-bottom: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    max-width: 85%;
    line-height: 1.5;
}

.message p { margin: 0.25rem 0 0; white-space: pre-line; }

.message-user {
    background: var(--primary);
    color: white;
    margin-left: auto;
}

.message-bot {
    background: #f1f5f9;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

.chat-form input { flex: 1; }

.map-frame {
    width: 100%;
    height: 300px;
    border: 0;
    border-radius: var(--radius);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
    background: var(--card);
    border-radius: var(--radius);
}

/* Category cards with images */
.category-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 0;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.category-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.category-card .category-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
    z-index: 1;
}

.category-card .category-title {
    position: relative;
    z-index: 2;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem;
    width: 100%;
    margin: 0;
}

/* Provider list item */
.provider-list-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    align-items: start;
}

.provider-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--border);
}

/* Mobile responsive */
@media (max-width: 767px) {
    .navbar { position: relative; }
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--card);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.5rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
    .nav-links.open { display: flex; }
    .nav-links a, .nav-links .nav-user {
        padding: 0.875rem 1rem;
        border-radius: var(--radius);
    }
    .nav-links a:hover { background: var(--primary-light); }
    .nav-links .btn { width: 100%; margin-top: 0.25rem; }
    .nav-user { text-align: center; color: var(--muted); }

    .main { padding: 1rem; }
    .hero { padding: 2rem 1rem; }
    .hero h1 { font-size: 1.4rem; }
    .hero p { font-size: 0.95rem; }
    .search-bar { flex-direction: column; }

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

    .page-title { font-size: 1.35rem; }

    .message { max-width: 92%; }

    .form-group .grid-cols-2,
    .form-group .grid-cols-3 { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
    .search-bar { flex-direction: row; }
    .hero { padding: 3.5rem 2rem; }
    .hero h1 { font-size: 2.25rem; }
    .page-title { font-size: 1.75rem; }
}

@media (min-width: 1024px) {
    .hero { padding: 4rem 2rem; }
    .hero h1 { font-size: 2.5rem; }
}
