/* ==================== Persian Datepicker - نسخه پایدار ==================== */

.persian-datepicker-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 280px;
}

/* Input */
.persian-datepicker-input {
    width: 100%;
    padding: 0.65rem 1rem;
    padding-left: 1.8rem;
    font-family: 'Vazir', Tahoma, sans-serif;
    font-size: 0.9rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.3s ease;
    cursor: pointer;
    outline: none;
    text-align: left;
    direction: ltr;
}

.persian-datepicker-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.persian-datepicker-input::placeholder {
    color: #94a3b8;
    opacity: 0.5;
    font-size: 0.85rem;
    text-align: right;
    direction: rtl;
}

.persian-datepicker-input.has-value {
    color: #1e293b;
    font-weight: 500;
}

/* Icon */
.persian-datepicker-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #0ea5e9;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

/* Clear button */
.persian-datepicker-clear {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #94a3b8;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.6rem;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2;
}

.persian-datepicker-clear.show {
    display: flex;
}

.persian-datepicker-clear:hover {
    background: #ef4444;
}

/* Calendar */
.persian-datepicker-calendar {
    position: fixed;
    width: 290px;
    max-width: calc(100vw - 2rem);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 1rem;
    display: none;
    direction: rtl;
}

.persian-datepicker-calendar.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 4px;
}

.calendar-nav-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #f1f5f9;
    color: #334155;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    background: #0ea5e9;
    color: #fff;
}

.calendar-month-year {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
}

.calendar-month-year select,
.calendar-year-input {
    padding: 0.3rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Vazir', Tahoma, sans-serif;
    font-size: 0.8rem;
    background: #fff;
    color: #1e293b;
    outline: none;
}

.calendar-month-year select {
    cursor: pointer;
}

.calendar-month-year .year-select {
    width: 70px;
}

.calendar-month-year .month-select {
    width: 85px;
}

.calendar-year-input {
    width: 70px;
    text-align: center;
    font-weight: 700;
}

/* Weekdays */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
    text-align: center;
}

.calendar-weekdays span {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    padding: 3px 0;
}

.calendar-weekdays span.weekend {
    color: #ef4444;
}

/* Days */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: #334155;
    border: 2px solid transparent;
    position: relative;
}

.calendar-day:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    transform: scale(1.05);
}

.calendar-day:active {
    transform: scale(0.9);
}

.calendar-day.today {
    background: #e0f2fe;
    border-color: #0ea5e9;
    font-weight: 700;
    color: #0284c7;
}

.calendar-day.selected {
    background: #0ea5e9;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.35);
}

.calendar-day.weekend {
    color: #ef4444;
}

.calendar-day.selected.weekend {
    color: #fff;
}

.calendar-day.empty {
    cursor: default;
    pointer-events: none;
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Footer */
.calendar-footer {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.calendar-footer button {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 8px;
    font-family: 'Vazir', Tahoma, sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-today {
    background: #f1f5f9;
    color: #334155;
}

.btn-today:hover {
    background: #0ea5e9;
    color: #fff;
}

.btn-clear {
    background: #fef2f2;
    color: #ef4444;
}

.btn-clear:hover {
    background: #ef4444;
    color: #fff;
}

/* Overlay */
.persian-datepicker-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
}

.persian-datepicker-overlay.show {
    display: block;
}

/* Mobile */
@media (max-width: 480px) {
    .persian-datepicker-calendar {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: calc(100vw - 2rem);
        border-radius: 20px;
    }
    
    .calendar-day {
        font-size: 0.9rem;
    }
}