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

:root {
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --primary-dark: #134e4a;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--text);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: 0;
}

p {
    margin: 0;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.content {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    flex: 1;
    padding: 2rem 0 4rem;
}

.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Public navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem max(1rem, calc((100vw - 1180px) / 2));
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    color: var(--text);
    backdrop-filter: blur(16px);
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.nav-brand::before {
    content: "";
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.75rem;
    background:
        linear-gradient(135deg, rgba(20, 184, 166, 0.95), rgba(15, 118, 110, 0.95)),
        radial-gradient(circle at 70% 25%, rgba(245, 158, 11, 0.85), transparent 38%);
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}

.nav-brand a {
    color: inherit;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link,
.sidebar-link {
    border-radius: var(--radius-sm);
    font-weight: 700;
    transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.5rem 0.8rem;
    color: #475569;
    font-size: 0.92rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-dark);
    background: #ecfeff;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--transition), background-color var(--transition), box-shadow var(--transition);
}

.nav-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
    transform: translateY(-1px);
}

.nav-toggle {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

/* Hero and search */
.hero {
    position: relative;
    min-height: 560px;
    display: grid;
    align-items: end;
    padding: clamp(2rem, 6vw, 4.5rem);
    margin-bottom: 4rem;
    overflow: hidden;
    border-radius: 0 0 1.5rem 1.5rem;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0.76)),
        url('https://images.unsplash.com/photo-1566073771259-6a8506099945?auto=format&fit=crop&w=1600&q=85') center/cover no-repeat;
    box-shadow: var(--shadow-lg);
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 42%;
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.7), transparent);
    pointer-events: none;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero-title {
    max-width: 780px;
    margin-bottom: 1rem;
    color: #fff;
    font-size: clamp(2.3rem, 7vw, 5.6rem);
    letter-spacing: 0;
}

.hero-subtitle {
    max-width: 680px;
    margin-bottom: 1.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 500;
}

.search-widget {
    width: 100%;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.search-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 0.75rem;
    align-items: end;
}

.search-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.4rem;
}

.search-group label,
.form-group label,
.booking-field label {
    color: #334155;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.search-widget .search-group > label,
.search-widget .search-group label,
.search-widget .search-group div,
.search-widget .search-group div label {
    color: #0f172a !important;
}

.search-input,
.form-control {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.search-input:focus,
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.16);
}

.search-submit-btn,
.booking-form-btn,
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.75rem 1.1rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.search-submit-btn:hover,
.booking-form-btn:hover,
.auth-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
    transform: translateY(-1px);
}

/* Cards and listings */
.stats-grid,
.homestay-grid {
    display: grid;
    gap: 1.25rem;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.homestay-grid {
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
}

.stat-card,
.homestay-card,
.detail-main,
.booking-card,
.auth-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 1.4rem;
}

.stat-value {
    margin-top: 0.45rem;
    color: var(--primary-dark);
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.homestay-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.homestay-card:hover {
    border-color: #99f6e4;
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.homestay-image-container {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--surface-soft);
}

.homestay-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 280ms ease;
}

.homestay-card:hover .homestay-image-container img {
    transform: scale(1.035);
}

.homestay-price-badge {
    position: absolute;
    right: 0.8rem;
    bottom: 0.8rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    backdrop-filter: blur(10px);
}

.homestay-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
}

.homestay-title {
    color: var(--text);
    font-size: 1.05rem;
}

.homestay-address,
.homestay-desc-preview {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.homestay-address {
    display: flex;
    gap: 0.35rem;
}

.homestay-features,
.amenities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.homestay-feature-item,
.amenity-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.35rem 0.6rem;
    border: 1px solid #ccfbf1;
    border-radius: 999px;
    background: #f0fdfa;
    color: #115e59;
    font-size: 0.78rem;
    font-weight: 700;
}

.homestay-desc-preview {
    display: -webkit-box;
    overflow: hidden;
    flex: 1;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.homestay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.6rem;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: #fff;
    font-weight: 800;
    transition: background-color var(--transition), transform var(--transition);
}

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

/* Detail and booking */
.detail-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
    align-items: start;
}

