/**
 * CalendoPro - Advanced JavaScript Calendar Collection
 * Version: 1.0.0
 * License: MIT
 * (c) 2025 CalendoPro
 */

:root {
    --cp-primary: #6366f1;
    --cp-primary-hover: #4f46e5;
    --cp-primary-light: rgba(99, 102, 241, 0.1);
    --cp-accent: #f59e0b;
    --cp-success: #10b981;
    --cp-danger: #ef4444;
    --cp-warning: #f59e0b;
    --cp-bg: #ffffff;
    --cp-bg-secondary: #f8fafc;
    --cp-bg-hover: #f1f5f9;
    --cp-text: #1e293b;
    --cp-text-secondary: #475569;
    --cp-text-muted: #94a3b8;
    --cp-border: #e2e8f0;
    --cp-border-dark: #cbd5e1;
    --cp-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --cp-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --cp-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --cp-radius-sm: 4px;
    --cp-radius: 8px;
    --cp-radius-lg: 12px;
    --cp-radius-xl: 16px;
    --cp-transition: all 0.2s ease;
    --cp-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cp-dark {
    --cp-primary: #818cf8;
    --cp-primary-hover: #6366f1;
    --cp-primary-light: rgba(129, 140, 248, 0.15);
    --cp-bg: #0f172a;
    --cp-bg-secondary: #1e293b;
    --cp-bg-hover: #334155;
    --cp-text: #f1f5f9;
    --cp-text-secondary: #cbd5e1;
    --cp-text-muted: #64748b;
    --cp-border: #334155;
    --cp-border-dark: #475569;
}

/* Base Calendar Styles */
.calendopro {
    font-family: var(--cp-font);
    background: var(--cp-bg);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-xl);
    overflow: hidden;
    box-shadow: var(--cp-shadow);
}

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

/* Calendar Header */
.cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cp-border);
    background: var(--cp-bg-secondary);
}

.cp-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--cp-text);
}

.cp-header-nav {
    display: flex;
    gap: 8px;
}

.cp-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cp-border);
    background: var(--cp-bg);
    border-radius: var(--cp-radius);
    cursor: pointer;
    color: var(--cp-text);
    transition: var(--cp-transition);
    font-size: 16px;
}

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

.cp-nav-btn:active {
    transform: scale(0.95);
}

/* View Tabs */
.cp-view-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--cp-bg-secondary);
    border-radius: var(--cp-radius);
}

.cp-view-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--cp-text-muted);
    border-radius: var(--cp-radius-sm);
    cursor: pointer;
    transition: var(--cp-transition);
}

.cp-view-tab:hover {
    color: var(--cp-text);
}

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

/* Calendar Grid */
.cp-calendar-body {
    padding: 16px;
}

.cp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.cp-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--cp-text-muted);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cp-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--cp-text);
    border-radius: var(--cp-radius);
    cursor: pointer;
    transition: var(--cp-transition);
    position: relative;
    background: transparent;
    border: none;
    min-height: 40px;
}

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

.cp-day.other-month {
    color: var(--cp-text-muted);
    opacity: 0.5;
}

.cp-day.today {
    background: var(--cp-primary-light);
    color: var(--cp-primary);
    font-weight: 700;
}

.cp-day.selected {
    background: var(--cp-primary);
    color: white;
}

.cp-day.selected:hover {
    background: var(--cp-primary-hover);
}

.cp-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.cp-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background: var(--cp-accent);
    border-radius: 50%;
}

.cp-day.selected.has-event::after {
    background: white;
}

/* Event Dots */
.cp-event-dots {
    display: flex;
    gap: 2px;
    position: absolute;
    bottom: 4px;
}

.cp-event-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

/* Ripple Effect */
.cp-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    transform: scale(0);
    animation: cp-ripple 0.6s linear;
    pointer-events: none;
}

@keyframes cp-ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Month Transition */
.cp-slide-left {
    animation: cp-slideLeft 0.3s ease-out;
}

.cp-slide-right {
    animation: cp-slideRight 0.3s ease-out;
}

