:root {
    /* Material Design (Android) Inspired Palette */
    --primary: #4285F4; /* Google Blue */
    --primary-variant: #3367D6;
    --secondary: #0F9D58; /* Google Green for other accents if needed */
    --task-color: #37cfdc; /* Keep task color */
    --focus-color: #4a56ff; /* Keep focus color */
    --meeting-color: #8E24AA; /* Professional Purple for Meetings */
    --background: #f8f9fa;
    --surface: #ffffff;
    --on-primary: #ffffff;
    --on-surface: #202124;
    --on-surface-variant: #5f6368;
    --outline: #f1f3f4;
    --ripple-color: rgba(0, 0, 0, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    --card-radius: 28px;
    --button-radius: 24px;
}
/* Add this to your style.css before building the APK */
html, body {
    /* Prevents the user from "pulling" the page down and seeing a white gap */
    overscroll-behavior-y: none !important; 
    
    /* Prevents the gray highlight box when tapping buttons on Android */
    -webkit-tap-highlight-color: transparent !important;
    
    /* Makes it feel like a solid app UI */
    user-select: none !important;
}
#login-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 5000 !important; /* Highest possible */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Animated Background Blobs */
.bg-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    animation: float 20s infinite alternate;
}

.blob-1 { top: -100px; left: -100px; background: radial-gradient(circle, rgba(66, 133, 244, 0.12) 0%, transparent 70%); }
.blob-2 { bottom: -150px; right: -100px; background: radial-gradient(circle, rgba(52, 168, 83, 0.08) 0%, transparent 70%); animation-delay: -5s; }
.blob-3 { top: 20%; right: 10%; background: radial-gradient(circle, rgba(251, 188, 5, 0.05) 0%, transparent 70%); animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

/* The Login Card */
.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 90%;
    max-width: 420px;
    padding: 60px 45px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: cardEntrance 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.brand-section {
    position: relative;
    margin-bottom: 28px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.08));
}

.login-card h2 {
    color: #1f2937;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.login-card p {
    color: #6b7280;
    font-size: 1rem;
    margin-bottom: 40px;
    line-height: 1.5;
}

/* The Premium Google Button */
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 14px 24px;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-google:hover {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    transform: translateY(-2px);
}

.btn-google:active {
    transform: translateY(0);
    background: #f9fafb;
}

