:root {
    /* Colors */
    --primary-gradient: linear-gradient(135deg, #371df1, #6c5ce7);
    --connector-color: rgba(55, 29, 241, 0.15);
    --bg-color: #f8f9fd;
    --surface-color: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --border-color: #e0e0e0;

    /* Micro-stats */
    --stat-busy: #ff4757;
    --stat-free: #2ed573;
    --stat-medium: #ffa502;

    /* Spacing & Radius */
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-primary);
}

.chronos-container {
    background: var(--surface-color);
    width: 100%;
    max-width: 420px;
    height: 80vh;
    max-height: 800px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Smart Header */
.chronos-header {
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border-color);
}

.input-wrapper {
    position: relative;
}

#smart-date-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fcfcfc;
}

#smart-date-input:focus {
    outline: none;
    border-color: #371df1;
    box-shadow: 0 0 0 4px rgba(55, 29, 241, 0.1);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Calendar Area */
.calendar-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
    position: relative;
    /* Hide scrollbar for cleaner UI */
    scrollbar-width: thin;
}

.calendar-wrapper::-webkit-scrollbar {
    width: 6px;
}

.calendar-wrapper::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

/* Month Headers */
.month-section {
    margin-top: 24px;
}

.month-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--surface-color);
    padding: 8px 0;
    z-index: 5;
}

/* Days Grid */
.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    /* Vertical gap */
    row-gap: 12px;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Default rounded */
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    user-select: none;
}

.day-cell:hover:not(.empty) {
    background-color: rgba(0, 0, 0, 0.03);
}

.day-cell.empty {
    cursor: default;
    pointer-events: none;
}

/* Selection Styles */
.day-cell.selected {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(55, 29, 241, 0.3);
    z-index: 2;
    /* Sit above connectors */
}

/* Range Logic */
.day-cell.range-start {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.day-cell.range-end {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.day-cell.in-range {
    background-color: var(--connector-color);
    border-radius: 0;
    /* Connects them */
    color: var(--text-primary);
}

/* Micro-stats */
.micro-dots {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.dot.busy {
    background-color: var(--stat-busy);
}

.dot.moderate {
    background-color: var(--stat-medium);
}

.dot.free {
    background-color: var(--stat-free);
}

.status-bar {
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    background: #fafafa;
}

/* Keyboard Focus State */
.day-cell:focus,
.day-cell.focused {
    outline: none;
    position: relative;
    z-index: 10;
}

.day-cell.focused::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #371df1;
    border-radius: 50%;
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(55, 29, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(55, 29, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(55, 29, 241, 0);
    }
}