/**
 * Dayche Jalali Calendar Styles
 * Modern Persian calendar design - Based on Dayche brand colors
 */

/* === Variables === */
:root {
    --dayche-primary: #1a7fb8;
    --dayche-primary-dark: #156a9a;
    --dayche-header-bg: #1a7fb8;
    --dayche-today-bg: #1a7fb8;
    --dayche-today-text: #fff;
    --dayche-event-bg: #4CAF50;
    --dayche-friday-color: #e74c3c;
    --dayche-holiday-color: #e74c3c;
    --dayche-border: #e0e0e0;
    --dayche-text: #333;
    --dayche-text-light: #666;
    --dayche-bg: #fff;
    --dayche-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --dayche-radius: 8px;
    --dayche-warning: #e74c3c;
}

/* === Wrapper === */
.dayche-jalali-calendar-wrapper {
    direction: rtl;
    font-family: 'IRANSansWeb', 'Vazir', 'Tahoma', sans-serif;
    background: var(--dayche-bg);
    border-radius: var(--dayche-radius);
    box-shadow: var(--dayche-shadow);
    overflow: hidden;
    max-width: 100%;
    position: relative;
}

/* === Header === */
.dayche-jalali-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0077b6 !important;
    background-color: #0077b6 !important;
    color: #fff !important;
    padding: 14px 16px;
}

.dayche-month-year {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3em;
    font-weight: 700;
    color: #fff;
}

.dayche-month-name {
    font-size: 1.1em;
    color: #fff;
}

.dayche-year {
    opacity: 0.95;
    color: #fff;
}

/* Navigation Buttons with Text */
.dayche-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.dayche-nav-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* === Grid === */
.dayche-jalali-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Weekday Headers */
.dayche-weekdays th {
    background: #f8f9fa;
    color: var(--dayche-text);
    font-weight: 700;
    padding: 12px 4px;
    text-align: center;
    font-size: 0.95em;
    border-bottom: 2px solid var(--dayche-border);
}

.dayche-weekdays th.dayche-friday {
    color: var(--dayche-friday-color);
}

/* Show full weekday names on desktop, hide short */
.dayche-weekday-full {
    display: inline;
}

.dayche-weekday-short {
    display: none;
}

/* Day Cells */
.dayche-day {
    border: 1px solid var(--dayche-border);
    vertical-align: top;
    min-height: 90px;
    height: 90px;
    padding: 0;
    transition: background 0.2s ease;
}

.dayche-day:hover:not(.dayche-empty) {
    background: #f5f7fa;
}

.dayche-day.dayche-empty {
    background: #fafafa;
}

.dayche-day-inner {
    padding: 6px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Day Number */
.dayche-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--dayche-text);
    margin-bottom: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    align-self: flex-end;
}

.dayche-friday .dayche-day-number {
    color: var(--dayche-friday-color);
}

/* Holiday styling */
.dayche-holiday .dayche-day-number {
    color: var(--dayche-holiday-color);
}

/* Today */
.dayche-today .dayche-day-number {
    background: #0077b6 !important;
    color: #fff !important;
}

/* === Events === */
.dayche-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.dayche-event {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-align: center;
    line-height: 1.4;
    background-color: var(--dayche-event-bg);

    /* Two lines with ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    min-height: 38px;
}

.dayche-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.dayche-event-title {
    font-weight: 500;
}

/* Today's events - stronger color */
.dayche-event.dayche-event-today {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* Warning: Less than 1 hour to start */
.dayche-event.dayche-event-warning {
    background-color: #e74c3c !important;
    animation: pulse-warning 1s infinite;
}

@keyframes pulse-warning {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* === Tooltip === */
.dayche-tooltip-content {
    direction: rtl;
    text-align: right;
    font-family: 'IRANSansWeb', 'Vazir', 'Tahoma', sans-serif;
    padding: 14px;
    max-width: 320px;
}

.dayche-tooltip-title {
    font-size: 1.15em;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a7fb8;
}

.dayche-tooltip-meta {
    margin-bottom: 12px;
}

.dayche-tooltip-meta>div {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #555;
}

.dayche-icon {
    font-size: 1.1em;
}

/* Remaining time badge */
.dayche-tooltip-remaining {
    display: inline-block;
    background: #1a7fb8;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 10px;
}

.dayche-tooltip-remaining.dayche-remaining-warning {
    background: #e74c3c;
}

.dayche-tooltip-remaining.dayche-remaining-soon {
    background: #f39c12;
}

.dayche-tooltip-remaining.dayche-remaining-passed {
    background: #95a5a6;
}

.dayche-tooltip-description {
    font-size: 0.85em;
    color: #666;
    line-height: 1.7;
    margin-bottom: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-right: 3px solid #1a7fb8;
}

.dayche-tooltip-link {
    display: inline-block;
    background: #1a7fb8;
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85em;
    text-decoration: none !important;
    transition: background 0.2s ease;
}

.dayche-tooltip-link:hover {
    background: #156a9a;
}

/* === Loading State === */
.dayche-jalali-calendar-wrapper.dayche-loading {
    opacity: 0.6;
    pointer-events: none;
}

.dayche-jalali-calendar-wrapper.dayche-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid var(--dayche-border);
    border-top-color: #1a7fb8;
    border-radius: 50%;
    animation: dayche-spin 0.7s linear infinite;
}

@keyframes dayche-spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Responsive: Tablet === */
@media (max-width: 768px) {
    .dayche-day {
        height: 80px;
        min-height: 80px;
    }

    .dayche-day-number {
        font-size: 0.9em;
        width: 24px;
        height: 24px;
    }

    .dayche-event {
        font-size: 0.75em;
        padding: 3px 5px;
        min-height: 32px;
    }

    .dayche-month-year {
        font-size: 1.1em;
    }

    .dayche-nav-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* === Responsive: Mobile === */
@media (max-width: 480px) {
    .dayche-jalali-header {
        padding: 12px 14px;
    }

    .dayche-nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .dayche-month-year {
        font-size: 1em;
    }

    .dayche-weekdays th {
        padding: 10px 2px;
        font-size: 0.85em;
    }

    /* Show short weekday names on mobile */
    .dayche-weekday-full {
        display: none;
    }

    .dayche-weekday-short {
        display: inline;
    }

    .dayche-day {
        height: 65px;
        min-height: 65px;
    }

    .dayche-day-inner {
        padding: 4px;
    }

    .dayche-day-number {
        font-size: 0.85em;
        width: 22px;
        height: 22px;
    }

    .dayche-event {
        -webkit-line-clamp: 1;
        min-height: auto;
        padding: 2px 4px;
        font-size: 0.7em;
    }
}

/* === Very Small Screens === */
@media (max-width: 360px) {
    .dayche-day {
        height: 55px;
        min-height: 55px;
    }

    .dayche-day-number {
        font-size: 0.8em;
        width: 20px;
        height: 20px;
    }

    .dayche-event-title {
        display: none;
    }

    .dayche-event {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        padding: 0;
        min-height: auto;
    }

    .dayche-events {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }
}

/* === QTip Overrides === */
.qtip.qtip-default {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.qtip-content {
    padding: 0;
}

/* === Print Styles === */
@media print {
    .dayche-jalali-calendar-wrapper {
        box-shadow: none;
    }

    .dayche-nav-btn {
        display: none;
    }

    .dayche-event {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}