.google-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-footer {
    margin-top: 32px;
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Mobile Adjustments for APK */
@media (max-width: 480px) {
    .login-card {
        padding: 45px 30px;
        width: 85%;
    }
    
    .login-card h2 { font-size: 1.5rem; }
}
.hidden { display: none !important; }


/* Ensure your top-bar doesn't hit the phone's camera hole/notch */
.top-bar {
    padding-top: 1rem !important;
}
html { font-size: 14px; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', 'Roboto', sans-serif; outline: none; transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, box-shadow 0.2s ease; }
body { background-color: var(--background); color: var(--on-surface); height: 100vh; overflow: hidden; position: relative; width: 100%; }

button, .view-item, .attachment-card-item, .event-card, .mini-day, .type-btn, .menu-item { cursor: pointer; }
button:active, .view-item:active, .type-btn:active { transform: scale(0.97); }

#app-container { display: flex; height: 100vh; width: 100vw; }

/* Sidebar */
.sidebar {
    
    width: var(--sidebar-width);
    background: #f8f9fa;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    border-right: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); padding: 25px 10px; }

.sidebar.collapsed .brand-name, 
.sidebar.collapsed .create-btn, 
.sidebar.collapsed .mini-calendar, 
.sidebar.collapsed .sidebar-section { display: none; }

.sidebar-header { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; overflow: hidden; }
.brand-wrapper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sidebar-logo { height: 3rem; width: 3rem; object-fit: contain; }

.sidebar.collapsed .sidebar-header { justify-content: center; padding-left: 0; }
.sidebar.collapsed .sidebar-logo { height: 2.5rem; width: 2.5rem; }

.toggle-btn { 
    background: none; 
    border: none; 
    cursor: pointer; 
    color: var(--on-surface-variant); 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
}
.sidebar.collapsed .toggle-btn { padding: 2px; }
.sidebar.collapsed .toggle-btn span { font-size: 20px; }

.brand-text { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.5px; }
.toggle-btn:hover { color: var(--primary); }

.create-btn {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: none;
    padding: 16px 24px;
    border-radius: 28px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 30px;
    color: var(--on-surface);
    border-top: 1px solid #ffffff;
    border-bottom: 1px solid rgba(60,64,67,0.2);
}
.sidebar.collapsed .create-btn {
    padding: 12px;
    justify-content: center;
}
.create-btn:hover { background: #f1f3f4; }
.create-btn span.material-symbols-rounded { font-size: 24px; color: var(--primary); }

/* Mini Calendar & Filters */
.mini-calendar { margin-bottom: 30px; padding: 10px;}
.mini-cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; font-size: 0.9rem; }
.mini-cal-nav { display: flex; align-items: center; gap: 2px; }
.mini-cal-nav .icon-btn { padding: 4px; }
.sidebar-section h3 { font-size: 0.85rem; text-transform: uppercase; color: var(--on-surface-variant); margin-bottom: 15px; letter-spacing: 0.5px; }
.calendar-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.95rem; }
.calendar-filter input { accent-color: var(--cal-color); width: 16px; height: 16px; cursor: pointer; }
.calendar-filter label { cursor: pointer; flex: 1; }

/* Mini Calendar Grid */
.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}
.mini-day-name { font-size: 0.7rem; color: var(--on-surface-variant); font-weight: 600; margin-bottom: 5px; }
.mini-day {
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    cursor: pointer;
}
.mini-day:hover { background: #e8f0fe; }
.mini-day.current-month-day { color: var(--on-surface); }
.mini-day.other-month-day { color: #ccc; }
.mini-day.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.mini-day.selected-day {
    background-color: #d2e3fc;
    color: var(--primary-variant);
    font-weight: 700;
}

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; position: relative; }

.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--outline);
    z-index: 2000; /* Ensure top bar stays above calendar grid */
}

.action-group-desktop {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar-left, .top-bar-right { 
    display: flex; align-items: center; gap: 15px; flex-shrink: 0; 
    transition: opacity 0.3s ease, width 0.3s ease, margin 0.3s ease, visibility 0.3s ease, gap 0.3s ease;
}

.search-container {
    position: relative;
    width: 40px;
    height: 40px;
    max-width: 40px;
    min-width: 40px;
    background: #f1f3f4;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s, padding 0.3s, border-radius 0.4s;
    overflow: visible; /* Allow the results dropdown to spill out */
}

.search-container input {
    border: none; 
    background: transparent; 
    padding: 0; 
    width: 0; 
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s, width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s;
    pointer-events: none;
}

#close-search { margin-left: auto; }

/* Expanded state on top-bar */
.top-bar.search-active .top-bar-left {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    visibility: hidden;
    overflow: hidden;
}

.top-bar.search-active .top-bar-right { flex: 1; gap: 0; }

.top-bar.search-active .search-container {
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid var(--outline);
    padding: 0 8px 0 16px;
    height: 48px;
    cursor: default;
    justify-content: flex-start;
    border-radius: 8px;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--outline);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 5000;
    display: none;
    padding: 8px 0;
    color: var(--on-surface);
}

.top-bar.search-active .search-results-dropdown:not(:empty) {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f1f3f4;
}

/* Visual connection between search bar and results card */
.top-bar.search-active .search-container:has(.search-results-dropdown:not(:empty)) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.search-result-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.top-bar.search-active .top-bar-right > *:not(.search-container) {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    visibility: hidden;
    overflow: hidden;
}

