/* --- Google Calendar Authentic Dark Mode --- */

:root {
    --bg-color: #202124;
    --surface-color: #202124;
    /* Sidebar matches bg usually in web */
    --dialog-color: #28292c;
    /* Modals */
    --border-color: #5f6368;
    --grid-line: #3c4043;
    /* Lighter grey for grid */
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --accent-blue: #8ab4f8;
    --selection-blue: #4285f4;
    /* Darker blue for active states */
    --today-circle: #8ab4f8;

    --sidebar-width: 280px;
    --hour-height: 50px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
}

.background-animation {
    display: none;
}

/* Layout */
.app-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    padding: 12px 0 12px 28px;
    /* Google Cal spacing */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    padding-bottom: 20px;
}

.logo h2 {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Create FAB */
.create-wrapper {
    margin-bottom: 16px;
}

.create-fab {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #28292c;
    /* Surface */
    color: var(--text-primary);
    padding: 0 24px 0 16px;
    height: 48px;
    border-radius: 24px;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.25px;
    transition: background 0.2s, box-shadow 0.2s;
}

.create-fab:hover {
    background-color: #303134;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}

.create-fab i.fa-plus {
    font-size: 24px;
    /* Simulated Google Multi-color Plus */
    background: conic-gradient(from 0deg, #ea4335 0deg 90deg, #34a853 90deg 180deg, #fbbc04 180deg 270deg, #4285f4 270deg 360deg);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    width: 24px;
    height: 24px;
}

/* Mini Calendar */
.calendar-wrapper {
    margin-top: 10px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 8px;
    /* Align with dates */
    margin-bottom: 10px;
}

.calendar-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.calendar-header button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.calendar-header button:hover {
    background: rgba(232, 234, 237, 0.08);
}

.calendar-days-header,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    row-gap: 2px;
}

.calendar-days-header span {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
}

.calendar-day {
    height: 24px;
    width: 24px;
    margin: 0 auto;
    font-size: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
}

.calendar-day:hover {
    background: rgba(232, 234, 237, 0.08);
}

.calendar-day.other-month {
    color: var(--text-secondary);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--today-circle);
    color: #202124;
    /* Black text on blue circle */
    font-weight: bold;
}

.calendar-day.active {
    background: rgba(66, 133, 244, 0.3);
    /* Selected state background */
    color: #8ab4f8;
}

.calendar-day.today.active {
    background: var(--today-circle);
    color: black;
}

/* Filter & Quick Add */
.sidebar-filter {
    margin-top: 20px;
    padding-right: 28px;
}

.quick-add {
    margin-top: 10px;
    padding-right: 28px;
}

.quick-add button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    width: 100%;
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Inner scroll only */
}

.main-content header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    /* Optional: Google Cal often has no header line, just top bar */
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-content header h1 {
    font-size: 22px;
    font-weight: 400;
}

#weekRangeDisplay {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Time Grid */
.calendar-week-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 10px;
}

.week-header {
    display: flex;
    border-bottom: 1px solid var(--grid-line);
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--bg-color);
}

.time-header-spacer {
    width: 60px;
    border-right: 1px solid var(--grid-line);
    flex-shrink: 0;
    background-color: var(--bg-color);
}

.day-header-cell {
    flex: 1;
    text-align: center;
    padding-bottom: 4px;
    border-right: 1px solid var(--grid-line);
}

.day-header-cell h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 8px;
}

.day-header-cell span {
    font-size: 24px;
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    margin-top: 4px;
}

.day-header-cell.is-today h3 {
    color: var(--accent-blue);
}

.day-header-cell.is-today span {
    background: var(--accent-blue);
    color: black;
}

.week-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    position: relative;
}

.week-grid-content {
    display: flex;
    flex: 1;
    position: relative;
}

.time-sidebar {
    width: 60px;
    flex-shrink: 0;
    border-right: 1px solid var(--grid-line);
}

.time-slot-label {
    height: var(--hour-height);
    font-size: 10px;
    color: var(--text-secondary);
    text-align: right;
    padding-right: 8px;
    position: relative;
    top: -6px;
    /* Offset to align with line */
}

.week-grid {
    flex: 1;
    display: flex;
    position: relative;
    background-image: linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: 100% var(--hour-height);
}

.day-column {
    flex: 1;
    border-right: 1px solid var(--grid-line);
    position: relative;
    height: 1200px;
    /* 24 * 50 */
}

/* Events */
.calendar-event {
    position: absolute;
    left: 2px;
    right: 4px;
    background: #5474b4;
    /* Event Blue */
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    overflow: hidden;
    border-left: 2px solid #5474b4;
    /* Cleaner look */
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.calendar-event:hover {
    background: #5c84d6;
    z-index: 10;
}

.calendar-event.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* Dimmer */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--dialog-color);
    width: 448px;
    border-radius: 8px;
    box-shadow: 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12), 0 11px 15px -7px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: var(--dialog-color);
    padding: 10px 16px;
    display: flex;
    justify-content: flex-end;
    /* Close button right */
    border-radius: 8px 8px 0 0;
}

