/* ===== CSS Variables ===== */
:root {
    /* Theme Colors - Light Mode */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: rgba(255, 255, 255, 0.5);
    /* Semi-transparent white for items */
    --glass-bg: rgba(255, 255, 255, 0.75);
    /* Light glass */
    --glass-border: rgba(255, 255, 255, 0.4);

    --text-primary: #2c1a35;
    /* Dark purple-ish gray for contrast */
    --text-secondary: #5d4a66;
    --text-muted: #805d93;

    /* Palette Colors */
    --color-lavender: #805d93;
    --color-pink: #f49fbc;
    --color-peach: #ffd3ba;
    --color-olive: #9ebd6e;
    --color-shamrock: #169873;

    --accent-primary: #805d93;
    /* Vintage Lavender */
    --accent-secondary: #f49fbc;
    /* Pink Mist */
    --accent-success: #169873;
    /* Shamrock */
    --accent-warning: #d97706;
    /* Darker orange for text availability */
    --accent-danger: #c53030;

    --gradient-primary: linear-gradient(135deg, #805d93, #f49fbc);
    --gradient-success: linear-gradient(135deg, #169873, #9ebd6e);
    --gradient-danger: linear-gradient(135deg, #d32f2f, #f49fbc);

    --shadow-sm: 0 2px 8px rgba(128, 93, 147, 0.1);
    --shadow-md: 0 4px 16px rgba(128, 93, 147, 0.15);
    --shadow-lg: 0 8px 32px rgba(128, 93, 147, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
}

/* Background image with overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg,
            rgba(255, 211, 186, 0.4) 0%,
            rgba(244, 159, 188, 0.3) 50%,
            rgba(128, 93, 147, 0.3) 100%),
        url('../images/Smehaugen.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -1;
}

/* ===== Glass Effect ===== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* ===== Screens ===== */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ===== Login Screen ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Background now handled by body::before with Smehaugen.jpg */
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    text-align: center;
}

.logo {
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ===== Form Styles ===== */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== Error Message ===== */
.error-message {
    color: var(--accent-danger);
    font-size: 14px;
    margin-top: 16px;
    min-height: 20px;
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    margin: 16px;
    border-radius: var(--radius-lg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
}

.nav-brand span:first-child {
    font-size: 28px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 999px;
    background: var(--accent-secondary);
    color: white;
}

.badge.admin {
    background: var(--gradient-primary);
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

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

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

.tab-icon {
    font-size: 20px;
}

.tab-label {
    font-size: 12px;
    font-weight: 500;
}

/* ===== Content Area ===== */
.content {
    padding: 24px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.section-actions {
    display: flex;
    gap: 8px;
}

/* ===== Calendar ===== */
.calendar-container {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.calendar-nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

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

.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.toggle-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.toggle-btn.active {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

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

.mini-month {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.mini-month:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.mini-month h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.mini-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    border-radius: 2px;
}

.mini-day.booked {
    background: var(--accent-success);
    color: white;
}

.mini-day.booked-other {
    background: var(--accent-secondary);
    color: white;
}

.mini-day.pending {
    background: var(--accent-warning);
    color: white;
}

.calendar-nav h3 {
    font-size: 18px;
    font-weight: 600;
}

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

.calendar-header span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

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

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-tertiary);
}

.calendar-day:hover {
    background: var(--accent-primary);
    color: white;
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
}

.calendar-day.today {
    border: 2px solid var(--accent-primary);
}

.calendar-day.booked {
    background: var(--accent-success);
    color: white;
}

.calendar-day.pending {
    background: var(--accent-warning);
    color: white;
}

.calendar-day.booked-other {
    background: var(--accent-secondary);
    color: white;
}

.bookings-list {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.bookings-list h3 {
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--text-secondary);
}

.booking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.booking-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.booking-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.booking-status {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
}

.booking-status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
}

.booking-status.approved {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-success);
}

.booking-status.rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
}

/* ===== Inventory ===== */
.inventory-grid,
.maintenance-grid,
.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.inventory-section,
.maintenance-section,
.checklist-section {
    padding: 24px;
}

.inventory-section h3,
.maintenance-section h3,
.checklist-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.add-item-form,
.add-task-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-item-form input,
.add-task-form input {
    flex: 1;
}

.item-list,
.task-list {
    list-style: none;
}

.item-list li,
.task-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition-fast);
}

.item-list li:hover,
.task-list li:hover {
    background: var(--bg-secondary);
}

.item-actions,
.task-actions {
    display: flex;
    gap: 8px;
}

.item-actions button,
.task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.item-actions button:hover,
.task-actions button:hover {
    opacity: 1;
}

.shopping li {
    border-left: 3px solid var(--accent-warning);
}

.maintenance-section.urgent h3 {
    color: var(--accent-danger);
}

.task-list li.completed {
    opacity: 0.5;
    text-decoration: line-through;
}

/* ===== Expenses ===== */
.expenses-summary,
.expenses-list {
    padding: 24px;
    margin-bottom: 24px;
}

.expenses-summary h3,
.expenses-list h3 {
    margin-bottom: 16px;
}

.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.balance-card {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: center;
}

.balance-card .name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.balance-card .amount {
    font-size: 20px;
    font-weight: 700;
}

.balance-card .amount.positive {
    color: var(--accent-success);
}

.balance-card .amount.negative {
    color: var(--accent-danger);
}

.expenses-list ul {
    list-style: none;
}

.expense-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.expense-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.expense-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.expense-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

/* ===== House Guide ===== */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.guide-card {
    padding: 24px;
}

.guide-card h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.guide-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.guide-content p {
    margin-bottom: 8px;
}

/* ===== Photo Gallery ===== */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-item .photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: 12px;
    color: white;
}

.photo-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
}

.photo-item:hover .photo-delete {
    opacity: 1;
}

/* ===== Checklist ===== */
.checklist {
    list-style: none;
    margin-bottom: 16px;
}

.checklist li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.checklist li:hover {
    background: var(--bg-secondary);
}

.checklist li.checked {
    opacity: 0.5;
}

.checklist li.checked span {
    text-decoration: line-through;
}

.check-icon {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition-fast);
}

.checklist li.checked .check-icon {
    background: var(--accent-success);
    border-color: var(--accent-success);
}

/* ===== Admin ===== */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.admin-section {
    padding: 24px;
}

.admin-section h3 {
    margin-bottom: 16px;
}

.add-user-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.add-user-form input[type="text"],
.add-user-form input[type="password"] {
    flex: 1;
    min-width: 120px;
}

.add-user-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-lavender);
    display: flex;
    align-items: center;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    margin-left: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.status-indicator.online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-indicator.offline {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.users-list {
    list-style: none;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.users-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-list {
    list-style: none;
}

.pending-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.pending-item h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.pending-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.pending-actions {
    display: flex;
    gap: 8px;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 450px;
    padding: 32px;
    display: none;
}

.modal.active {
    display: block;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
}

.toast {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 12px;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    border-left: 4px solid var(--accent-success);
}

.toast.error {
    border-left: 4px solid var(--accent-danger);
}

.toast.info {
    border-left: 4px solid var(--accent-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .tab-nav {
        padding: 0 8px;
    }

    .tab-btn {
        padding: 10px 16px;
    }

    .tab-label {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

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