.top-bar.search-active .search-container input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    padding: 12px;
}

.nav-controls { display: flex; align-items: center; gap: 5px; }
.date-picker-input, .btn-today, .dropdown-btn {
    display: inline-flex;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.05);
    border-top-color: rgba(255,255,255,0.8);
    border-bottom-color: rgba(0,0,0,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--on-surface);
    background: var(--surface);
    cursor: pointer;
}
.btn-today:hover, .dropdown-btn:hover { background: #f8f9fa; border-color: var(--on-surface-variant); }

.icon-btn { background: none; border: none; cursor: pointer; color: var(--on-surface); display: flex; align-items: center; justify-content: center; border-radius: 50%; padding: 8px; }
.icon-btn:hover { background: rgba(0,0,0,0.05); }
#mobile-menu-toggle { display: none; }

/* Dropdown Styles */
.dropdown-wrapper { position: relative; }
.dropdown-menu { 
    position: absolute; top: 100%; right: 0; 
    background: #ffffff; 
    border: 1px solid var(--outline); border-radius: 12px; padding: 15px; 
    width: 200px; display: none; z-index: 1001; margin-top: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.dropdown-menu.show { display: block; }

/* Calendar Dropdown Specifics */
.calendar-filter { 
    padding: 8px; 
    border-radius: 8px; 
    transition: 0.2s; 
}
.calendar-filter:hover { background: #f1f3f4; }
.calendar-filter input { width: 18px; height: 18px; }
.cal-color-dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    display: inline-block; 
    margin-right: 4px;
    background-color: var(--cal-color);
}

/* View Dropdown */
#view-dropdown-btn { min-width: 100px; justify-content: space-between; text-transform: capitalize; }
#view-dropdown-btn::after { content: 'arrow_drop_down'; font-family: 'Material Symbols Rounded'; font-weight: normal; }
#view-dropdown-menu { width: 120px; padding: 5px; }
.view-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.9rem; text-transform: capitalize;}
.view-item:hover { background: #e8f0fe; }
.view-item.active { background: #d2e3fc; color: var(--primary-variant); }

.user-pill img { width: 36px; height: 36px; border-radius: 50%; }

/* Calendar Grid */
.calendar-grid-wrapper { 
    margin-right: 0;
    border-radius: 0;
    flex: 1; display: flex; flex-direction: column; overflow: hidden; 
    background: var(--surface); 
}
@media (min-width: 1024px) {
    .calendar-grid-wrapper { margin-right: 2rem; border-radius: 27px; }
}

.days-header-row { display: flex; border-bottom: 1px solid var(--outline); padding-left: 60px; /* Space for time col */ }
.day-col { flex: 1; text-align: center; padding: 15px 0; }
.day-col.active .day-num { background: var(--primary); color: var(--on-primary); }
.day-name { display: block; font-size: 0.8rem; color: var(--on-surface-variant); font-weight: 500; margin-bottom: 4px; }
.day-num { display: inline-block; width: 32px; height: 32px; line-height: 32px; border-radius: 50%; font-size: 1.1rem; font-weight: 700; }

.grid-body { flex: 1; display: flex; overflow-y: auto; position: relative; }
.time-column { width: 70px; border-right: 1px solid var(--outline); flex-shrink: 0; position: relative; height: 1440px; background: #fafafa; }
.time-slot { position: absolute; width: 100%; height: 60px; font-size: 0.7rem; color: #70757a; text-align: right; padding-right: 12px; transform: translateY(-50%); pointer-events: none; }

.grid-cells { flex: 1; position: relative; height: 1440px; background-size: 100% 60px; background-image: linear-gradient(to bottom, var(--outline) 1px, transparent 1px); border-bottom: 1px solid var(--outline); }

.calendar-grid-wrapper.week-view .grid-cells {
    background-image: linear-gradient(to bottom, var(--outline) 1px, transparent 1px), linear-gradient(to right, var(--outline) 1px, transparent 1px);
    background-size: 100% 60px, calc(100% / 7) 100%;
}

/* Current Time Line */
#current-time-line {
    position: absolute;
    height: 2px;
    background: #ea4335;
    z-index: 20;
    pointer-events: none;
}
#current-time-line::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -5px;
    width: 12px;
    height: 12px;
    background: #ea4335;
    border-radius: 50%;
}

/* Events */
.event-card {
    position: absolute;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
    overflow: hidden;
    cursor: pointer;
    border-left: 4px solid rgba(0,0,0,0.2);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), left 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    touch-action: none; /* Critical for mobile dragging */
    user-select: none;
    will-change: top, left, transform;
}

/* Dragging State */
.event-card.dragging {
    opacity: 0.7;
    z-index: 5000 !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    cursor: grabbing;
    transition: none !important; /* Remove transitions while actively following the finger/mouse */
    transform: scale(1.02);
}

/* Expansion logic for shrunken events */
.event-card:not(.dragging):hover, 
.event-card:not(.dragging).mobile-expanded {
    width: calc(var(--day-width) - 4px) !important;
    left: calc(var(--day-left) + 2px) !important;
    z-index: 1000 !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.event-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Right Sidebar */
.right-sidebar {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden by default */
    width: 350px;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--outline);
    z-index: 3100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 25px;
}
.right-sidebar.open { right: 0; }

/* Join Meeting Button (Meet Style) */
.btn-join-meeting {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    text-decoration: none;
    transition: 0.2s;
}
.btn-join-meeting:hover { background: var(--primary-variant); }

.right-sidebar-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 30px; }
.right-sidebar-header h3 { font-size: 1.4rem; font-weight: 700; color: var(--on-surface); line-height: 1.3; }

.right-sidebar-content { flex: 1; overflow-y: auto; }
.rs-row { display: flex; gap: 15px; margin-bottom: 20px; color: var(--on-surface); font-size: 0.95rem; line-height: 1.5; }
.rs-row span.material-symbols-rounded { color: var(--on-surface-variant); font-size: 20px; margin-top: 2px; }
#rs-desc { white-space: pre-wrap; color: var(--on-surface-variant); }

.right-sidebar-footer {
    margin-top: auto;
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--outline);
}

