:root {
    --bg-color: #f0f4f8;
    --text-color: #1e293b;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --font-family: "Outfit", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* Allow footer to sit at bottom */
    justify-content: flex-start; /* Top align */
    align-items: center;
    color: var(--text-color);
    padding: 10px; /* Small outer padding */
}

.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 100%; /* Full width */
    margin: 50px;
    padding: 20px;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
    flex: 1; /* Take up remaining space */
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.calendar-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
    text-transform: capitalize;
}

/* View Switcher */
.view-switch {
    background: white;
    padding: 4px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
}

.switch-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
}

.switch-btn.active {
    background: var(--primary-color);
    color: white;
}

.nav-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    color: var(--text-color);
}

.nav-btn:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    color: white;
}

.today-btn {
    border-radius: 20px;
    width: auto;
    padding: 0 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px; /* Slightly tighter gap */
    flex: 1; /* Fill container */
    overflow-y: auto; /* Scroll if needed within grid area */
}

.day-name {
    text-align: center;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.day {
    /* removed aspect-ratio: 1 to prevent huge cells on wide screens */
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: relative;
    font-weight: 500;
    border: 1px solid transparent;
    min-height: 120px; /* Sufficient height for content */
    height: 100%; /* Fill the grid cell height */
    opacity: 0.7;
}

.day:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.day.today {
    border: 2px solid var(--primary-color);
    /* background: var(--primary-color); */
    /* color: white; */
    opacity: 1;
}

.day.today:hover {
    border: 4px solid var(--primary-color);
    /* background: var(--primary-hover); */
}

.day.empty {
    background: transparent;
    cursor: default;
}

.event-dots-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
    width: 100%;
    overflow-y: hidden;
    flex: 1; /* Allow it to take available space but not push content weirdly */
}

.day.has-event {
    border-color: transparent; /* Remove border to cleaner look with bars */
}

.event-bar {
    width: 98%;
    padding: 2px 5px;
    margin: 1%;
    background-color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s;
    font-size: 0.7rem;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 4px;
}

.event-bar--visit {
    border: 1px solid rgba(79, 70, 229, 0.6);
}

.event-bar--holiday {
    background-color: transparent !important;
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.8);
}

.event-bar--blocked {
    text-decoration: line-through;
    opacity: 0.6;
}

.event-bar--future {
    background-color: transparent !important;
    color: #4f46e5;
}

.event-bar--status-failed {
    opacity: 0.6;
    text-decoration: line-through;
}

.event-bar--status-changed {
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.6);
}

