/* Import Google Font - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* All rules are now scoped to the .orthodox-feasts-calendar container */
.orthodox-feasts-calendar {
    font-family: 'Inter', sans-serif;
    color: #333;
    line-height: 1.3;
    text-align: center;
}

/* 🛠️ ADMIN EDIT BUTTON STYLING */
.orthodox-feasts-calendar .admin-edit-db-btn {
    display: inline-block;
    background: #2c3338;
    color: #ffffff !important;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #1d2327;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}

.orthodox-feasts-calendar .admin-edit-db-btn:hover {
    background: #BD893A;
    border-color: #BD893A;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.orthodox-feasts-calendar .admin-edit-db-btn:active {
    transform: scale(0.96);
}

/* 🚀 PERFORMANCE & MOBILE FIXES */
.orthodox-feasts-calendar .nav-arrow,
.orthodox-feasts-calendar .today-button,
.orthodox-feasts-calendar .carousel-btn,
.orthodox-feasts-calendar .datepicker-input {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Haptic visual feedback for instant response */
.orthodox-feasts-calendar .nav-arrow:active,
.orthodox-feasts-calendar .today-button:active,
.orthodox-feasts-calendar .carousel-btn:active {
    transform: scale(0.92) !important;
    transition: transform 0.05s linear !important;
}

/* 🔄 LOADING SPINNER (For visual feedback during AJAX) */
.orthodox-feasts-calendar .content-box.loading-active {
    
    position: relative !important;
    pointer-events: none;
    /* Maintain a minimum height so the spinner has space */
    min-height: 250px !important; 
    display: flex;
    flex-direction: column;



    
}
.orthodox-feasts-calendar .content-box.loading-active #dayText, 
.orthodox-feasts-calendar .content-box.loading-active #saintsname,
.orthodox-feasts-calendar .content-box.loading-active .saint-carousel-container {
 
      opacity: 0.2 !important;
    filter: blur(2px);
}
.orthodox-feasts-calendar .content-box.loading-active::after {
 content: "";
    position: absolute;
    
    /* Perfect Mathematical Center Trick */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: auto !important;
    
    /* Spinner Size */
    width: 45px;
    height: 45px;
    
    /* Styling */
    border: 4px solid rgba(189, 137, 58, 0.1);
    border-top-color: #BD893A;
    border-radius: 50%;
    
    /* Animation */
    animation: off-spin 0.8s linear infinite;
    z-index: 50;
    box-sizing: border-box;
}

.orthodox-feasts-calendar .content-box.loading-active::before {
  content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    z-index: 40;
}
/* Replace the existing .date-navigation-container rule around line 12 */
.orthodox-feasts-calendar .date-navigation-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 900px;
    margin: 15px auto;
    gap: 5px;
    flex-wrap: wrap;
}

.orthodox-feasts-calendar .nav-arrow {
    background: #BD893A;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    padding: 0;
    font-family: monospace;
    box-sizing: border-box;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);

    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    accent-color: transparent !important;
    background-clip: padding-box !important;
    background-origin: border-box !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    forced-color-adjust: none !important;

    /* 🧨 EXTREMELY AGGRESSIVE FIX FOR PERSISTENT BLUE BACKGROUNDS 🧨 */
    all: unset !important; 

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: monospace !important;
    box-sizing: border-box !important;

    background-color: #BD893A !important;
    background-image: none !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    transition: background-color 0.3s ease, transform 0.2s ease !important;
    touch-action: manipulation !important;

    -moz-appearance: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.orthodox-feasts-calendar .nav-arrow:hover {
    background-color: #BD893A !important;
    transform: scale(1.05) !important;
}

.orthodox-feasts-calendar .nav-arrow:focus,
.orthodox-feasts-calendar .nav-arrow:active {
    outline: none !important;
    background: #a3722f !important;
    color: white !important;
    box-shadow: none !important;
}

.orthodox-feasts-calendar .nav-arrow:focus-visible {
    outline: 2px solid #d8b36a !important;
    outline-offset: 2px !important;
}

.orthodox-feasts-calendar .nav-arrow::-moz-focus-inner {
    border: 0 !important;
    padding: 0 !important;
}

@media (prefers-color-scheme: dark) {
    .orthodox-feasts-calendar .nav-arrow {
        background: #BD893A !important;
        color: white !important;
    }
}

.orthodox-feasts-calendar .selected-date {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding: 6px 12px;
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    min-width: 110px;
}

.orthodox-feasts-calendar .content-box {
    margin-top: 20px;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #e9edf2;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.5s ease-out;
}

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

.orthodox-feasts-calendar .content-box img {
    max-width: 90%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
    margin-bottom: 15px;
    border: 1px solid #f2f4f7;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.orthodox-feasts-calendar .content-box h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
}

.orthodox-feasts-calendar .content-box p {
    font-size: 15px;
    line-height: 1.5;
    color: #444;
    margin: 0 0 12px 0;
}

.orthodox-feasts-calendar .content-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid #eee;
}

