/* ========================================
   Persian Calendar - تقویم شمسی زیبا
   ======================================== */

.chp-calendar {
    width: 320px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: calendarSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes calendarSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chp-calendar.chp-cal-open {
    animation: calendarSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* هدر تقویم */
.chp-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.chp-cal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShine 8s linear infinite;
}

@keyframes headerShine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chp-cal-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 1;
}

.chp-cal-month {
    font-size: 18px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.chp-cal-year {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
}

.chp-cal-nav {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.chp-cal-nav:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.chp-cal-nav:active {
    transform: scale(0.95);
}

/* روزهای هفته */
.chp-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 12px 15px 8px;
    background: rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.chp-cal-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    padding: 8px 0;
}

.chp-cal-weekdays span.friday {
    color: #ef4444;
}

/* روزهای ماه */
.chp-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 12px 15px;
}

.chp-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: transparent;
}

.chp-cal-day:hover:not(.empty) {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.15);
    color: #667eea;
}

.chp-cal-day.empty {
    cursor: default;
}

.chp-cal-day.today {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.chp-cal-day.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
    transform: scale(1.1);
}

.chp-cal-day.friday:not(.today):not(.selected) {
    color: #ef4444;
}

/* انیمیشن تغییر ماه */
.chp-cal-animate .chp-cal-days {
    animation: monthChange 0.3s ease;
}

@keyframes monthChange {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* فوتر تقویم */
.chp-cal-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(243, 244, 246, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chp-cal-today,
.chp-cal-clear {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.chp-cal-today {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chp-cal-today:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chp-cal-clear {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.chp-cal-clear:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Responsive */
@media (max-width: 400px) {
    .chp-calendar {
        width: 290px;
    }
    
    .chp-cal-day {
        font-size: 13px;
    }
}

/* حالت تاریک (اختیاری) */
@media (prefers-color-scheme: dark) {
    .chp-calendar {
        background: rgba(31, 41, 55, 0.98);
    }
    
    .chp-cal-day {
        color: #e5e7eb;
    }
    
    .chp-cal-day:hover:not(.empty) {
        background: rgba(102, 126, 234, 0.3);
        color: #a5b4fc;
    }
    
    .chp-cal-weekdays {
        background: rgba(102, 126, 234, 0.1);
    }
    
    .chp-cal-footer {
        background: rgba(17, 24, 39, 0.8);
    }
}

/* ========================================
   Title Clickable - انتخاب ماه و سال
   ======================================== */
.chp-cal-title-clickable span {
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chp-cal-title-clickable span:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ========================================
   Month Grid - انتخاب ماه
   ======================================== */
.chp-cal-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 15px;
}

.chp-cal-month-item {
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.chp-cal-month-item:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    transform: scale(1.05);
}

.chp-cal-month-item.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chp-cal-month-item.current {
    border: 2px solid #10b981;
    color: #10b981;
    font-weight: 700;
}

.chp-cal-month-item.current.selected {
    border-color: white;
}

/* ========================================
   Year Grid - انتخاب سال
   ======================================== */
.chp-cal-years {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 15px;
}

.chp-cal-year-item {
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.chp-cal-year-item:hover:not(.disabled) {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    transform: scale(1.05);
}

.chp-cal-year-item.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chp-cal-year-item.current {
    border: 2px solid #10b981;
    color: #10b981;
    font-weight: 700;
}

.chp-cal-year-item.current.selected {
    border-color: white;
}

.chp-cal-year-item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* دکمه بازگشت */
.chp-cal-back {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    width: 100%;
}

.chp-cal-back:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* دکمه‌های سال اضافی در هدر */
.chp-cal-nav.chp-cal-prev-year,
.chp-cal-nav.chp-cal-next-year {
    font-size: 16px;
    font-weight: 800;
    opacity: 0.8;
}

.chp-cal-nav.chp-cal-prev-year:hover,
.chp-cal-nav.chp-cal-next-year:hover {
    opacity: 1;
}