@keyframes cp-slideLeft {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes cp-slideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Fade Animation */
.cp-fade-in {
    animation: cp-fadeIn 0.3s ease-out;
}

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

/* Scale Animation */
.cp-scale-in {
    animation: cp-scaleIn 0.2s ease-out;
}

@keyframes cp-scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ==================== */
/* CLASSIC CALENDAR     */
/* ==================== */

.cp-classic {
    max-width: 400px;
}

.cp-classic .cp-header {
    background: linear-gradient(135deg, var(--cp-primary), #8b5cf6);
    border-bottom: none;
    color: white;
}

.cp-classic .cp-header-title {
    color: white;
}

.cp-classic .cp-nav-btn {
    background: rgba(255,255,255,0.2);
    border-color: transparent;
    color: white;
}

.cp-classic .cp-nav-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Event Modal */
.cp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--cp-transition);
}

.cp-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cp-modal {
    background: var(--cp-bg);
    border-radius: var(--cp-radius-xl);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--cp-transition);
}

.cp-modal-overlay.active .cp-modal {
    transform: scale(1);
}

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

.cp-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--cp-text);
}

.cp-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--cp-bg-hover);
    border-radius: var(--cp-radius);
    cursor: pointer;
    color: var(--cp-text-muted);
    font-size: 18px;
    transition: var(--cp-transition);
}

.cp-modal-close:hover {
    background: var(--cp-danger);
    color: white;
}

.cp-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.cp-event-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--cp-bg-secondary);
    border-radius: var(--cp-radius);
    margin-bottom: 8px;
    transition: var(--cp-transition);
}

.cp-event-item:hover {
    background: var(--cp-bg-hover);
}

.cp-event-color {
    width: 4px;
    height: 100%;
    min-height: 40px;
    border-radius: 2px;
}

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

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

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

/* ==================== */
/* BOOKING CALENDAR     */
/* ==================== */

.cp-booking {
    max-width: 600px;
}

.cp-booking .cp-day {
    min-height: 60px;
    padding: 4px;
}

.cp-booking .cp-day-number {
    font-size: 14px;
    font-weight: 600;
}

.cp-booking .cp-day-price {
    font-size: 10px;
    color: var(--cp-text-muted);
    margin-top: 2px;
}

.cp-booking .cp-day.in-range {
    background: var(--cp-primary-light);
    border-radius: 0;
}

.cp-booking .cp-day.range-start {
    background: var(--cp-primary);
    color: white;
    border-radius: var(--cp-radius) 0 0 var(--cp-radius);
}

.cp-booking .cp-day.range-end {
    background: var(--cp-primary);
    color: white;
    border-radius: 0 var(--cp-radius) var(--cp-radius) 0;
}

.cp-booking .cp-day.range-start.range-end {
    border-radius: var(--cp-radius);
}

.cp-booking .cp-day.unavailable {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        var(--cp-border) 3px,
        var(--cp-border) 6px
    );
    color: var(--cp-text-muted);
    cursor: not-allowed;
}

.cp-booking-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--cp-bg-secondary);
    border-top: 1px solid var(--cp-border);
}

.cp-booking-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-booking-dates {
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-text);
}

.cp-booking-nights {
    font-size: 12px;
    color: var(--cp-text-muted);
}

.cp-booking-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--cp-primary);
}

.cp-booking-btn {
    padding: 12px 24px;
    background: var(--cp-primary);
    color: white;
    border: none;
    border-radius: var(--cp-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cp-transition);
}

.cp-booking-btn:hover {
    background: var(--cp-primary-hover);
}

.cp-booking-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== */
/* INLINE CALENDAR      */
/* ==================== */

.cp-inline {
    max-width: 280px;
    box-shadow: none;
    border: 1px solid var(--cp-border);
}

.cp-inline .cp-header {
    padding: 12px 16px;
    background: transparent;
}

.cp-inline .cp-header-title {
    font-size: 15px;
}