.event-bar--status-completed {
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.event-bar-overnight-indicator {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.9;
}

.event-bar-overnight-end {
    border-bottom-right-radius: 2px;
    border-bottom-left-radius: 2px;
}

.event-bar-overnight-start {
    border-top-right-radius: 2px;
    border-top-left-radius: 2px;
}

.event-bar:hover {
    transform: scale(1.02);
    z-index: 5;
}

.day.today .event-dot {
    background-color: white;
}

.bg-image {
	position: absolute;
	z-index: -1;
	opacity: 0.05;
	right: -297px;
	transform: scale(-1, 1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    position: relative;
    z-index: 101;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-height: 80vh;
    overflow-y: auto;
}

#eventForm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

#eventForm .form-group,
#eventForm .form-row {
    margin-bottom: 0;
}

#eventForm .modal-actions,
#eventForm .modal-section,
#eventForm .form-group:has(textarea) {
    grid-column: 1 / -1;
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.half {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: white;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-danger:hover {
    background: #fef2f2;
}

.hidden {
    display: none !important;
}

/* Agenda View */
.agenda-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.agenda-group {
    margin-bottom: 20px;
}

.agenda-date {
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 0;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.agenda-item {
    background: white;
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.agenda-merged-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.agenda-merged-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.agenda-item--visit {
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.agenda-item--holiday {
    border-left: 4px solid #f97316;
    background: #fff7ed;
    outline: 1px solid rgba(249, 115, 22, 0.4);
}

.agenda-item--blocked {
    text-decoration: line-through;
    opacity: 0.7;
}

.agenda-item--future {
    background: #ffffff;
    border-style: dashed;
}

.agenda-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.agenda-status-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.agenda-status-changed {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.agenda-status-planned {
    background: rgba(79, 70, 229, 0.12);
    color: #4f46e5;
}

.agenda-status-completed {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.agenda-item:hover {
    transform: translateX(4px);
}

.agenda-time {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
}

.agenda-overnight-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.agenda-item-overnight {
    position: relative;
}

.agenda-item-overnight-end {
    margin-bottom: 0;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.agenda-item-overnight-start {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.agenda-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-color);
}

.agenda-info p {
    font-size: 0.85rem;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #475569;
}

/* Notes Section */
.notes-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
}

.notes-list {
    margin-bottom: 15px;
    max-height: 150px;
    overflow-y: auto;
}

.note-item {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.note-content {
    flex: 1;
    margin-right: 10px;
}

.delete-note {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

.delete-note:hover {
    color: var(--danger-color);
}

.add-note-input {
    display: flex;
    gap: 10px;
}

.add-note-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-small {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background: var(--primary-hover);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    background: rgba(0, 0, 0, 0.3);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    /* padding: 20px; */
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    margin: -20px 50px 0 50px;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: 600;
}

.sidebar-logo {
    height: 150px;
    width: auto;
    max-width: 150px;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    text-align: right;
    padding-right: 10px;
}

.sidebar-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-info h4 {
    font-size: 1rem;
    color: var(--text-color);
}

.user-info p {
    font-size: 0.85rem;
    color: #64748b;
}

.menu-list {
    list-style: none;
    margin-top: 20px;
}

.menu-list li {
    margin-bottom: 10px;
}

.menu-list a {
    display: block;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.2s;
}

.menu-list a:hover {
    background: var(--primary-color);
    color: white;
}

/* Attachments */
.upload-box {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.upload-box input[type="file"] {
    flex: 1;
    font-size: 0.9rem;
    color: #64748b;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.attachment-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.attachment-item .attachment-thumb {
    cursor: pointer;
}

.attachment-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-item.audio-file {
    width: 100%;
    height: auto;
    min-height: 60px;
    padding: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    overflow: visible;
    gap: 10px;
}

.attachment-audio {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.attachment-audio-icon {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
    flex: 0 0 auto;
}

.attachment-audio-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attachment-audio-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-item.audio-file audio {
    width: 100%;
    height: 32px;
}

.attachment-audio-download {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    width: fit-content;
}

.attachment-audio-download:hover {
    text-decoration: underline;
}

.attachment-file {
    display: inline-block;
    font-size: 0.9rem;
    padding: 10px;
    color: var(--primary-color);
    text-decoration: none;
    width: 100%;
}

.attachment-file:hover {
    text-decoration: underline;
}

.attachment-item .remove-attachment {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border: none;
}

/* Lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: min(1000px, 95vw);
    max-height: 90vh;
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    background: white;
}

.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* Large Modal & File Grid */
.large-modal {
    max-width: 800px;
    width: 95%;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.file-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn--unattached {
    border-color: #f59e0b;
    color: #b45309;
}

.filter-btn--unattached.active,
.filter-btn--unattached:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.all-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    overflow-y: auto;
}

.file-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.file-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-card .file-icon {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 2rem;
}

.file-card p {
    font-size: 0.8rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card small {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* Unattached file styling */
.file-card--unattached {
    background: #fef3c7;
    border: 2px dashed #f59e0b;
}

.file-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e0e7ff;
    color: #4338ca;
    margin: 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.agenda-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.agenda-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 600;
}

.input-hint {
    display: block;
    color: #94a3b8;
    font-size: 0.8rem;
    margin-top: 4px;
}

.visually-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.tag-selector {
    position: relative;
}

.tag-selector-toggle {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    text-align: left;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.tag-selector-toggle::after {
    content: "▾";
    font-size: 0.8rem;
    color: #94a3b8;
}

.tag-selector-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.tag-selector-menu.open {
    display: block;
}

.tag-selector.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.tag-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: #1f2937;
    justify-content: space-between;
}

.tag-option:hover {
    background: #f8fafc;
}

.tag-option.selected {
    background: #eef2ff;
    color: #4338ca;
}

.tag-option .checkmark {
    color: #4338ca;
    font-size: 0.8rem;
}

.tag-selector-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 35px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0e7ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.tag-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
}

/* Tag color dot in dropdown */
.tag-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.muted-text {
    color: #94a3b8;
    font-size: 0.85rem;
}

.file-badge--unattached {
    background: #fef3c7;
    color: #b45309;
    font-weight: 600;
}

/* Custom Time Picker - Google Calendar Style */
.time-picker-wrapper {
    position: relative;
}

.time-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    cursor: pointer;
    background: white;
    text-align: center;
    font-weight: 500;
    letter-spacing: 1px;
}

.time-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.time-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.time-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    max-height: 300px;
    width: 250px;
}

.time-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.time-quick-picks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e2e8f0;
}

.time-quick-picks button {
    padding: 8px 4px;
    border: none;
    background: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.time-quick-picks button:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.time-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.time-list::-webkit-scrollbar {
    width: 6px;
}

.time-list::-webkit-scrollbar-track {
    background: transparent;
}

.time-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.time-option {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-color);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-option:hover {
    background: #f1f5f9;
}

.time-option.selected {
    background: var(--primary-color);
    color: white;
}

.time-option .time-value {
    font-weight: 600;
    min-width: 50px;
}

.time-option .time-label {
    font-size: 0.8rem;
    color: #64748b;
}

.time-option.selected .time-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Agenda filter styles */
.agenda-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 15px;
}

.agenda-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
}

.form-group--inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group--flex {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.label-small {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-date,
.select-filter {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    background: white;
    min-width: 130px;
}

.input-date:focus,
.select-filter:focus {
    outline: none;
    border-color: var(--primary-color);
}

.select-modal {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.select-modal:focus {
    outline: none;
    border-color: var(--primary-color);
}

.agenda-export-group {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-clear {
    background: #f1f5f9;
    color: #64748b;
    padding: 8px 12px;
}

.btn-clear:hover {
    background: #e2e8f0;
    color: var(--text-color);
}

.agenda-list {
    flex: 1;
    overflow-y: auto;
}

.modal-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* =============================================
   MOBILE RESPONSIVE STYLES
   ============================================= */

/* Tablet and below */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .app-container {
        border-radius: 16px;
        padding: 15px;
    }

    /* Calendar Header */
    .calendar-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }

    .calendar-header h1 {
        font-size: 1.3rem;
        order: 1;
        flex: 1;
        text-align: center;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }

    .view-switch {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .switch-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    /* Calendar Grid - Mobile */
    .calendar-grid {
        gap: 4px;
    }

    .day-name {
        font-size: 0.7rem;
        letter-spacing: 0;
        margin-bottom: 5px;
    }

    .day {
        min-height: 80px;
        padding: 4px;
        border-radius: 8px;
        font-size: 0.85rem;
    }

    .event-bar {
        font-size: 0.65rem;
        padding: 2px 4px;
        border-radius: 3px;
    }

    .event-dots-container {
        gap: 1px;
    }

    /* Agenda Controls - Mobile */
    .agenda-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .form-group--inline {
        width: 100%;
    }

    .input-date,
    .select-filter {
        width: 100%;
        min-width: unset;
    }

    .form-group--flex {
        width: 100%;
    }

    .form-group--flex > div {
        flex: 1;
    }

    .agenda-export-group {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .agenda-export-group .btn-small {
        flex: 1;
    }

    /* Agenda Items */
    .agenda-item {
        padding: 12px;
        gap: 10px;
    }

    .agenda-time {
        min-width: 60px;
        font-size: 0.8rem;
    }

    .agenda-info h3 {
        font-size: 0.95rem;
    }

    .agenda-info p {
        font-size: 0.8rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 20px;
        border-radius: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group.half {
        width: 100%;
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 1rem;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 10px;
        margin-top: 20px;
    }

    .modal-actions .btn {
        width: 100%;
    }

    /* Time Picker Mobile */
    .time-picker-wrapper {
        position: static;
    }

    .time-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 24px 24px 0 0;
        max-height: 60vh;
        transform: translateY(100%);
    }

    .time-dropdown.active {
        transform: translateY(0);
    }

    .time-quick-picks {
        padding: 16px;
        gap: 8px;
    }

    .time-quick-picks button {
        padding: 12px 8px;
        font-size: 0.9rem;
    }

    .time-list {
        max-height: 40vh;
        padding: 12px;
    }

    .time-option {
        padding: 14px 16px;
    }

    /* Sidebar Mobile */
    .sidebar {
        width: 100%;
    }

    /* Notes Section */
    .add-note-input {
        flex-direction: column;
        gap: 8px;
    }

    .add-note-input input {
        width: 100%;
    }

    /* Upload Box */
    .upload-box {
        flex-direction: column;
        gap: 8px;
    }

    .upload-box input[type="file"] {
        width: 100%;
    }

    /* Page Body */
    .page-body {
        padding: 15px;
    }

    /* Settings Page - Event Types */
    .card {
        padding: 20px;
        border-radius: 16px;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .form-row.form-row--align-end {
        flex-direction: column;
        gap: 10px;
    }

    .form-row.form-row--align-end .form-group--inline {
        width: 100%;
    }

    .form-row.form-row--align-end .form-group--color {
        width: 100%;
    }

    .form-row.form-row--align-end .btn {
        width: 100%;
        margin-left: 0;
    }

    .event-type-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .event-type-form {
        flex-wrap: wrap;
        gap: 10px;
    }

    .event-type-form .edit-picker-container {
        order: 1;
    }

    .event-type-form .input-inline {
        order: 2;
        flex: 1;
        min-width: 150px;
    }

    .event-type-form .btn-save-small {
        order: 3;
    }

    .event-type-delete {
        margin-left: 0;
        text-align: right;
    }

    /* Backups Page - Responsive Table */
    .card-bordered {
        border-radius: 12px;
    }

    .data-table {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: block;
    }

    .data-table tbody tr {
        display: block;
        padding: 15px;
        margin-bottom: 10px;
        background: #f8fafc;
        border-radius: 12px;
        border: none;
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .data-table td:last-child {
        border-bottom: none;
        padding-top: 12px;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.85rem;
    }

    .data-table td.td--actions {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }

    .data-table td.td--actions::before {
        display: none;
    }

    .data-table td.td--empty {
        display: block;
        text-align: center;
    }

    .btn-small {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* Back Button */
    .back-btn {
        font-size: 0.9rem;
        padding: 0 12px;
        height: 36px;
        display: flex;
        align-items: center;
    }

    /* Large Modal (Files) */
    .large-modal {
        width: 98%;
        height: 85vh;
        padding: 15px;
    }

    .all-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .file-card {
        padding: 8px;
    }

    .file-card p {
        font-size: 0.7rem;
    }

    .tag-selector-chips {
    margin-top: 8px;
}
}

/* Small Mobile (< 400px) */
@media (max-width: 400px) {
    .calendar-header h1 {
        font-size: 1.1rem;
    }

    .day {
        min-height: 65px;
        font-size: 0.8rem;
    }

    .day-name {
        font-size: 0.6rem;
    }

    .event-bar {
        font-size: 0.55rem;
    }

    .time-quick-picks {
        grid-template-columns: repeat(4, 1fr);
    }

    .switch-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    #eventForm {
        grid-template-columns: 1fr;
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 95vh;
        padding: 15px;
    }

    .time-dropdown {
        max-height: 80vh;
    }

    .time-list {
        max-height: 50vh;
    }
}

/* Custom Confirm Dialog */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.confirm-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirm-dialog h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.confirm-dialog p {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.confirm-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.confirm-btn-cancel:hover {
    background: #e2e8f0;
}

.confirm-btn-confirm {
    background: var(--danger-color);
    color: white;
}

.confirm-btn-confirm:hover {
    background: #dc2626;
}

.confirm-btn-confirm.primary {
    background: var(--primary-color);
}

.confirm-btn-confirm.primary:hover {
    background: var(--primary-hover);
}