.orthodox-feasts-calendar .content-box li {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    color: #333;
    text-align: left;
    padding-left: 8px;
    position: relative;
}

.orthodox-feasts-calendar .content-box li:before {
    content: "•";
    color: #6a5acd;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    position: absolute;
    left: 0;
    top: 8px;
}

.orthodox-feasts-calendar .content-box li:last-child {
    border-bottom: none;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .orthodox-feasts-calendar .date-navigation-container {
        flex-wrap: wrap;
        gap: 6px;
        margin: 10px auto;
    }
    .orthodox-feasts-calendar .nav-arrow {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .orthodox-feasts-calendar .selected-date {
        font-size: 16px;
        padding: 5px 8px;
        min-width: 90px;
    }
    .orthodox-feasts-calendar .content-box {
        padding: 15px;
        margin-top: 15px;
        max-width: 95%;
    }
    .orthodox-feasts-calendar .content-box img {
        max-height: 250px;
        max-width: 100%;
    }
    .orthodox-feasts-calendar .content-box h2 {
        font-size: 16px;
    }
    .orthodox-feasts-calendar .content-box p {
        font-size: 13px;
    }
    .orthodox-feasts-calendar .content-box ul {
        border-top: none;
    }
    .orthodox-feasts-calendar .content-box li {
        font-size: 12px;
        padding-left: 6px;
    }
    .orthodox-feasts-calendar .content-box li:before {
        top: 6px;
    }
    .orthodox-feasts-calendar .admin-edit-db-btn {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}

.orthodox-feasts-calendar .today-button {
    background-color: #BD893A;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: manipulation !important;
}

.orthodox-feasts-calendar .today-button:hover {
    background-color: #BD893A;
    transform: translateY(-1px);
}

.orthodox-feasts-calendar .today-button:active {
    background-color: #BD893A;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.orthodox-feasts-calendar .today-button::before {
    content: '📅';
    margin-right: 5px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .orthodox-feasts-calendar .today-button {
        padding: 8px 10px;
        font-size: 12px;
    }
    .orthodox-feasts-calendar .today-button::before {
        margin-right: 4px;
        font-size: 14px;
    }
}

#daynames {
    color: #BD893A;
}

/* Datepicker specific styles */
.orthodox-feasts-calendar .datepicker-container {
    margin-top: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
}

.orthodox-feasts-calendar .datepicker-input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 18px;
    width: 200px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    background-color: #fff; 
    cursor: pointer;
}

/* ============================================================
   PREMIUM MODERN DATEPICKER OVERHAUL
   ============================================================ */

.ui-datepicker {
    width: 320px !important; /* Increased width to prevent clipping */
    background: #ffffff !important;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18) !important;
    padding: 12px !important;
    font-family: 'Inter', sans-serif !important;
    margin-top: 10px !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
}

.ui-datepicker a { 
    text-decoration: none !important; 
    border-bottom: none !important; 
}

.ui-datepicker .ui-datepicker-header {
    background: transparent !important;
    border: none !important;
    color: #333 !important;
    padding: 8px 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ui-datepicker .ui-datepicker-title {
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #1a1a1a !important;
    order: 2;
    margin: 0 auto !important;
}

.ui-datepicker .ui-datepicker-prev, 
.ui-datepicker .ui-datepicker-next {
    position: static !important;
    cursor: pointer !important;
    background: #f1f3f5 !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
}

/* Arrow Hover Animations */
.ui-datepicker .ui-datepicker-prev:hover, 
.ui-datepicker .ui-datepicker-next:hover {
    background: #e9ecef !important;
    transform: scale(1.15) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08) !important;
}

.ui-datepicker .ui-datepicker-prev { order: 1; }
.ui-datepicker .ui-datepicker-next { order: 3; }

.ui-datepicker .ui-datepicker-prev span, 
.ui-datepicker .ui-datepicker-next span { display: none !important; }

