:root {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.responsive-image {
    display: block;
    width: 100%;
    height: auto;
}

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

.container {
    width: min(1200px, 100% - 32px);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    backdrop-filter: none;
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.brand-logo {
    width: 86px;
    height: 73px;
    object-fit: contain;
}

.brand-text {
    font-size: 18px;
}

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

.nav-link {
    color: var(--muted);
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text);
    background: #f1f5f9;
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    position: absolute;
    transition: transform 0.2s ease;
}

.nav-toggle span::before {
    transform: translateY(-6px);
}

.nav-toggle span::after {
    transform: translateY(6px);
}

.nav-toggle.is-open span {
    background: transparent;
}

.nav-toggle.is-open span::before {
    transform: rotate(45deg);
}

.nav-toggle.is-open span::after {
    transform: rotate(-45deg);
}

.nav-mobile {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

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

.site-main {
    padding: 32px 0 64px;
    flex: 1;
}

.page-header {
    padding: 48px 0 24px;
}

.page-header h1 {
    font-size: clamp(32px, 5vw, 52px);
    margin: 0 0 8px;
}

.page-header p {
    color: var(--muted);
    margin: 0;
}

.hero {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: white;
    border-radius: var(--radius);
    padding: clamp(48px, 9vw, 96px);
    min-height: clamp(320px, 55vh, 520px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero h1 {
    font-size: clamp(32px, 6vw, 56px);
    margin: 0 0 16px;
}

.hero p {
    font-size: 18px;
    margin: 0 0 24px;
    color: rgba(255, 255, 255, 0.9);
}

.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card.compact {
    padding: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.full {
    width: 100%;
}

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

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

.btn-accent {
    background: var(--accent);
    color: #1f2937;
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

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

.tag {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.editor-area {
    min-height: 220px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.editor-area:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: var(--primary);
}

.editor-area img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 8px 0;
}

.page-content img {
    max-width: 100%;
    height: auto;
}

.page-content img.align-left {
    float: left;
    margin: 6px 16px 12px 0;
}

.page-content img.align-right {
    float: right;
    margin: 6px 0 12px 16px;
}

.page-content img.align-center {
    display: block;
    margin: 12px auto;
}

.page-content img.size-50 {
    max-width: 50%;
}

.page-content img.size-100 {
    max-width: 100%;
}

.page-content::after {
    content: '';
    display: block;
    clear: both;
}

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

.event-detail-media {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.event-detail-image {
    width: 100%;
    max-width: 70%;
    border-radius: 12px;
    cursor: zoom-in;
}

@media (max-width: 900px) {
    .event-detail-image {
        max-width: 100%;
    }
}

.event-desc {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.event-desc-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.event-share {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: auto;
}

.event-share.event-share-right {
    margin-right: 0;
    margin-left: auto;
    justify-content: flex-end;
    align-self: flex-start;
}

.event-meta-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.event-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-meta .text-muted {
    margin: 0;
}

.share-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.share-facebook {
    background: #1877f2;
}

.share-instagram {
    background: linear-gradient(135deg, #f58529, #dd2a7b, #515bd4);
}

.share-x {
    background: #111827;
}

.form-label {
    font-weight: 600;
}

.form-control,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 15px;
    background: white;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 15px;
    background: white;
}

.form-control:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: var(--primary);
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid;
    margin-bottom: 16px;
}

.alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

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

.toast-container {
    position: fixed;
    right: 20px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transform: translateX(24px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: auto;
}

.toast.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

.toast-message {
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
    flex: 1;
}

.toast-close {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
}

.toast-success .toast-icon {
    background: #22c55e;
}

.toast-error .toast-icon {
    background: #ef4444;
}

.toast-warning .toast-icon {
    background: #f59e0b;
}

.toast-info .toast-icon {
    background: #3b82f6;
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.86);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 24px;
}

.lightbox.is-open {
    display: flex;
}

.lightbox-content {
    max-width: min(960px, 90vw);
    max-height: 90vh;
    text-align: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.35);
}

.lightbox-caption {
    margin-top: 12px;
    color: #e2e8f0;
    font-size: 14px;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

@media (max-width: 720px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .lightbox-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

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

.table th,
.table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--muted);
    font-weight: 600;
    background: #f8fafc;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 24px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.footer-text {
    margin: 0;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.footer-links a:not(.btn) {
    color: var(--muted);
}

.text-muted {
    color: var(--muted);
}

.table-responsive {
    overflow-x: auto;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone.is-dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.dropzone-info {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.sortable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.sort-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow);
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sort-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
}

.sort-item-rotate {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sort-item-rotate .btn {
    width: 100%;
}

.sort-item.dragging {
    opacity: 0.6;
}

.order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-weight: 500;
}

.finance-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.finance-tabs a {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
}

.finance-tabs a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.kpi-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 16px 0;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.kpi-label {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 20px;
    font-weight: 700;
    margin-top: 6px;
}

.chart-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    gap: 12px;
    align-items: center;
}

.bar-label {
    font-size: 12px;
    color: var(--muted);
}

.bar-track {
    background: #f1f5f9;
    border-radius: 999px;
    height: 10px;
    position: relative;
    overflow: hidden;
}

.bar {
    height: 10px;
    border-radius: 999px;
    position: absolute;
    top: 0;
    left: 0;
}

.bar-income {
    background: #22c55e;
}

.bar-expense {
    background: #ef4444;
    opacity: 0.85;
}

.bar-values {
    text-align: right;
    font-size: 12px;
    color: var(--muted);
}

.pagination {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.pagination a {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.pagination a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 8px;
}

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

.calendar-cell {
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 600;
    color: var(--text);
}

.calendar-cell.muted {
    color: #94a3b8;
    background: #f8fafc;
}

.calendar-cell.clickable {
    cursor: pointer;
    border-color: #cbd5f5;
}

.calendar-cell.pending {
    background: #fef3c7;
    border-color: #f59e0b;
}

.calendar-cell.confirmed {
    background: #fee2e2;
    border-color: #ef4444;
}

.booking-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.legend-item {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.legend-item.available {
    background: #e2e8f0;
    color: #0f172a;
}

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

.legend-item.confirmed {
    background: #fee2e2;
    color: #991b1b;
}

/* Admin layout */
.admin .site-header,
.admin .site-footer {
    background: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

.admin .nav-link {
    color: #cbd5f5;
}

.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

.admin-layout > * {
    min-width: 0;
}

.admin-sidebar-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-sidebar-toggle {
    display: none;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.admin-sidebar {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 20px;
    position: sticky;
    top: 90px;
    height: fit-content;
}

.admin-sidebar a {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    color: #cbd5f5;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
    background: rgba(59, 130, 246, 0.2);
    color: white;
}

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

.admin-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.admin-modal.is-open {
    display: flex;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
}

.admin-modal-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: min(520px, 92vw);
    box-shadow: var(--shadow);
    z-index: 1;
}

.admin-modal-card h3 {
    margin: 0 0 8px;
}

.admin-modal-card p {
    margin: 0;
    color: var(--muted);
}

.admin-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.admin-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}

.gallery-actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.gallery-actions .btn {
    width: 100%;
    min-height: 44px;
}

.gallery-actions form {
    margin: 0;
    width: 100%;
}

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

.gallery-list-card .gallery-actions {
    margin-top: auto;
}

.gallery-card {
    display: flex;
    flex-direction: column;
}

.gallery-card-media {
    width: 100%;
    aspect-ratio: var(--gallery-card-ratio, 1.3333);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 8px;
    margin-bottom: 12px;
}

.gallery-card-media img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .event-share.event-share-right {
        margin-left: 0;
    }

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

    .nav-desktop {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        display: none;
    }

    .admin-sidebar.is-open {
        display: block;
    }

    .admin-sidebar-toggle {
        display: inline-flex;
    }

    .admin .card {
        padding: 16px;
    }

    .admin .admin-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sort-item-rotate {
        grid-template-columns: 1fr;
    }
}
