:root {
    --sand: #f5f0e8;
    --sand-dark: #e8dfd0;
    --ocean: #1565c0;
    --ocean-light: #4fc3f7;
    --ocean-dark: #0d47a1;
    --coral: #c62828;
    --green: #2e7d32;
    --amber: #f9a825;
    --text: #333;
    --text-muted: #777;
    --white: #fff;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--sand);
    color: var(--text);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--ocean-dark);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.nav-brand {
    color: var(--white);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
}
.nav-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.15); color: var(--white); }
.nav-admin { color: var(--amber) !important; }
.nav-logout { opacity: 0.7; }

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert-error { background: #ffebee; color: var(--coral); border: 1px solid #ffcdd2; }
.alert-success { background: #e8f5e9; color: var(--green); border: 1px solid #c8e6c9; }
.alert-warning { background: #fff8e1; color: #e65100; border: 1px solid #ffe082; }

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.auth-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.auth-card h1 { color: var(--ocean-dark); margin-bottom: 0.5rem; }
.auth-card p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Forms */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.95rem; }
.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--ocean); box-shadow: 0 0 0 2px rgba(21,101,192,0.2); }
.form-input-sm { width: 100px; padding: 0.4rem 0.5rem; border: 1px solid #ccc; border-radius: var(--radius); font-size: 0.9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.75rem; text-align: center; }

.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    transition: border-color 0.2s;
}
.radio-label:hover { border-color: var(--ocean); }
.radio-label input[type="radio"] { margin-top: 0.25rem; }

.checkbox-label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }

.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-group .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    transition: border-color 0.2s;
    font-size: 1rem;
}
.checkbox-group .checkbox-label:hover { border-color: var(--ocean); }
.checkbox-group .checkbox-label input[type="checkbox"] { margin-top: 0.25rem; }

.checkbox-label.blocked, .radio-label.blocked {
    opacity: 0.45;
    background: #f5f5f5;
    cursor: not-allowed;
    text-decoration: line-through;
}
.checkbox-label.blocked:hover, .radio-label.blocked:hover { border-color: #ddd; }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--ocean); color: var(--white); }
.btn-secondary { background: var(--sand-dark); color: var(--text); }
.btn-success { background: var(--green); color: var(--white); }
.btn-danger { background: var(--coral); color: var(--white); }
.btn-full { width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

/* Calendar page */
.current-guests {
    background: #e3f2fd;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid #bbdefb;
}
.guest-badge {
    display: inline-block;
    background: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin: 0.15rem;
}
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.legend { display: flex; gap: 1rem; font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

#calendar {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.calendar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.export-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.rooms-sidebar {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}
.rooms-sidebar h3 { grid-column: 1 / -1; }
.room-card {
    background: var(--white);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid #ddd;
}
.room-card strong { color: var(--ocean-dark); }
.room-capacity { float: right; font-size: 0.85rem; color: var(--text-muted); }
.room-card p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Booking detail */
.detail-container { max-width: 600px; margin: 0 auto; }
.detail-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.detail-status {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}
.status-pending { background: #fff8e1; color: #e65100; }
.status-approved { background: #e8f5e9; color: var(--green); }
.status-declined { background: #ffebee; color: var(--coral); }
.status-cancelled { background: #f5f5f5; color: var(--text-muted); }

.detail-table { width: 100%; }
.detail-table th { text-align: left; padding: 0.4rem 1rem 0.4rem 0; color: var(--text-muted); font-weight: 600; width: 130px; }
.detail-table td { padding: 0.4rem 0; }

.calendar-export-buttons {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.calendar-export-buttons h3 { width: 100%; font-size: 1rem; }

.cancel-form { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #eee; }
.back-link { display: inline-block; margin-top: 1rem; color: var(--ocean); }

/* Data table */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius);
    border-collapse: collapse;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.data-table th { background: #f5f5f5; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table a { color: var(--ocean); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Admin */
.admin-section {
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.admin-section h3 { margin-bottom: 0.75rem; color: var(--ocean-dark); }

.share-link-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: #f5f5f5;
    padding: 0.5rem;
    border-radius: var(--radius);
}
.share-link-box code { flex: 1; word-break: break-all; font-size: 0.9rem; }

.admin-booking-card {
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.booking-info { margin-bottom: 0.75rem; }
.booking-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.text-muted { color: var(--text-muted); }
.admin-links { display: flex; gap: 0.5rem; }

.room-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

/* Info page */
.info-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.info-content h3 { color: var(--ocean-dark); margin: 1rem 0 0.5rem; }
.info-content p { margin-bottom: 0.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .navbar { padding: 0.5rem 1rem; }
    .nav-links { width: 100%; justify-content: center; }
    .container { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .calendar-actions { flex-direction: column; align-items: stretch; }
    .rooms-sidebar { grid-template-columns: 1fr; }
    .admin-booking-card .booking-actions { flex-direction: column; }
    .room-edit-form { flex-direction: column; align-items: stretch; }
    .inline-form { flex-direction: column; }
}

/* Bulletin board */
.bulletin-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.note-card {
    background: var(--white);
    border: 1px solid #ddd;
    border-left: 4px solid var(--ocean);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.note-card.note-admin { border-left-color: var(--amber); background: #fffbea; }
.note-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.4rem; }
.note-date { color: var(--text-muted); font-size: 0.9rem; }
.note-stay { color: var(--text-muted); font-size: 0.85rem; }
.note-body { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: var(--amber); color: #5d4400; }

.bulletin-form { display: flex; flex-direction: column; gap: 0.6rem; max-width: 600px; }
.bulletin-form textarea { resize: vertical; }

.stay-notes { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #eee; }
.note-thread { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.note-thread li {
    background: var(--sand);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.note-thread li p { margin: 0.4rem 0 0; white-space: pre-wrap; }

/* Note for the next stay */
.prev-note {
    background: #fffbea;
    border-left: 4px solid var(--amber);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.prev-note h3 { margin: 0 0 0.5rem; color: #5d4400; font-size: 1.05rem; }
.prev-note-meta { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 0.9rem; }
.prev-note-body { margin: 0; white-space: pre-wrap; line-height: 1.5; }

.next-stay-note {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}
.next-stay-note h3 { margin-bottom: 0.4rem; }

/* Bulletin: distinguish next-stay handoff notes from general posts */
.note-card.note-next { border-left-color: var(--green); background: #f0f8f1; }
.badge-next { background: var(--green); color: #fff; }

.bulletin-post {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.bulletin-post h3 { margin: 0 0 0.6rem; font-size: 1rem; }

.form-tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--amber);
    color: #5d4400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}
