:root {
    --primary: #a85f2f;       /* muted terracotta for accents */
    --bg: #faf7f2;           /* warm cream/beige background */
    --text: #5d4037;         /* warm brown text */
    --header-bg: #f0d6bb;    /* soft muted beige for header */
    --photo-bg: #f5e6d8;     /* light warm for photo placeholder */
}

/* General */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
}

/* === Login Page === */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: white;
    padding: 50px 60px;
    border-radius: 16px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}

.login-container h1 {
    color: #6d4c41;
    margin-bottom: 40px;
    font-size: 2.6rem;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border: 2px solid #e0d6c8;
    border-radius: 10px;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.login-container input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-container button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}

.login-container button:hover {
    background: #92400e;
}

/* === Dashboard Header === */
header {
    background: var(--header-bg);
    padding: 0;
}

nav {
    background-color: transparent;
    padding: 20px;
    text-align: center;
    position: relative;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 40px;
}

nav li {
    list-style: none;
    padding: 0;
    margin: 0;
    border: none;
}

/* Top Navigation in Dashboard (index.html) */
nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: color 0.3s;
    border-bottom: none;
    padding-bottom: 2px;
}

nav a:hover {
    color: var(--primary);
}

nav a.active {
    color: var(--primary);
}

/* Top Navigation Hover - Soft Rounded Highlight */
header nav a {
    padding: 8px 16px;
    border-radius: 12px;
    transition: background 0.3s, color 0.3s;
}

header nav a:hover {
    background: rgba(168, 95, 47, 0.15);
    color: var(--primary);
}

header nav a.active {
    background: rgba(168, 95, 47, 0.25);
    color: var(--primary);
    border-radius: 12px;
}

/* Override for top nav only - no harsh box on active */
header nav a.active {
    background: rgba(168, 95, 47, 0.25);
    box-shadow: none;
    border: none;
    color: var(--primary);
}

.hamburger {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text);
    position: absolute;
    right: 20px;
    top: 20px;
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 20px;
    flex-direction: column;
    gap: 15px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    color: var(--text);
    text-decoration: none;
    font-weight: bold;
    border-bottom: none;
    display: block;
    padding: 12px 20px;
    border-radius: 10px;
    transition: background 0.3s, color 0.3s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    color: var(--primary);
    background: rgba(168, 95, 47, 0.15);
}

.title-section {
    text-align: center;
    padding: 20px 20px 50px 20px;
}

.title-section h1 {
    margin: 0;
    font-size: 2.5rem;
    color: #6d4c41;
}

.title-section p {
    margin: 10px 0 0;
    font-size: 1.2rem;
    color: var(--text);
}

/* === Dashboard Content === */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.widget {
    padding: 20px 0;
    text-align: center;
}

