:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-light: #dbeafe;
    --link-color: #3b82f6;
    --link-hover: #2563eb;
    --prompt-da: #10b981;
    --prompt-bom: #059669;
    --prompt-wdnw: #34d399;
    --prompt-weekend: #6ee7b7;
    --weekend-bg: #f3f4f6;
    --holiday-bg: #fef3c7;
    --active-bg: #3b82f6;
    --active-text: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --border-hover: #475569;
    --accent-blue: #60a5fa;
    --accent-blue-hover: #3b82f6;
    --accent-blue-light: #1e3a8a;
    --link-color: #93c5fd;
    --link-hover: #bfdbfe;
    --prompt-da: #10b981;
    --prompt-bom: #059669;
    --prompt-wdnw: #34d399;
    --prompt-weekend: #6ee7b7;
    --weekend-bg: #1e293b;
    --holiday-bg: #78350f;
    --active-bg: #3b82f6;
    --active-text: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 24px;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.about-link {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s ease;
}

.about-link:hover {
    color: var(--link-hover);
}

/* Style all links for better visibility in dark theme */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
}

.controls {
    margin-bottom: 32px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

#reference-date {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
    font-family: inherit;
}

#reference-date:hover {
    border-color: var(--border-hover);
}

#reference-date:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.calendar-container {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 70vh;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 1px 1px 1px;
    position: relative;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 1px;
    background-color: var(--border-color);
    min-width: 980px;
}

.day-header {
    background-color: var(--bg-secondary);
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.calendar-day {
    border: none;
    min-height: 120px;
    padding: 12px;
    background-color: var(--bg-primary);
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background-color: var(--bg-secondary);
    z-index: 1;
}

/* Ensure bars stay visible on hover - they're in a separate container with higher z-index */
.prompt-bars-container {
    z-index: 2;
}

.calendar-day.non-business {
    cursor: not-allowed;
    opacity: 0.7;
}

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

.calendar-day.public-holiday {
    background-color: var(--holiday-bg);
}

.calendar-day.active {
    background-color: var(--active-bg) !important;
    color: var(--active-text) !important;
    z-index: 5;
    box-shadow: var(--shadow-md);
}

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

.calendar-day.active .day-label {
    color: var(--active-text);
    opacity: 0.9;
}

.day-number {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.day-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Continuous bars container */
.prompt-bars-container {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.continuous-bar {
    position: absolute;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 2;
}

.continuous-bar.bar-segment {
    border-radius: 0;
}

/* Arrow-like ends for multi-week bars using corner properties */
/* arrow-end = arrow on the RIGHT side (where bar continues to next week) */
.continuous-bar.bar-segment.arrow-end {
    corner-bottom-right-shape: bevel;
    corner-top-right-shape: bevel;
    border-bottom-right-radius: 10px 50%;
    border-top-right-radius: 10px 50%;
}

/* arrow-start = arrow on the LEFT side (where bar continues from previous week) */
.continuous-bar.bar-segment.arrow-start {
    corner-bottom-left-shape: bevel;
    corner-top-left-shape: bevel;
    border-bottom-left-radius: 10px 50%;
    border-top-left-radius: 10px 50%;
}

/* arrow-both = arrows on both sides (middle weeks) */
.continuous-bar.bar-segment.arrow-both {
    corner-bottom-left-shape: bevel;
    corner-top-left-shape: bevel;
    corner-bottom-right-shape: bevel;
    corner-top-right-shape: bevel;
    border-bottom-left-radius: 10px 50%;
    border-top-left-radius: 10px 50%;
    border-bottom-right-radius: 10px 50%;
    border-top-right-radius: 10px 50%;
}

.continuous-bar.da {
    background-color: var(--prompt-da);
}

.continuous-bar.bom {
    background-color: var(--prompt-bom);
}

.continuous-bar.wdnw {
    background-color: var(--prompt-wdnw);
}

.continuous-bar.weekend {
    background-color: var(--prompt-weekend);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.legend-color.da {
    background-color: var(--prompt-da);
}

.legend-color.bom {
    background-color: var(--prompt-bom);
}

.legend-color.wdnw {
    background-color: var(--prompt-wdnw);
}

.legend-color.weekend {
    background-color: var(--prompt-weekend);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

.modal-body p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Scrollbar styling */
.calendar-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.calendar-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
}

.calendar-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

.calendar-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .container {
        padding: 24px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