.drag-handle {
    display: none;
    /* remove for authentic look */
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 8px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Title Input */
.modal-title-input {
    font-size: 22px;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-bottom: 1px solid #5f6368;
    padding-bottom: 8px;
    width: 100%;
}

.modal-title-input:focus {
    outline: none;
    border-bottom: 2px solid var(--accent-blue);
}

.modal-title-input::placeholder {
    color: var(--text-secondary);
}

/* Tabs */
.event-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.tab-btn:hover {
    background: rgba(232, 234, 237, 0.04);
}

.tab-btn.active {
    background: #d2e3fc;
    /* Light blue accent */
    color: #174ea6;
    /* Dark blue text */
}

/* Generic Form Rows */
.form-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.icon-col {
    width: 40px;
    display: flex;
    justify-content: center;
    color: var(--text-secondary);
    padding-top: 4px;
    font-size: 20px;
}

.icon-col i {
    width: 20px;
    text-align: center;
}

/* Time Inputs */
.time-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="date"],
input[type="time"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: inherit;
}

input[type="date"]:hover,
input[type="time"]:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Description */
.text-input-flat {
    background: #303134;
    /* Input box bg for description sometimes, or tranparent line */
    background: rgba(232, 234, 237, 0.04);
    border: none;
    border-radius: 4px;
    padding: 10px;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
    resize: none;
}

.text-input-flat:focus {
    background: rgba(232, 234, 237, 0.08);
    outline: none;
}

.user-info {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.user-info span {
    color: var(--text-primary);
}

.user-info small {
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Footer */
.modal-footer {
    padding: 10px 16px 16px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.text-btn {
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.text-btn:hover {
    background: rgba(232, 234, 237, 0.04);
}

.save-btn {
    background: var(--accent-blue);
    color: #202124;
    border: none;
    padding: 8px 24px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
}

.save-btn:hover {
    background: #9bbff8;
}

/* Obsolete sections */
.input-section {
    display: none !important;
}

button#addBtn {
    display: none;
}

/* More Options Menu */
.options-menu {
    position: absolute;
    bottom: 52px;
    right: 120px;
    /* Position relative to footer */
    background: #303134;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    padding: 8px 0;
    z-index: 10001;
    min-width: 140px;
    display: block;
}

.options-menu.hidden {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.menu-item:hover {
    background: rgba(232, 234, 237, 0.08);
}

.menu-item.delete {
    color: var(--text-primary);
}

.menu-item.delete i {
    color: #f28b82;
}

/* Icon red */

/* Event Details (Meet & Location) */
.meet-btn {
    background: #1a73e8;
    /* Google Blue */
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: fit-content;
}

.meet-btn:hover {
    background: #1967d2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.meet-link-display {
    background: #1a73e8;
    color: white;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
    display: flex;
    max-width: fit-content;
}

.meet-link-display.hidden {
    display: none;
}

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

.meet-icon {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meet-info {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
}

.meet-url {
    font-weight: 500;
    font-size: 14px;
}

.meet-info small {
    font-size: 11px;
    opacity: 0.8;
}

.remove-meet {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    opacity: 0.7;
}

.remove-meet:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* Hide event fields by default if needed */
#eventFields.hidden {
    display: none;
}

/* Responsive Mobile & Tablet */

/* Hidden by default on Desktop */
.menu-btn {
    display: none;
    /* Only show on mobile */
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 50%;
}

.menu-btn:hover {
    background: rgba(232, 234, 237, 0.08);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    /* Below sidebar, above content */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 900px) {
    .menu-btn {
        display: block;
    }

    .sidebar {
        display: flex !important;
        /* Override none/flex issues */
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        background: var(--bg-color);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        width: 260px;
        /* Slightly narrower */
    }

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

    /* Adjust Header */
    .main-content header {
        padding: 16px;
    }

    .main-content header h1 {
        font-size: 18px;
    }

    #weekRangeDisplay {
        font-size: 14px;
    }

    /* Responsive Modal */
    .modal-content {
        width: 95%;
        max-width: 448px;
        max-height: 90vh;
        overflow-y: auto;
        /* Scrollable if tall */
    }

    .options-menu {
        right: 24px;
        bottom: 70px;
        position: fixed;
        /* Stick to screen */
    }
}

@media (max-width: 600px) {

    /* Stack day headers on very small screens? Or scroll */
    .day-header-cell h3 {
        font-size: 10px;
    }

    .day-header-cell span {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 18px;
    }
}

/* Holidays */
.holiday-label {
    font-size: 11px;
    color: #34a853;
    /* Holiday Green */
    font-weight: 500;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-header-cell.is-holiday span.holiday-circle {
    background: #e6f4ea;
    /* Light green bg */
    color: #137333;
}

/* If today AND holiday, today wins color usually, or holiday wins. Let holiday win text */
.day-header-cell.is-today.is-holiday h3 {
    color: #137333;
}

/* Mini Cal Holiday Indicator */
.calendar-day.has-holiday {
    color: #34a853;
    font-weight: 500;
}

.calendar-day.has-holiday.today {
    color: #202124;
    /* keep black on blue circle */
}

/* Floating Documentation Button */
.doc-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 1000;
}

.doc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background-color: #1557b0;
}