.btn-delete-outline {
    flex: 1;
    padding: 10px;
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    background: var(--surface);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: 0.2s;
}
.btn-delete-outline:hover { background: #fff0f0; }

.btn-edit-primary {
    flex: 1;
    padding: 10px;
    background: var(--primary-variant);
    color: var(--on-primary);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: 0.2s;
}
.btn-edit-primary:hover { opacity: 0.9; }

/* Event Types Styling */
.event-card.type-task { background: var(--task-color); border-radius: 4px; }
.event-card.type-focus { background: var(--focus-color); }

/* Google Event Indicator */
.google-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #00ff00; /* Bright Green */
    border-radius: 50%;
    margin-right: 5px;
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-card { 
    background: #ffffff;
    width: 95%; max-width: 500px; border-radius: var(--card-radius); padding: 20px; border: 1px solid var(--outline); animation: fadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-title-input { font-size: 1.5rem; font-weight: 700; border: none; border-bottom: 2px solid var(--outline); background: transparent; width: 100%; padding-bottom: 5px; transition: border-bottom-color 0.2s; }
.modal-title-input:focus { border-bottom-color: var(--primary); }
.modal-close-icon { background: none; border: none; cursor: pointer; color: var(--on-surface-variant); }

.modal-row { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; color: var(--on-surface); }

/* Custom Time Selector (jj.png style) */
.custom-time-selector { display: flex; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }

.date-display-wrapper, .time-display-wrapper {
    background: #f1f3f4; /* Material input fill color */
    border-radius: 8px;
    padding: 10px 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid transparent;
    transition: border-bottom-color 0.2s;
    cursor: pointer;
}

.date-display-wrapper { flex: 1; min-width: 150px; }
.time-display-wrapper { width: 100px; }

.date-display-wrapper:focus-within, .time-display-wrapper:focus-within { border-bottom-color: var(--primary); }

#date-display-text { font-weight: 500; font-size: 0.95rem; color: var(--on-surface); pointer-events: none; }

/* Custom Picker Dropdowns */
.custom-picker-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 12px;
    z-index: 2000;
    padding: 10px;
    display: none;
}
.custom-picker-dropdown.show { display: block; }

.time-picker-list {
    max-height: 250px;
    overflow-y: auto;
    width: 120px;
}
.time-option {
    padding: 10px;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
}
.time-option:hover { background: #f1f3f4; color: var(--primary); }
.time-option.selected { background: #e8f0fe; color: var(--primary); font-weight: 700; }

.date-picker-container { width: 250px; }
.date-picker-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }

#event-start-time, #event-end-time { font-weight: 500; font-size: 0.95rem; }

.modal-textarea {
    flex: 1;
    border: none;
    background: #f1f3f4;
    padding: 10px;
    border-radius: 8px;
    min-height: 80px;
    resize: vertical;
    font-family: 'Roboto', sans-serif;
}
.event-type-selector { display: flex; gap: 10px; margin-bottom: 20px; }
.type-btn { padding: 6px 12px; border: 1px solid var(--outline); background: var(--surface); border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 5px; font-size: 0.9rem; }
.type-btn.active { background: #e8f0fe; color: var(--primary); border-color: var(--primary); }

.modal-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.btn-save { 
    background: var(--primary); color: var(--on-primary); border: none; 
    padding: 10px 25px; border-radius: var(--button-radius); 
    font-weight: 600; cursor: pointer; 
    border-top: 1px solid rgba(255,255,255,0.3);
}

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

.mobile-only { display: none; }

/* Mobile Sidebar Overlay */
.mobile-overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-overlay-bg.show { opacity: 1; visibility: visible; }

.menu-item {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    font-weight: 500;
}
.menu-item:hover { background: #f1f3f4; }
.menu-item span { color: var(--on-surface-variant); }

/* --- MOBILE OVERRIDES & VERTICAL SCROLL FIX --- */
@media (max-width: 768px) {
    body { position: fixed; width: 100%; height: 100%; }
    #app-container { flex-direction: column; }

    .sidebar { position: fixed; transform: translateX(-100%); height: 100%; z-index: 3000; width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 15px rgba(0,0,0,0.2); }
    #mobile-menu-toggle { display: flex; }

    .top-bar { padding: 8px 12px; height: 60px; gap: 8px; }
    .top-bar-left { flex: 1; min-width: 0; gap: 8px; }
    .top-bar-right { gap: 8px; }
    
    .btn-today span:last-child { display: none; }
    .btn-today { padding: 8px; background: transparent; border: none; }
    
    .date-picker-input { font-size: 0.85rem; width: 110px; padding: 4px; border: none; background: transparent; }
    
    .action-group-desktop { display: none; } /* Hide sync/cal/view from top bar */
    .mobile-only { display: block; } /* Show 3-dot menu */

    /* CALENDAR SCROLLING LOGIC */
    .calendar-grid-wrapper { 
        overflow-x: auto; 
        display: flex; 
        flex-direction: column; 
        flex: 1; 
        -webkit-overflow-scrolling: touch;
    }
    .fab {
    display: flex;
    position: fixed;
    bottom: 24px; /* Increased slightly for better thumb reach */
    right: 24px;
    width: 56px;
    height: 56px;
    background-color: var(--primary);
    color: var(--on-primary);
    border-radius: 16px; /* MD3 uses slightly squarer circles for FABs */
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    
    /* --- The Google Shadow --- */
    /* Layer 1: A soft blue glow. Layer 2: A deeper structural shadow */
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25), 
                0 1px 3px rgba(66, 133, 244, 0.15) !important;
                
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s ease !important;
}

/* Add a hover/active effect so it feels like a real app button */
.fab:hover {
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.35) !important;
    transform: translateY(-2px);
}

.fab:active {
    transform: scale(0.92); /* Shrinks slightly when tapped for haptic feel */
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.2) !important;
}
    .days-header-row { 
        min-width: 800px; 
        position: sticky; 
        top: 0; 
        z-index: 100; 
        background: var(--surface); 
        padding-left: 50px; 
    }
    .grid-body { 
        flex: 1; 
        display: flex; 
        min-width: 800px; 
        overflow-y: auto; 
        overflow-x: hidden; 
    }
    .time-column { position: sticky; left: 0; z-index: 110; width: 50px; background: #f8f9fa; box-shadow: 2px 0 5px rgba(0,0,0,0.05); }
    .grid-cells { flex: 1; min-width: 750px; }

.top-bar {
        z-index: 2000 !important;
        position: relative !important;
    }

    /* 2. Fix the Dropdown to ensure it sits on top of EVERYTHING */
    .dropdown-menu.show {
        position: fixed !important; /* Changed from absolute to fixed to break out of any parent containers */
        top: 70px !important; /* Slightly more space from the top bar */
        right: 15px !important;
        left: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 240px !important;
        max-width: 90vw !important;
        
        /* High Z-index to beat the sticky date headers */
        z-index: 9999 !important; 
        
        /* Modern styling */
        background: var(--surface) !important;
        border-radius: 16px !important;
        box-shadow: 0 12px 40px rgba(0,0,0,0.2) !important;
        border: 1px solid var(--outline) !important;
        
        /* Prevent it from being cut off if the page is short */
        max-height: 80vh !important;
        overflow-y: auto !important;
    }

    /* 3. Ensure the horizontal line (likely part of the header row) is lower than the dropdown */
    .days-header-row {
        z-index: 100 !important; /* Much lower than the dropdown's 9999 */
    }
     .right-sidebar { width: 100%; right: -105%; z-index: 3500; }
}

   

    .top-bar.search-active .search-container {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 44px !important;
        z-index: 200;
        margin: 0 !important;
    }


/* Mobile FAB */
@media (max-width: 768px) {
    #sidebar-create-btn { display: none; } /* Hide sidebar button on mobile */
.fab {
    display: flex;
    position: fixed;
    bottom: 24px; /* Increased slightly for better thumb reach */
    right: 24px;
    width: 56px;
    height: 56px;
    background-color: var(--primary);
    color: var(--on-primary);
    border-radius: 16px; /* MD3 uses slightly squarer circles for FABs */
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    
    /* --- The Google Shadow --- */
    /* Layer 1: A soft blue glow. Layer 2: A deeper structural shadow */
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25), 
                0 1px 3px rgba(66, 133, 244, 0.15) !important;
                
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s ease !important;
}

/* Add a hover/active effect so it feels like a real app button */
.fab:hover {
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.35) !important;
    transform: translateY(-2px);
}

.fab:active {
    transform: scale(0.92); /* Shrinks slightly when tapped for haptic feel */
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.2) !important;
}
}