.cp-inline .cp-nav-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.cp-inline .cp-calendar-body {
    padding: 12px;
}

.cp-inline .cp-weekday {
    font-size: 10px;
    padding: 4px 0;
}

.cp-inline .cp-day {
    font-size: 13px;
    min-height: 32px;
}

/* ==================== */
/* TIMELINE CALENDAR    */
/* ==================== */

.cp-timeline {
    max-width: 500px;
}

.cp-timeline-container {
    max-height: 500px;
    overflow-y: auto;
}

.cp-timeline-date {
    position: sticky;
    top: 0;
    background: var(--cp-bg-secondary);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-text);
    border-bottom: 1px solid var(--cp-border);
    z-index: 10;
}

.cp-timeline-events {
    padding: 16px 20px;
}

.cp-timeline-event {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cp-border);
}

.cp-timeline-event:last-child {
    border-bottom: none;
}

.cp-timeline-time {
    width: 60px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cp-text-muted);
    flex-shrink: 0;
}

.cp-timeline-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--cp-radius);
    border-left: 3px solid var(--cp-primary);
    background: var(--cp-primary-light);
    cursor: pointer;
    transition: var(--cp-transition);
}

.cp-timeline-content:hover {
    transform: translateX(4px);
}

.cp-timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-text);
    margin-bottom: 4px;
}

.cp-timeline-desc {
    font-size: 12px;
    color: var(--cp-text-muted);
}

.cp-timeline-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--cp-text-muted);
}

/* Expand/Collapse Animation */
.cp-timeline-group {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.cp-timeline-group.collapsed {
    max-height: 0;
}

.cp-timeline-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.cp-timeline-toggle::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s ease;
}

.cp-timeline-toggle.collapsed::after {
    transform: rotate(-90deg);
}

/* ==================== */
/* YEAR CALENDAR        */
/* ==================== */

.cp-year {
    max-width: 1000px;
}

.cp-year .cp-header {
    justify-content: center;
    gap: 20px;
}

.cp-year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
}

@media (max-width: 768px) {
    .cp-year-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .cp-year-grid {
        grid-template-columns: 1fr;
    }
}

.cp-month-card {
    background: var(--cp-bg-secondary);
    border-radius: var(--cp-radius-lg);
    padding: 12px;
    transition: var(--cp-transition);
}

.cp-month-card:hover {
    transform: scale(1.02);
    box-shadow: var(--cp-shadow);
}

.cp-month-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cp-primary);
    text-align: center;
    margin-bottom: 8px;
}

.cp-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cp-month-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--cp-text);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--cp-transition);
}

.cp-month-day:hover {
    background: var(--cp-bg-hover);
}

.cp-month-day.today {
    background: var(--cp-primary);
    color: white;
    font-weight: 700;
}

.cp-month-day.holiday {
    background: var(--cp-danger);
    color: white;
}

.cp-month-day.special {
    background: var(--cp-accent);
    color: white;
}

.cp-month-day.other {
    color: var(--cp-text-muted);
    opacity: 0.3;
}

/* Year Legend */
.cp-year-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px;
    border-top: 1px solid var(--cp-border);
}

.cp-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--cp-text-muted);
}

.cp-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.cp-legend-dot.today { background: var(--cp-primary); }
.cp-legend-dot.holiday { background: var(--cp-danger); }
.cp-legend-dot.special { background: var(--cp-accent); }

/* Print Styles */
@media print {
    .cp-year {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .cp-header {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cp-nav-btn {
        display: none;
    }
}

/* ==================== */
/* RESPONSIVE           */
/* ==================== */

@media (max-width: 640px) {
    .cp-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .cp-view-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .cp-view-tab {
        flex: 1;
        text-align: center;
    }
    
    .cp-booking .cp-day {
        min-height: 50px;
    }
    
    .cp-booking-summary {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* Accessibility */
.cp-day:focus,
.cp-nav-btn:focus,
.cp-view-tab:focus {
    outline: 2px solid var(--cp-primary);
    outline-offset: 2px;
}

.cp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}