.detail-main,
.booking-card {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.detail-gallery-wrap {
    margin-bottom: 1.5rem;
}

.detail-gallery {
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.detail-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.6rem;
    margin-top: 0.7rem;
}

.detail-gallery-thumb {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    cursor: pointer;
}

.detail-gallery-thumb.active,
.detail-gallery-thumb:hover {
    border-color: var(--primary);
}

.detail-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-title-section {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-price-text {
    flex-shrink: 0;
    color: var(--primary-dark);
    font-size: 1.6rem;
    font-weight: 800;
    text-align: right;
}

.detail-price-text span {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.detail-info-block {
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.detail-subtitle,
.booking-title {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 1rem;
}

.booking-card {
    position: sticky;
    top: 5.8rem;
    box-shadow: var(--shadow-md);
}

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

.booking-summary-box {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.booking-summary-line,
.booking-summary-total {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.booking-summary-line + .booking-summary-line {
    margin-top: 0.5rem;
}

.booking-summary-total {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    color: var(--primary-dark);
    font-weight: 800;
}

/* Auth */
.auth-container {
    width: min(460px, 100%);
    margin: 3rem auto;
}

.auth-card {
    padding: clamp(1.5rem, 5vw, 2rem);
    box-shadow: var(--shadow-md);
}

.auth-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-header h2 {
    margin-bottom: 0.4rem;
    font-size: 1.7rem;
}

.auth-header p,
.auth-footer {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.auth-footer {
    margin-top: 1.25rem;
    text-align: center;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 800;
}

/* Alerts */
.alert {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.alert-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

/* Dashboard */
.dashboard-wrapper {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem;
    overflow-y: auto;
    background: #0f172a;
    color: #e2e8f0;
}

.sidebar .nav-brand {
    color: #fff;
}

.sidebar-title {
    margin: 1rem 0 0.55rem;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 2.45rem;
    padding: 0.55rem 0.75rem;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(20, 184, 166, 0.14);
    color: #fff;
}

.dashboard-content {
    min-width: 0;
    padding: clamp(1rem, 3vw, 2rem);
}

/* Tables and forms */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.data-table td {
    color: var(--text);
    font-size: 0.9rem;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tr:hover td {
    background: #f8fafc;
}

textarea.form-control {
    min-height: 7rem;
    resize: vertical;
}

.btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.25rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #fff; color: #334155; border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    text-transform: capitalize;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1d4ed8; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-partial { background: #ffedd5; color: #9a3412; }
.badge-unpaid { background: #f1f5f9; color: #475569; }
.badge-received { background: #ccfbf1; color: #115e59; }
.badge-refunded { background: #dbeafe; color: #1d4ed8; }

footer {
    margin-top: auto;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    text-align: center;
}

.footer-content {
    display: grid;
    gap: 0.7rem;
    width: min(1180px, 100%);
    margin: 0 auto;
}

.footer-logo {
    color: var(--primary-dark);
    font-size: 1.15rem;
    font-weight: 800;
}

.col-dates {
    min-width: 155px;
    white-space: nowrap !important;
}

@media (max-width: 1100px) {
    .search-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-submit-btn {
        grid-column: 1 / -1;
    }

    .detail-container {
        grid-template-columns: 1fr;
    }

    .booking-card {
        position: static;
    }
}

@media (max-width: 820px) {
    main.content {
        width: min(100% - 1rem, 1180px);
        padding-top: 1rem;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding-top: 0.75rem;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-link,
    .nav-btn {
        width: 100%;
        justify-content: flex-start;
    }

    .hero {
        min-height: 520px;
        border-radius: var(--radius-lg);
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .detail-title-section {
        flex-direction: column;
    }

    .detail-price-text {
        text-align: left;
    }

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

    .sidebar {
        position: static;
        height: auto;
        border-radius: 0 0 1rem 1rem;
    }

    .dashboard-content {
        padding: 1rem;
    }
}

@media (max-width: 560px) {
    .hero {
        min-height: auto;
        padding: 2rem 1rem;
    }

    .stats-grid,
    .homestay-grid {
        grid-template-columns: 1fr;
    }

    .detail-main,
    .booking-card,
    .stat-card,
    .auth-card {
        border-radius: var(--radius-md);
    }

    .btn-group,
    .btn {
        width: 100%;
    }
}

@media print {
    .navbar,
    footer {
        display: none;
    }

    body {
        background: #fff;
    }

    main.content {
        width: 100%;
        padding: 0;
    }

    .stat-card,
    .table-responsive {
        box-shadow: none;
    }
}
