:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    padding: 2rem;
    background-image: radial-gradient(circle at top left, #1e293b 0%, #0f172a 100%);
}

.container,
.calendar-container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0;
    border: none;
}

.view-switch {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.view-switch a {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

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

#auth-status {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
}

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

.user-email {
    color: var(--text-muted);
    font-size: 0.8rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s;
}

.event-card:hover {
    transform: scale(1.02);
    border-color: rgba(59, 130, 246, 0.5);
}

.event-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.event-time {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.event-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.calendar-event {
    background-color: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    margin-bottom: 2px;
}

.calendar-event:hover {
    background-color: var(--primary-hover);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1e293b;
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.confirm-modal-content {
    max-width: 400px;
    text-align: center;
}

.confirm-modal-content h3 {
    margin-bottom: 1rem;
}

.confirm-modal-content p {
    margin-bottom: 2rem;
    color: var(--text-muted);
}

.modal h2 {
    margin-bottom: 1.5rem;
}

.datetime-input-group input[type="time"],
.datetime-input-group select {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    padding: 0.75rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.datetime-input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(148, 163, 184, 0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.datetime-input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: white;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Time Spinner Styles */
.time-spinner-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.time-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 150px;
    /* 30px * 5 items */
    width: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
}

.spinner-column {
    flex: 1;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar for IE/Edge */
}

.spinner-column::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for Chrome/Safari */
}

.spinner-item {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s, font-size 0.2s, font-weight 0.2s;
    cursor: pointer;
}

.spinner-item.active {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
}

.spinner-separator {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.spinner-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 30px;
    transform: translateY(-50%);
    background: rgba(59, 130, 246, 0.1);
    border-top: 1px solid rgba(59, 130, 246, 0.3);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    pointer-events: none;
    z-index: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Login Gate */
#login-gate {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
    gap: 2rem;
}

#login-gate h1 {
    font-size: 3.5rem;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

#login-gate p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 1rem;
}

#app-content {
    display: none;
}

/* Month Calendar Styles */
.calendar-view-container {
    padding-top: 1rem;
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

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

.weekday-header {
    background-color: rgba(30, 41, 59, 0.9);
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.calendar-day {
    background-color: var(--bg-color);
    min-height: 120px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.calendar-day:hover:not(.other-month) {
    background-color: rgba(255, 255, 255, 0.05);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.empty {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    opacity: 0.5;
}

/* Custom Date Input Styling */
.date-input-container {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
    flex: 1;
}

.date-input-container input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    padding: 0;
    outline: none;
}

.date-input-container input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

#event-from-day,
#event-from-month,
#event-to-day,
#event-to-month {
    width: 2ch;
}

#event-from-year,
#event-to-year {
    width: 4ch;
}

.date-input-container span {
    color: var(--text-muted);
    font-weight: bold;
    user-select: none;
}

.date-input-container input::-webkit-outer-spin-button,
.date-input-container input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.date-input-container input[type=number] {
    -moz-appearance: textfield;
}

.date-input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.hidden-picker {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.calendar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: auto;
}

.calendar-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.day-number {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    max-height: 80px;
}

.calendar-event-tag {
    background-color: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.calendar-event-tag:hover {
    background-color: var(--primary-hover);
}

nav {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

nav a.active {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

nav a:hover:not(.active) {
    color: var(--text-main);
}