/* --- Month View --- */
.calendar-grid-wrapper.month-view .time-column {
    display: none;
}

.calendar-grid-wrapper.month-view .days-header-row {
    padding-left: 0;
}

.calendar-grid-wrapper.month-view .grid-body {
    overflow-y: hidden; /* Month view shouldn't scroll vertically like week view */
}

.calendar-grid-wrapper.month-view .grid-cells {
    height: auto; /* Reset height for month view */
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr); /* 6 rows to accommodate all month layouts */
    background-image: none; /* Remove week view lines */
    border-left: 1px solid var(--outline);
}

.month-day-cell {
    padding: 8px;
    border-right: 1px solid var(--outline);
    border-top: 1px solid var(--outline);
    overflow: hidden;
    position: relative;
}

.month-day-cell .day-num {
    font-size: 0.9rem;
    font-weight: 600;
}

.month-day-cell.today .day-num {
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    display: inline-block;
}

.month-day-cell.other-month {
    color: var(--on-surface-variant);
    background: #fafafa;
}

.month-event-list {
    margin-top: 5px;
}

.month-event {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary);
    color: var(--on-primary);
    margin-bottom: 3px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.month-more-link {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    padding: 2px 6px;
    display: block;
}
.month-more-link:hover { text-decoration: underline; }

