/* ============================================================
   Hatch Admin Dashboard — Coastal Editorial Design System
   ============================================================ */

:root {
    --teal: #006872;
    --teal-light: #e0f2f4;
    --teal-dark: #004d54;
    --sand: #7d562c;
    --sand-light: #f5efe8;
    --cream: #faf8f5;
    --bg: var(--cream);
    --surface: #ffffff;
    --text: #1a1a1a;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: var(--teal);
    --primary-light: var(--teal-light);
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --sidebar-bg: #004d54;
    --sidebar-text: #e0f2f4;
    --font-serif: 'Noto Serif', Georgia, serif;
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
}


/* ---- Global Reset & Base ---- */

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

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    text-decoration: underline;
}

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


/* ---- Sidebar ---- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h1 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #ffffff;
    margin: 0;
}

.sidebar-logo .subtitle {
    font-size: 11px;
    color: rgba(224, 242, 244, 0.65);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.sidebar .role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--sidebar-text);
    margin: 12px 20px 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-left-color: var(--teal-light);
    font-weight: 600;
}

.sidebar-nav a .nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 15px;
}

.sidebar-nav .nav-section {
    margin: 0;
    border: none;
}

.sidebar-nav .nav-section summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(224, 242, 244, 0.5);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.sidebar-nav .nav-section summary::-webkit-details-marker {
    display: none;
}

.sidebar-nav .nav-section summary::after {
    content: '\25B8';
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.sidebar-nav .nav-section[open] summary::after {
    transform: rotate(90deg);
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(224, 242, 244, 0.6);
    font-size: 13px;
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.15s;
}

.sidebar-footer a:hover {
    color: #ffffff;
    text-decoration: none;
}


/* ---- Content Area ---- */

.content {
    margin-left: 220px;
    padding: 24px 32px;
    min-height: 100vh;
}


/* ---- Page Header ---- */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.page-header .subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.page-header .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}


/* ---- Stats Grid ---- */

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card .stat-body {
    flex: 1;
    min-width: 0;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.stat-card .stat-trend.up {
    color: var(--success);
}

.stat-card .stat-trend.down {
    color: var(--danger);
}

.stat-card .stat-trend.neutral {
    color: var(--muted);
}


/* ---- Data Tables ---- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--primary-light);
    color: var(--teal-dark);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(0, 104, 114, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

table a {
    font-weight: 500;
}


/* ---- Forms ---- */

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid rgba(229, 231, 235, 0.4);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 104, 114, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

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

.form-group .help-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

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


/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn:hover {
    text-decoration: none;
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

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

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    box-shadow: 0 2px 6px rgba(0, 77, 84, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 77, 84, 0.35);
}

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

.btn-secondary:hover {
    background: #cce9ed;
}

.btn-danger {
    color: #ffffff;
    background: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius);
}


/* ---- Badges ---- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--border);
    color: var(--muted);
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

.badge-licence {
    background: #fef3c7;
    color: #92400e;
}

.badge-no-licence {
    background: #d1fae5;
    color: #065f46;
}


/* ---- Status Badges (Bookings) ---- */

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-deposit_paid {
    background: #dbeafe;
    color: #1e40af;
}

.status-confirmed {
    background: #d1fae5;
    color: #065f46;
}

.status-checked_in {
    background: #e0e7ff;
    color: #3730a3;
}

.status-completed {
    background: #f3f4f6;
    color: #374151;
}

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

.status-refunded {
    background: #fce7f3;
    color: #9d174d;
}


/* ---- Cards ---- */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.card + .card {
    margin-top: 16px;
}


/* ---- Tabs ---- */

.tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: var(--text);
}

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

.tab-content {
    display: none;
}

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


/* ---- Alerts ---- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left: 3px solid var(--success);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 3px solid var(--warning);
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 3px solid var(--info);
}


/* ---- Modal ---- */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* ---- Toggle Switch ---- */

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle .toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle .toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 104, 114, 0.15);
}


/* ---- Empty State ---- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

.empty-state .btn {
    margin-top: 8px;
}


/* ---- Calendar Grid ---- */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calendar-day {
    background: var(--surface);
    padding: 8px;
    min-height: 90px;
    font-size: 12px;
}

.calendar-day .day-number {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--muted);
}

.calendar-day--today {
    background: var(--primary-light);
}

.calendar-day--today .day-number {
    color: var(--primary);
    font-weight: 700;
}

.calendar-day--has-bookings .day-number {
    color: var(--text);
}

.calendar-day--outside {
    opacity: 0.35;
}

.calendar-day .booking-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin-right: 3px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.calendar-header span {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 8px 0;
}


/* ---- Pagination ---- */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}

.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.pagination .page-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ---- Search Bar ---- */

.search-bar {
    position: relative;
    max-width: 320px;
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.search-bar input {
    padding-left: 36px;
}


/* ---- Dropdown ---- */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    padding: 4px 0;
    animation: dropIn 0.15s ease-out;
}

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

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.dropdown-menu .divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}


/* ---- Responsive (< 768px) ---- */

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
        transition: width 0.25s;
    }

    .sidebar.open {
        width: 220px;
    }

    .content {
        margin-left: 0;
        padding: 16px;
    }

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

    .page-header {
        flex-direction: column;
    }

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* ---- Utility Classes ---- */

.text-muted   { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.flex {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
