:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --danger: #ea4335;
    --success: #34a853;
    --warning: #fbbc05;
    --text-primary: #3c4043;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --bg-primary: #fff;
    --bg-secondary: #f8f9fa;
    --bg-hover: #e8f0fe;
    --today-bg: #e8f0fe;
    --today-color: #1a73e8;
    --sidebar-width: 280px;
    --header-height: 64px;
    --shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

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

body {
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

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

.login-header h1 {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

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

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg-primary);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-primary);
}

.btn:hover {
    background: rgba(0,0,0,0.04);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

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

.btn-danger:hover {
    background: rgba(234,67,53,0.1);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-block {
    width: 100%;
}

.btn-today {
    padding: 8px 16px;
    border: 1px solid var(--border);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* App Layout */
#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-secondary);
}

.logo i {
    color: var(--primary);
    font-size: 24px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-arrows {
    display: flex;
    gap: 4px;
}

.date-title {
    font-size: 20px;
    font-weight: 400;
    min-width: 200px;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.view-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 2px;
}

.view-tab {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.view-tab.active {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.user-menu span {
    color: var(--text-secondary);
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}

.mini-calendar {
    margin-bottom: 24px;
}

.mini-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 500;
}

.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.mini-calendar-grid .day-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.mini-calendar-grid .day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.mini-calendar-grid .day:hover {
    background: var(--bg-hover);
}

.mini-calendar-grid .day.today {
    background: var(--today-bg);
    color: var(--today-color);
    font-weight: 600;
}

.mini-calendar-grid .day.selected {
    background: var(--primary);
    color: white;
}

.mini-calendar-grid .day.other-month {
    color: var(--border);
}

.calendar-list {
    margin-bottom: 24px;
}

.calendar-list h3,
.upcoming-events h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.calendar-item {
    padding: 8px 0;
}

.check-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

/* Calendar Wrapper */
.calendar-wrapper {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
}

/* Month View */
.month-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.calendar-header-cell {
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(100px, 1fr);
    flex: 1;
}

.calendar-day {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    min-height: 120px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: var(--bg-secondary);
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

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

.calendar-day.today {
    background: var(--today-bg);
}

.calendar-day.today .day-number {
    color: var(--today-color);
    font-weight: 600;
}

.calendar-day.selected {
    background: rgba(26,115,232,0.05);
}

.day-number {
    font-size: 12px;
    margin-bottom: 4px;
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
}

.calendar-day.today .day-number {
    background: var(--today-color);
    color: white;
}

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

.event-chip {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-left: 3px solid rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
}

.event-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.event-chip.all-day {
    border-radius: 4px;
}

.event-time {
    font-weight: 600;
    margin-right: 4px;
}

.more-events {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 8px;
    cursor: pointer;
}

.more-events:hover {
    color: var(--primary);
}

/* Week View */
.week-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.week-header {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.week-header-cell {
    padding: 12px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.week-header-cell:last-child {
    border-right: none;
}

.week-header-cell .day-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.week-header-cell .day-number {
    font-size: 20px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    margin: 4px auto 0;
}

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

.week-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    overflow-y: auto;
}

.time-column {
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
}

.time-slot {
    height: 50px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

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

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

.hour-slot {
    height: 50px;
    border-bottom: 1px solid var(--border);
}

.week-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: white;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 10;
}

.week-event:hover {
    z-index: 20;
    box-shadow: var(--shadow);
}

/* Day View */
.day-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.day-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.day-header .day-name {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.day-header .day-number {
    font-size: 48px;
    font-weight: 300;
    width: 80px;
    height: 80px;
    line-height: 80px;
    margin: 8px auto;
}

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

.day-timeline {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

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

.day-hour-label {
    width: 60px;
    padding: 8px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
}

.day-hour-content {
    flex: 1;
    position: relative;
}

.day-event-item {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 4px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* List View */
.list-view {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.list-date-header {
    font-size: 18px;
    font-weight: 500;
    margin: 24px 0 12px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.list-date-header:first-child {
    margin-top: 0;
}

.list-event-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.list-event-card:hover {
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.list-event-time {
    width: 80px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.list-event-content {
    flex: 1;
}

.list-event-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.list-event-location {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal.show .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

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

.modal form {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.modal-footer .spacer {
    flex: 1;
}

/* Form Layout in Modal */
.date-time-row {
    display: flex;
    gap: 16px;
}

.date-group {
    flex: 1;
}

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

.time-group input {
    width: 100px;
}

.time-separator {
    color: var(--text-secondary);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-with-icon input,
.input-with-icon textarea {
    padding-left: 40px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.color-picker {
    display: flex;
    gap: 12px;
}

.color-option {
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-circle {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option:hover .color-circle {
    transform: scale(1.1);
}

.color-option input:checked + .color-circle {
    border-color: white;
    box-shadow: 0 0 0 2px var(--text-primary);
}

/* Upcoming Events */
.upcoming-event-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.upcoming-event-color {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.upcoming-event-info {
    flex: 1;
}

.upcoming-event-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.upcoming-event-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Login Form */
.login-form input {
    padding: 14px 16px;
    font-size: 16px;
}

.login-form .btn-primary {
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .view-tabs {
        display: none;
    }
    
    .calendar-body {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
    .event-chip {
        font-size: 10px;
        padding: 1px 4px;
    }
}