.ui-datepicker .ui-datepicker-prev::before { content: '←'; font-size: 14px; color: #BD893A; font-weight: bold; }
.ui-datepicker .ui-datepicker-next::before { content: '→'; font-size: 14px; color: #BD893A; font-weight: bold; }

.ui-datepicker-calendar {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.ui-datepicker-calendar th {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: #adb5bd !important;
    padding: 8px 0 !important;
    text-align: center !important;
}

.ui-datepicker-calendar td {
    padding: 3px 0 !important;
    text-align: center !important;
}

/* Circular Day Numbers */
.ui-datepicker-calendar td a, 
.ui-datepicker-calendar td span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important; /* Fixed size for Sunday alignment */
    height: 34px !important;
    border-radius: 50% !important;
    border: none !important;
    background: transparent !important;
    color: #495057 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    margin: 0 auto !important;
    transition: all 0.2s ease !important;
}

.ui-datepicker-calendar td a:hover { 
    background: #f8f9fa !important; 
    color: #BD893A !important; 
}

.ui-datepicker-calendar .ui-state-highlight {
    background: rgba(189, 137, 58, 0.1) !important;
    color: #BD893A !important;
    font-weight: 700 !important;
    border: 1px solid #BD893A !important;
}

.ui-datepicker-calendar .ui-state-active {
    background: #BD893A !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(189, 137, 58, 0.3) !important;
}

.ui-datepicker .ui-datepicker-buttonpane {
    border-top: 1px solid #eee !important;
    margin: 10px -12px -12px -12px !important;
    padding: 10px 12px !important;
    display: flex;
    justify-content: space-between;
}

.ui-datepicker-buttonpane button {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #495057 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    cursor: pointer;
}

/* Animations */
.ui-datepicker { animation: datepickerSlideIn 0.2s ease-out; }
@keyframes datepickerSlideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   REST OF ORIGINAL STYLES (UNTOUCHED)
   ============================================================ */

.orthodox-feasts-calendar .nav-arrow,
.orthodox-feasts-calendar button.nav-arrow {
    background-color: #BD893A !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
    -moz-appearance: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    accent-color: auto !important;
    background-image: none !important;
}

.orthodox-feasts-calendar .nav-arrow::-moz-focus-inner {
    border: 0 !important;
    padding: 0 !important;
}

@media (forced-colors: active) {
    .orthodox-feasts-calendar .nav-arrow {
        forced-color-adjust: none !important;
    }
}

#prevDay{
    background-color: #BD893A !important;
}

#nextDay{
    background-color: #BD893A !important;
}

#datepicker.datepicker-input {
    width: 230px;
    max-width: 100%;
    text-align: center;
    padding: 6px 10px;
    box-sizing: border-box;
}

#fastingRule {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.fasting-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.fast-icon {
    margin-right: 8px;
    font-size: 18px;
}

.fast-everything { background-color: #e8f5e9; color: #2e7d32; }
.fast-fish { background-color: #e3f2fd; color: #1565c0; }
.fast-oil { background-color: #fff3e0; color: #ef6c00; }
.fast-dairy { background-color: #fffde7; color: #fbc02d; border: 1px solid #f9f1c7; }
.fast-strict { background-color: #ffebee; color: #c62828; }

#fastingRule div {
    animation: fadeInScale 0.4s ease-out;
}

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

.saint-carousel-container {
    position: relative !important;
    width: 100% !important;
    max-width: 300px !important;
    margin: 20px auto !important;
    overflow: hidden !important;
    background: #f4f4f4 !important;
    border-radius: 8px !important;
    aspect-ratio: 3 / 4 !important; 
    display: none; 
    border: 1px solid #ddd !important;
    isolation: isolate; 
    z-index: 1; 
}

.carousel-track {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    transition: transform 0.6s ease-in-out !important;
}

.carousel-img {
    flex: 0 0 100% !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important; 
    display: block !important;
}

/* Updated Carousel Buttons for isolation and touch performance */
.carousel-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(189, 137, 58, 0.9) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 5 !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important;
    transition: background 0.2s ease !important;
    
    /* Responsive Fixes */
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.carousel-btn:hover { background: rgba(189, 137, 58, 1) !important; }
.carousel-btn.prev { left: 10px !important; }
.carousel-btn.next { right: 10px !important; }
.carousel-btn::before { font-size: 20px !important; font-family: Arial, sans-serif !important; }

@media (max-width: 400px) {
    .carousel-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }
}

@media (max-width: 600px) {
    .saint-carousel-container {
        max-width: 260px !important;
        min-height: 346px !important;
    }
}

.content-box {
    height: auto !important;
    overflow: visible !important;
}

@media (max-width: 480px) {
    .orthodox-feasts-calendar .date-navigation-container {
        gap: 5px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    #datepicker.datepicker-input {
        width: 150px !important;
        min-width: 130px !important;
        font-size: 13px !important; 
        padding: 6px 2px !important;
        flex: 0 1 auto !important;
    }
    .orthodox-feasts-calendar .nav-arrow {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0 !important;
        font-size: 14px !important;
    }
    .orthodox-feasts-calendar .today-button {
        width: 100% !important;
        max-width: 100px !important;
        margin: 10px auto 0 auto !important;
        display: flex !important;
        order: 10;
    }
    .orthodox-feasts-calendar .datepicker-container {
        margin: 0 !important;
        display: flex !important;
        align-items: center;
    }
}

@media (max-width: 340px) {
    #datepicker.datepicker-input {
        width: 120px !important;
        font-size: 12px !important;
    }
    .orthodox-feasts-calendar .nav-arrow {
        width: 28px !important;
        height: 28px !important;
    }
}

#carouselTrack {
    display: flex;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
}

.orthodox-feasts-calendar button {
    -webkit-tap-highlight-color: transparent;
}

/* Hide carousel buttons if there is only one image (or no images) */
.saint-carousel-container:has(.carousel-img:only-child) .carousel-btn {
    display: none !important;
}

/* Optional: Hide buttons if the track is empty */
.saint-carousel-container:has(:not(.carousel-img)) .carousel-btn {
    display: none;
}

.content-box.loading-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 40;
}

@keyframes off-spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}