.month-event.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    cursor: grabbing;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast-notification {
    pointer-events: auto;
    background: #323232;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastSlideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
    font-size: 0.9rem;
    min-width: 280px;
}

.toast-close { cursor: pointer; font-size: 18px; opacity: 0.7; transition: opacity 0.2s; }
.toast-close:hover { opacity: 1; }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-notification.fade-out { opacity: 0; transform: translateY(10px); transition: opacity 0.4s, transform 0.4s; }

.month-event.type-personal { background: var(--primary); }
.month-event.type-task { background: var(--task-color); }
.month-event.type-focus { background: var(--focus-color); }
.month-event.type-meeting { background: var(--meeting-color); }

/* --- FULL PROFESSIONAL LOGIN UPGRADE --- */

#login-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 5000 !important; /* Highest possible */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Animated Background Blobs */
.bg-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    animation: float 20s infinite alternate;
}

.blob-1 { top: -100px; left: -100px; background: radial-gradient(circle, rgba(66, 133, 244, 0.12) 0%, transparent 70%); }
.blob-2 { bottom: -150px; right: -100px; background: radial-gradient(circle, rgba(52, 168, 83, 0.08) 0%, transparent 70%); animation-delay: -5s; }
.blob-3 { top: 20%; right: 10%; background: radial-gradient(circle, rgba(251, 188, 5, 0.05) 0%, transparent 70%); animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

/* The Login Card */
.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 90%;
    max-width: 420px;
    padding: 60px 45px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: cardEntrance 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.brand-section {
    position: relative;
    margin-bottom: 28px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.08));
}