.widget h2 {
    color: var(--primary);
    margin: 0 0 20px 0;
    font-size: 1.4rem;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.photo-placeholder {
    background: var(--photo-bg);
    height: 220px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b6f47;
    font-style: italic;
    font-size: 1.1rem;
}

footer {
    background: transparent;
    color: #8b6f47;
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* Mobile dashboard nav: keep hamburger fully visible above the menu */
@media (max-width: 768px) {
    nav ul {
        display: none;
    }

    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: 16px;
        top: 16px;
        z-index: 1200;
        background: var(--header-bg);
        width: 48px;
        height: 48px;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        line-height: 1;
    }

    .mobile-menu {
        position: fixed;
        top: 80px;
        left: 12px;
        right: 12px;
        z-index: 1100;
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    .login-container {
        padding: 40px 30px;
    }
}

/* === App Layout with Left Sidebar === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 200px;
    background: var(--header-bg);
    color: var(--text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 12px rgba(0,0,0,0.06);
}

.sidebar-header {
    padding: 16px 12px;
    text-align: center;
    border-bottom: 1px solid #e0d6c8;
    position: relative;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #6d4c41;
}

.toggle-btn {
    display: none;
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text);
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar .nav-item {
    display: block;
    padding: 12px 18px;
    color: var(--text);
    text-decoration: none;
    font-weight: 400;
    border-left: 4px solid transparent;
    transition: background 0.3s, color 0.3s;
}

.sidebar .nav-item:hover {
    background: rgba(168, 95, 47, 0.15);
    color: var(--primary);
}

.sidebar .nav-item.active {
    background: rgba(168, 95, 47, 0.25);
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
}

.logout {
    margin-top: auto;
    border-top: 1px solid #e0d6c8;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 200px;
    background: var(--bg);
    transition: margin-left 0.3s ease;
}

/* Overlay for mobile */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

/* Responsive - Collapsible Sidebar */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .toggle-btn {
        display: block;
    }

    .overlay.active {
        display: block;
    }
}

/* Top Submenu Bar - Fixed at the very top of main content */
.top-submenu-bar {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 4px 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.submenu {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    flex: 1;
}

.submenu-item {
    color: var(--text);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 400;
    transition: background 0.3s, color 0.3s;
    position: relative;
}

.submenu-item:hover {
    background: #f0e6d8;
    color: var(--primary);
}

.submenu-item.active {
    color: var(--primary);
    background: transparent;
    font-weight: 700;
}

.submenu-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.account-menu {
    position: relative;
    flex-shrink: 0;
}

.account-menu-button {
    background: transparent;
    border: none;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 400;
}

.account-menu-button:hover,
.account-menu-button[aria-expanded="true"] {
    background: #f0e6d8;
    color: var(--primary);
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 8px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-menu-panel[hidden] {
    display: none;
}

.account-menu-panel form {
    margin: 0;
}

.account-menu-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    text-decoration: none;
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.account-menu-item:hover {
    background: #f0e6d8;
    color: var(--primary);
}

.account-menu-item.active {
    color: var(--primary);
    font-weight: 700;
}

/* App Header - Now below submenu */
.app-header {
    padding: 30px 40px 20px;
    background: var(--bg);
}

.app-header h1 {
    margin: 0 0 8px 0;
    color: #000;
    font-size: 2.2rem;
}

.app-header p {
    margin: 0;
    color: #000;
    font-size: 1.1rem;
}

/* Module content */
.module-content {
    padding: 20px 40px 60px;
    max-width: 1200px;
    color: #000;
}

/* Persistent Mobile Sidebar Toggle Button */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    border: none;
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: background 0.3s;
}

.mobile-sidebar-toggle:hover {
    background: #f0e6d8;
}

@media (max-width: 992px) {
    .mobile-sidebar-toggle {
        display: flex;
    }

    .top-submenu-bar,
    .app-header,
    .module-content {
        padding-left: 80px;
        transition: padding-left 0.3s ease;
    }

    .sidebar.open ~ .main-content .top-submenu-bar,
    .sidebar.open ~ .main-content .app-header,
    .sidebar.open ~ .main-content .module-content {
        padding-left: 40px;
    }

    .toggle-btn {
        display: none !important;
    }
}


/* --- Django template integration --- */
.title-section {
    /* same as .title-section (mockup HTML used both names) */
    text-align: center;
    padding: 1.5rem 1rem 2rem;
}
.title-section h1 {
    margin: 0 0 0.5rem;
    color: #6d4c41;
}
.title-section p {
    margin: 0;
    color: #8d6e63;
}
button.nav-item,
button.nav-link-btn {
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    padding: 0;
}
header nav button.nav-item,
.mobile-menu button.nav-item {
    color: inherit;
}
.mobile-menu form {
    margin: 0;
}
.login-error {
    color: #b91c1c;
    margin: 0 0 1rem;
}

.sidebar form {
    margin: 0;
}

.sidebar button.nav-item {
    width: 100%;
    text-align: left;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 400;
    background: none;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    cursor: pointer;
}

.widget a,
.cal-hint a {
    color: var(--text);
    text-decoration: none;
}

.widget a:hover,
.cal-hint a:hover {
    color: var(--primary);
}

.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.cal-toolbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.cal-toolbar h2 {
    margin: 0;
    color: #6d4c41;
    font-size: 1.4rem;
    font-weight: 600;
}

.cal-nav {
    color: var(--text);
    text-decoration: none;
    font-weight: 400;
    background: white;
    border-radius: 12px;
    padding: 8px 14px;
}

.cal-nav:hover {
    background: #f0e6d8;
    color: var(--primary);
}

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

.cal-dow {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 400;
    color: #8b6f47;
    padding: 4px 0 8px;
}

.cal-day {
    min-height: 96px;
    background: white;
    border-radius: 12px;
    padding: 8px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid transparent;
    box-sizing: border-box;
}

.cal-day:hover {
    border-color: rgba(168, 95, 47, 0.35);
}

.cal-day.is-outside {
    opacity: 0.45;
}

.cal-day-num {
    font-weight: 400;
    color: #6d4c41;
}

.cal-day.is-today .cal-day-num {
    background: var(--primary);
    color: white;
    border-radius: 999px;
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.cal-chip {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.3;
    background: rgba(168, 95, 47, 0.15);
    color: var(--primary);
    border-radius: 8px;
    padding: 2px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.cal-hint,
.cal-empty,
.cal-empty-day {
    color: #8b6f47;
}

.cal-hint {
    margin-top: 18px;
}

.cal-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.cal-week-day {
    background: white;
    border-radius: 12px;
    padding: 12px;
    min-height: 180px;
    box-sizing: border-box;
}

.cal-week-day.is-today {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.cal-week-date {
    display: inline-block;
    margin-bottom: 10px;
    color: #6d4c41;
    font-weight: 400;
    text-decoration: none;
}

.cal-week-day.is-today .cal-week-date {
    font-weight: 700;
    color: var(--primary);
}

.cal-day-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.cal-event-card {
    background: white;
    border-radius: 16px;
    padding: 18px 20px;
    width: min(100%, 640px);
    box-sizing: border-box;
}

.cal-event-card h3 {
    margin: 0 0 6px;
    color: #6d4c41;
    font-size: 1.25rem;
}

.cal-event-card p,
.cal-event-time {
    margin: 0;
}

.cal-event-time {
    color: var(--primary);
    margin-bottom: 6px;
}

.event-form {
    background: white;
    max-width: 480px;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.event-field {
    margin-bottom: 16px;
}

.event-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
}

.event-form input,
.event-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font: inherit;
    color: var(--text);
    border: 2px solid #e0d6c8;
    border-radius: 10px;
}

.event-form input:focus,
.event-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.event-form button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.event-form button:hover {
    background: #92400e;
}

@media (max-width: 700px) {
    .cal-toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .cal-day {
        min-height: 52px;
        padding: 4px;
    }

    .cal-chip {
        width: 6px;
        height: 6px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
    }

    .cal-week {
        grid-template-columns: 1fr;
    }

    .cal-week-day {
        min-height: 0;
    }

    .cal-week .cal-chip {
        width: auto;
        height: auto;
        padding: 2px 6px;
        border-radius: 8px;
        font-size: 0.85rem;
    }
}
