:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #0f0f23;
    --surface: #1a1b2e;
    --surface-light: #2d2e44;
    --surface-lighter: #3a3b5c;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #6b7280;
    --border: #374151;
    --border-light: #4b5563;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    touch-action: manipulation;
}

/* Calendar Container */
.calendar-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    height: 100vh;
    gap: 0;
}

/* Header */
.calendar-header {
    grid-column: 1 / -1;
    background: var(--surface);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 8px;
    display: block;
}

.ecosystem-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ecosystem-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.ecosystem-links a:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.header-right {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Navigation */
.calendar-navigation {
    grid-column: 1 / -1;
    background: var(--surface-light);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.nav-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.current-month {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 150px;
    text-align: center;
}

.today-btn {
    margin-left: auto;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Calendar Views */
.calendar-views {
    grid-column: 1;
    background: var(--surface);
    padding: 15px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Month View */
.weekdays-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 8px;
}

.weekday {
    text-align: center;
    padding: 12px 5px;
    background: var(--surface-light);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.calendar-day {
    background: var(--surface);
    min-height: 80px;
    padding: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.calendar-day:hover {
    background: var(--surface-light);
}

.calendar-day.other-month {
    background: var(--background);
    color: var(--text-muted);
}

.calendar-day.today .day-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -3px 0 3px -3px;
    font-size: 0.8rem;
}

.calendar-day.selected {
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid var(--primary-color);
}

.day-number {
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 0.8rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.event-preview {
    background: var(--primary-color);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 14px;
}

.event-preview:hover {
    opacity: 0.9;
    transform: translateX(1px);
}

/* Week View */
.week-days-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 8px;
    overflow-x: auto;
}

.week-day-header {
    text-align: center;
    padding: 10px 5px;
    background: var(--surface-light);
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 6px;
    min-width: 50px;
    font-size: 0.7rem;
}

.week-day-header.today {
    background: var(--primary-color);
    color: white;
}

.week-grid {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    min-height: 400px;
}

.time-column {
    background: var(--surface-light);
}

.time-slot {
    height: 40px;
    padding: 2px;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.days-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    overflow-x: auto;
}

.week-day-column {
    position: relative;
    border-right: 1px solid var(--border);
    min-width: 60px;
}

.week-day-column:last-child {
    border-right: none;
}

.week-hour-slot {
    height: 40px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.week-hour-slot:hover {
    background: rgba(99, 102, 241, 0.1);
}

.week-event {
    position: absolute;
    left: 1px;
    right: 1px;
    background: var(--primary-color);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    z-index: 2;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.week-event:hover {
    opacity: 0.9;
}

/* Day View */
.day-timeline {
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.hour-slot {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    min-height: 60px;
}

.hour-label {
    width: 60px;
    padding: 8px;
    background: var(--surface-light);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-shrink: 0;
}

.hour-content {
    flex: 1;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
    min-height: 60px;
}

.hour-content:hover {
    background: rgba(99, 102, 241, 0.05);
}

.day-event {
    position: absolute;
    left: 3px;
    right: 3px;
    background: var(--primary-color);
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 2;
    cursor: pointer;
    border-left: 3px solid var(--primary-dark);
    line-height: 1.3;
}

.day-event:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Events Sidebar */
.events-sidebar {
    grid-column: 2;
    background: var(--surface-light);
    border-left: 1px solid var(--border);
    padding: 15px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.sidebar-header h3 {
    color: var(--text-primary);
    font-size: 1rem;
}

.events-count {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.view-selector {
    display: flex;
    background: var(--surface);
    border-radius: 6px;
    padding: 3px;
    margin-bottom: 15px;
}

.view-option {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.7rem;
    transition: all 0.3s ease;
}

.view-option.active {
    background: var(--primary-color);
    color: white;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-card {
    background: var(--surface);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.event-card:hover {
    transform: translateX(3px);
    background: var(--surface-lighter);
}

.event-card.context-menu-active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--accent-color);
}

.event-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.event-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.event-location {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.event-description {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.3;
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.close-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 15px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

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

.time-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.color-picker input[type="radio"] {
    display: none;
}

.color-picker label {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.color-picker input[type="radio"]:checked + label {
    border-color: white;
    transform: scale(1.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    min-width: 140px;
}

.context-menu.active {
    display: block;
}

.context-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.context-item:last-child {
    border-bottom: none;
}

.context-item:hover {
    background: var(--surface-light);
    color: var(--primary-color);
}

/* Анимации для уведомлений */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Login Screen Styles */
.login-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--background), var(--surface));
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-screen.active {
    display: flex;
}

.login-container {
    background: var(--surface);
    border-radius: 15px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.login-header h1 {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: var(--primary-color);
}

.login-form {
    margin-bottom: 20px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-google {
    width: 100%;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-1px);
}

.login-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
    z-index: 1;
}

.login-divider span {
    background: var(--surface);
    padding: 0 15px;
    position: relative;
    z-index: 2;
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.login-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s ease;
}

.login-links a:hover {
    color: var(--primary-color);
}

.ecosystem-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* App Header */
.app-header {
    background: var(--surface);
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

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

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-name {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.btn-logout {
    background: var(--danger-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-logout:hover {
    background: #dc2626;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.9);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--surface-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-overlay p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Calendar App Container */
.calendar-app {
    display: none;
    height: 100vh;
    flex-direction: column;
}

/* Mobile Events Modal */
.mobile-events-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.8);
    z-index: 1002;
    align-items: flex-end;
    justify-content: center;
}

.mobile-events-modal.active {
    display: flex;
}

.mobile-events-content {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-events-modal.active .mobile-events-content {
    transform: translateY(0);
}

.mobile-events-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.mobile-events-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
}

.mobile-events-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 10px;
}

.mobile-events-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.mobile-events-close:hover {
    background: var(--surface-light);
}

.mobile-events-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.mobile-events-date {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding-top: 10px;
}

.mobile-events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-event-card {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.mobile-event-card:active {
    transform: scale(0.98);
    background: var(--surface-lighter);
}

.mobile-event-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.mobile-event-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.mobile-event-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.mobile-event-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.mobile-events-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.mobile-events-empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.mobile-events-empty-text {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Backdrop click area */
.mobile-events-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: -1;
}

/* Animation for events modal */
@keyframes slideUpFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.mobile-events-content {
    animation: slideUpFromBottom 0.3s ease;
}

.mobile-events-modal.closing .mobile-events-content {
    animation: slideDownToBottom 0.3s ease;
}

/* Mobile First Approach */
@media (max-width: 768px) {
    /* General Mobile Styles */
    body {
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

    /* Calendar Container Mobile Layout */
    .calendar-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: 100vh;
        gap: 0;
        padding-bottom: 0;
    }

    /* Hide desktop sidebar on mobile */
    .events-sidebar {
        display: none !important;
    }

    /* Header Mobile Optimization */
    .calendar-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 15px;
        text-align: center;
    }

    .header-left h1 {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .subtitle {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }

    .ecosystem-links {
        justify-content: center;
        gap: 6px;
    }

    .ecosystem-links a {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    .header-right {
        justify-content: center;
        width: 100%;
        gap: 8px;
    }

    /* Navigation Mobile */
    .calendar-navigation {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 15px;
    }

    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .current-month {
        font-size: 1rem;
        min-width: 120px;
        order: -1;
        width: 100%;
        margin-bottom: 5px;
    }

    .today-btn {
        margin-left: 0;
        order: 2;
        width: auto;
        flex: 1;
    }

    /* Buttons Mobile */
    .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        min-height: 40px;
    }

    /* Calendar Views Mobile */
    .calendar-views {
        padding: 8px;
        overflow-x: hidden;
        height: 100%;
    }

    /* Month View Mobile */
    .weekdays-header {
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
    }

    .weekday {
        padding: 8px 2px;
        font-size: 0.7rem;
    }

    .month-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
        min-height: 60vh;
    }

    .calendar-day {
        min-height: 60px;
        padding: 4px;
        position: relative;
        overflow: hidden;
    }

    .calendar-day.has-events::after {
        content: '';
        position: absolute;
        bottom: 2px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        background: var(--primary-color);
        border-radius: 50%;
    }
    
    .calendar-day.multiple-events::after {
        width: 12px;
        height: 4px;
        border-radius: 2px;
        background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    }

    .day-number {
        font-size: 0.75rem;
        width: 18px;
        height: 18px;
        margin-bottom: 2px;
    }

    .calendar-day.today .day-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .day-events {
        display: none; /* Hide event previews on mobile */
    }

    /* Week View Mobile */
    .week-days-header {
        grid-template-columns: 40px repeat(7, 1fr);
        gap: 1px;
    }

    .week-day-header {
        min-width: 35px;
        font-size: 0.6rem;
        padding: 6px 2px;
    }

    .week-grid {
        grid-template-columns: 40px 1fr;
        min-height: 300px;
    }

    .time-slot {
        height: 30px;
        font-size: 0.6rem;
    }

    .week-hour-slot {
        height: 30px;
    }

    .week-event {
        font-size: 0.5rem;
        padding: 1px 2px;
        line-height: 1.1;
    }

    /* Day View Mobile */
    .day-header {
        padding: 10px;
    }

    .day-title {
        font-size: 1rem;
        text-align: center;
    }

    .hour-slot {
        min-height: 50px;
    }

    .hour-label {
        width: 45px;
        padding: 6px;
        font-size: 0.7rem;
    }

    .hour-content {
        padding: 6px;
        min-height: 50px;
    }

    .day-event {
        font-size: 0.7rem;
        padding: 4px 6px;
        left: 2px;
        right: 2px;
    }

    /* Modal Mobile */
    .modal {
        padding: 5px;
    }

    .modal-content {
        margin: 0;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-width: none;
        animation: modalSlideUp 0.3s ease;
    }

    .modal-header {
        padding: 12px 15px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 12px 15px;
        max-height: 60vh;
        overflow-y: auto;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .time-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
        position: sticky;
        bottom: 0;
        background: var(--surface);
        padding: 12px 0 0;
        margin-top: 20px;
    }

    /* Context Menu Mobile */
    .context-menu {
        min-width: 160px;
        font-size: 0.9rem;
        max-width: 280px;
        width: 90vw;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    .context-item {
        padding: 12px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Login Screen Mobile */
    .login-container {
        margin: 10px;
        padding: 20px;
        border-radius: 12px;
    }

    .login-header h1 {
        font-size: 1.6rem;
    }

    .login-subtitle {
        font-size: 0.8rem;
    }

    /* App Header Mobile */
    .app-header {
        padding: 8px 12px;
    }

    .user-info {
        gap: 8px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-name {
        font-size: 0.8rem;
        display: none; /* Hide on mobile to save space */
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

/* Small Phones */
@media (max-width: 480px) {
    .calendar-day {
        min-height: 50px;
        padding: 2px;
    }

    .day-number {
        font-size: 0.7rem;
        width: 16px;
        height: 16px;
    }

    .calendar-day.today .day-number {
        width: 20px;
        height: 20px;
    }

    .week-days-header {
        grid-template-columns: 35px repeat(7, 1fr);
    }

    .week-day-header {
        min-width: 30px;
        font-size: 0.55rem;
        padding: 4px 1px;
    }

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

    .time-slot {
        height: 25px;
        font-size: 0.55rem;
    }

    .week-hour-slot {
        height: 25px;
    }

    .hour-label {
        width: 40px;
        padding: 4px;
        font-size: 0.65rem;
    }

    .hour-content {
        padding: 4px;
        min-height: 45px;
    }
}

/* Mobile Animations */
@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Better touch targets */
    .btn, .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .calendar-day {
        min-height: 60px;
    }

    /* Remove hover effects on touch devices */
    .calendar-day:hover {
        background: var(--surface);
    }

    .event-card:hover {
        transform: none;
        background: var(--surface);
    }

    .btn:hover {
        transform: none;
    }

    /* Active states for touch feedback */
    .calendar-day:active {
        background: var(--surface-light);
        transform: scale(0.98);
    }

    .btn:active, .nav-btn:active {
        transform: scale(0.96);
    }

    .event-card:active {
        background: var(--surface-lighter);
        transform: translateX(2px);
    }
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px;
    z-index: 1000;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 12px;
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 0.7rem;
        cursor: pointer;
        transition: all 0.3s ease;
        flex: 1;
        max-width: 80px;
    }

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

    .mobile-nav-icon {
        font-size: 1.2rem;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust calendar container for bottom nav */
    .calendar-container {
        padding-bottom: 60px;
    }
}

/* Mobile form improvements */
@media (max-width: 768px) {
    .color-picker {
        justify-content: center;
        gap: 10px;
    }
    
    .color-picker label {
        width: 30px;
        height: 30px;
    }
}

/* Mobile empty states */
@media (max-width: 768px) {
    .empty-state {
        padding: 20px 10px;
    }
    
    .empty-icon {
        font-size: 2rem;
    }
    
    .empty-state p {
        font-size: 0.8rem;
    }
    
    .loading-overlay p {
        font-size: 0.8rem;
    }
    
    .loading-spinner {
        width: 32px;
        height: 32px;
    }
}

/* Swipe gestures support */
.calendar-views {
    overflow-x: hidden;
    touch-action: pan-y;
}

.month-grid, .week-grid, .day-timeline {
    touch-action: pan-y;
}

/* Improved mobile scrolling */
.events-sidebar, .modal-body, .mobile-events-body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Mobile date picker improvements */
input[type="date"], input[type="time"] {
    min-height: 44px;
}

/* Mobile keyboard avoidance */
@media (max-width: 768px) {
    .modal-content {
        max-height: 80vh;
    }
}

/* Landscape orientation support */
@media (max-width: 768px) and (orientation: landscape) {
    .calendar-container {
        grid-template-rows: auto auto 1fr;
    }

    .modal-content {
        max-height: 70vh;
    }

    .month-grid .calendar-day {
        min-height: 45px;
    }
    
    .mobile-events-content {
        max-height: 60vh;
    }
}
/* Mobile Events Modal */
.mobile-events-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1002;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-events-modal.active {
    display: flex;
    opacity: 1;
}

.mobile-events-content {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
}

.mobile-events-modal.active .mobile-events-content {
    transform: translateY(0);
}

.mobile-events-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.mobile-events-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
}

.mobile-events-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 10px;
}

.mobile-events-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.mobile-events-close:active {
    background: var(--surface-light);
    transform: scale(0.95);
}

.mobile-events-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.mobile-events-date {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding-top: 10px;
    font-weight: 500;
}

.mobile-events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 10px;
}

.mobile-event-card {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.mobile-event-card:active {
    transform: scale(0.98);
    background: var(--surface-lighter);
}

.mobile-event-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
}

.mobile-event-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mobile-event-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mobile-event-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-light);
}

.mobile-events-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.mobile-events-empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.mobile-events-empty-text {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Backdrop click area */
.mobile-events-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: -1;
}

/* Animation for events modal */
@keyframes slideUpFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.mobile-events-content {
    animation: slideUpFromBottom 0.3s ease;
}

.mobile-events-modal.closing .mobile-events-content {
    animation: slideDownToBottom 0.3s ease;
}

/* Update mobile day indicators */
@media (max-width: 768px) {
    .calendar-day.has-events {
        position: relative;
    }
    
    .calendar-day.has-events::after {
        content: '';
        position: absolute;
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 5px;
        height: 5px;
        background: var(--primary-color);
        border-radius: 50%;
    }
    
    .calendar-day.multiple-events::after {
        width: 15px;
        height: 5px;
        border-radius: 2px;
        background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    }
}