.login-card h2 {
    color: #1f2937;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.login-card p {
    color: #6b7280;
    font-size: 1rem;
    margin-bottom: 40px;
    line-height: 1.5;
}

/* The Premium Google Button */
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 14px 24px;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-google:hover {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    transform: translateY(-2px);
}

.btn-google:active {
    transform: translateY(0);
    background: #f9fafb;
}

.google-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-footer {
    margin-top: 32px;
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Mobile Adjustments for APK */
@media (max-width: 480px) {
    .login-card {
        padding: 45px 30px;
        width: 85%;
    }
    
    .login-card h2 { font-size: 1.5rem; }
}
.hidden { display: none !important; }

/* Sync Overlay */
#sync-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.95); z-index: 2100; display: flex; align-items: center; justify-content: center; }
.sync-card { background: var(--surface); padding: 40px; border-radius: var(--card-radius); border: 1px solid var(--outline); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 300px; }
.sync-spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Attachments */
.attachment-chip {
    display: inline-flex;
    align-items: center;
    background: #e8f0fe;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    margin-right: 8px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: 0.2s;
}
.attachment-chip:hover {
    background: #d2e3fc;
    border-color: var(--primary);
}
.attachment-chip .remove-attach {
    margin-left: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    color: var(--primary);
    opacity: 0.7;
}
.attachment-chip .remove-attach:hover { opacity: 1; }

.attachment-actions { display: flex; gap: 10px; margin-top: 5px; }
.btn-small { padding: 6px 12px; border: 1px solid var(--outline); border-radius: 8px; background: var(--surface); font-size: 0.8rem; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.2s; color: var(--on-surface); }
.btn-small:hover { background: #f1f3f4; border-color: var(--on-surface-variant); }

/* Note Selection Modal */
#note-selection-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1200; display: none; align-items: center; justify-content: center; }
.note-selection-card { background: var(--surface); width: 90%; max-width: 400px; max-height: 80vh; border-radius: var(--card-radius); padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--outline); }
.note-list-container { flex: 1; overflow-y: auto; margin-top: 15px; border-top: 1px solid var(--outline); }
.note-select-item { padding: 12px; border-bottom: 1px solid var(--outline); cursor: pointer; transition: 0.2s; }
.note-select-item:hover { background: #f8f9fa; }
.note-select-item:last-child { border-bottom: none; }
.note-select-title { font-weight: 600; font-size: 0.95rem; color: var(--on-surface); margin-bottom: 4px; }
.note-select-preview { font-size: 0.8rem; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Right Sidebar Attachments */
.attachment-link {
    display: block;
    padding: 8px 12px;
    background: #f1f3f4;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--on-surface);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}
.attachment-link:hover { border-color: var(--outline); background: #e8eaed; }

/* Note View Modal Card */
.note-view-card {
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.note-view-card .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.note-view-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    line-height: 1.6;
    color: var(--on-surface);
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 1rem;
    border: 1px solid var(--outline);
    min-height: 200px;
    flex: 1;
}

/* Attachment Cards in Sidebar */
.attachment-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.attachment-card-item:hover {
    background: #f8f9fa;
    border-color: var(--primary);
}
.attachment-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #e8f0fe;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.attachment-info { flex: 1; overflow: hidden; }
.attachment-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-type { font-size: 0.75rem; color: var(--on-surface-variant); margin-top: 2px; }


/* =========================================
   📱 KOMU CALENDAR: MOBILE OVERRIDES
   Paste this at the very bottom of style.css
   ========================================= */
@media screen and (max-width: 768px) {
    /* 1. Lock the viewport to prevent unwanted bouncing */
    body, html {
        overflow: hidden !important;
        width: 100% !important;
        height: 100% !important;
    }

    #app-container {
        flex-direction: column !important;
        width: 100vw !important;
    }

    /* 2. Force the Calendar Wrapper to Scroll Horizontally */
    .calendar-grid-wrapper {
        display: block !important; /* Remove flex to allow native block scrolling */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling for iOS */
        position: relative !important;
        flex: 1 !important;
    }

    /* 3. Give the Grid a rigid Minimum Width so it stops squishing */
    /* 800px gives 7 days about ~114px each, giving plenty of room for events */
    .days-header-row {
        min-width: 800px !important;
        display: flex !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: var(--surface) !important;
        padding-left: 50px !important; /* Room for the sticky time column */
    }

    .grid-body {
        min-width: 800px !important;
        display: flex !important;
        overflow-y: auto !important; /* Allow vertical scrolling for the hours */
        overflow-x: hidden !important;
        height: calc(100vh - 120px) !important; /* Approximate height minus top bars */
    }

    /* 4. Fix the Grid Cells */
    .grid-cells {
        min-width: 750px !important; /* 800px total minus 50px for the time column */
        flex: 1 !important;
    }
    .date-picker-input{
        display: none !important;
    }
    /* 5. Make the Time Column Sticky on the left */
    .time-column {
        position: fixed !important;
        left: 0 !important;
        z-index: 90 !important;
        width: 50px !important;
        min-width: 50px !important;
        background: #fafafa !important;
        border-right: 1px solid var(--outline) !important;
        box-shadow: 2px 0 5px rgba(0,0,0,0.05) !important;
    }

    /* 6. Lock in Top Bar dimensions */
    .top-bar {
        height: 60px !important;
        padding: 8px 10px !important;
        flex-shrink: 0 !important;
    }
}