/**
 * Add to Calendar Component Styles
 *
 * @package EventTheme
 * @since 1.1.0
 */

/* ============================
   Wrapper & Base Styles
   ============================ */

.add-to-calendar-wrapper {
    position: relative;
    display: inline-block;
}

/* ============================
   Button Styles
   ============================ */

.add-to-calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--button-color, #007bff);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-to-calendar-btn:hover {
    background: var(--button-hover-color, #0056b3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.add-to-calendar-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-to-calendar-btn:focus {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

/* Button Icons */
.add-to-calendar-btn .fa-calendar-plus {
    font-size: 18px;
}

.add-to-calendar-btn .dropdown-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.add-to-calendar-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* ============================
   Button Size Variations
   ============================ */

/* Large button (event pages) */
.add-to-calendar-large .add-to-calendar-btn {
    padding: 14px 24px;
    font-size: 18px;
}

.add-to-calendar-large .add-to-calendar-btn .fa-calendar-plus {
    font-size: 20px;
}

/* Medium button (default) */
.add-to-calendar-medium .add-to-calendar-btn {
    padding: 12px 20px;
    font-size: 16px;
}

/* Small button (event cards) */
.add-to-calendar-small .add-to-calendar-btn {
    padding: 8px 14px;
    font-size: 14px;
}

.add-to-calendar-small .add-to-calendar-btn .fa-calendar-plus {
    font-size: 16px;
}

/* ============================
   Dropdown Menu Styles (Shared)
   ============================ */

.calendar-dropdown,
.calendar-date-picker {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.calendar-dropdown.show,
.calendar-date-picker.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.calendar-dropdown-header {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    font-weight: 700;
    color: #333333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Calendar Options List */
.calendar-options {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    margin-left: 0px!important;
}

.calendar-options li {
    margin: 0;
    padding: 0;
}

.calendar-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    color: #333333;
    text-decoration: none;
    transition: background 0.2s ease;
    cursor: pointer;
}

.calendar-option:hover,
.calendar-option:focus {
    background: #f5f5f5;
}

.calendar-option:active {
    background: #e0e0e0;
}

/* Calendar Icons */
.calendar-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #666666;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Platform-specific icon colors */
.fa-google {
    color: #4285F4;
}

.fa-microsoft {
    color: #00A4EF;
}

.fa-yahoo {
    color: #7B0099;
}

.fa-apple {
    color: #555555;
}

.fa-download {
    color: #28a745;
}

/* Calendar Name */
.calendar-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #333333;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Calendar Subtitle */
.calendar-subtitle {
    display: block;
    font-size: 12px;
    color: #666666;
    margin-top: 2px;
}

/* Download Option */
.calendar-download {
    flex-direction: column;
    align-items: flex-start;
}

.calendar-download .calendar-icon {
    margin-bottom: 4px;
}

/* Divider */
.calendar-options .divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* ============================
   Mobile Responsive Styles
   ============================ */

@media (max-width: 768px) {
    .add-to-calendar-wrapper {
        width: 100%;
    }

    .add-to-calendar-btn {
        width: 100%;
        justify-content: center;
    }

    .calendar-dropdown,
    .calendar-date-picker {
        left: 0;
        right: 0;
        min-width: auto;
        max-width: 100%;
    }

    /* Make buttons larger on mobile for better touch targets */
    .add-to-calendar-small .add-to-calendar-btn {
        padding: 10px 16px;
        font-size: 15px;
    }

    .calendar-option,
    .date-option {
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    /* Even larger touch targets on small phones */
    .calendar-option,
    .date-option {
        padding: 16px 20px;
        font-size: 16px;
    }

    .calendar-icon {
        font-size: 22px;
    }
}

/* ============================
   Right-Aligned Dropdown
   ============================ */

.add-to-calendar-wrapper.align-right .calendar-dropdown,
.add-to-calendar-wrapper.align-right .calendar-date-picker {
    left: auto;
    right: 0;
}

/* ============================
   Loading State
   ============================ */

.add-to-calendar-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.add-to-calendar-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: calendar-spin 0.8s linear infinite;
}

@keyframes calendar-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================
   Dark Mode Support
   ============================ */

@media (prefers-color-scheme: dark) {
    .calendar-dropdown,
    .calendar-date-picker {
        background: #2d2d2d;
        border-color: #444444;
    }

    .calendar-dropdown-header {
        color: #ffffff;
        border-bottom-color: #444444;
    }

    .calendar-option,
    .date-option {
        color: #ffffff;
    }

    .calendar-option:hover,
    .calendar-option:focus,
    .date-option:hover,
    .date-option:focus {
        background: #3d3d3d;
    }

    .calendar-option:active,
    .date-option:active {
        background: #4d4d4d;
    }

    .calendar-name {
        color: #ffffff;
    }

    .calendar-subtitle {
        color: #aaaaaa;
    }

    .calendar-icon {
        color: #aaaaaa;
    }

    .calendar-options .divider,
    .date-options .divider {
        background: #444444;
    }
}

/* ============================
   Accessibility Enhancements
   ============================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .add-to-calendar-btn {
        border: 2px solid currentColor;
    }

    .calendar-dropdown {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .add-to-calendar-btn,
    .calendar-dropdown,
    .calendar-date-picker,
    .dropdown-arrow,
    .calendar-option,
    .date-option {
        transition: none;
    }

    .add-to-calendar-btn[aria-expanded="true"] .dropdown-arrow {
        transform: none;
    }

    @keyframes calendar-spin {
        to {
            transform: none;
        }
    }
}

/* Focus visible for keyboard navigation */
.calendar-option:focus-visible,
.date-option:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* ============================
   Date Picker Styles
   ============================ */

.calendar-date-picker {
    min-width: 280px;
}

/* Date Options List - USE EXACT SAME STYLES AS CALENDAR OPTIONS */
.date-options {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    margin-left: 0px!important;
}

.date-options li {
    margin: 0;
    padding: 0;
}

/* Date option - EXACT COPY of calendar-option */
.date-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 5px 12px;
    color: #333333;
    text-decoration: none;
    transition: background 0.2s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #444444;
}

.date-option:hover,
.date-option:focus {
    background: #555555;
}

.date-option:active {
    background: #555555;
}

/* Date option icon colors */
.date-option .fa-calendar-day {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #007bff;
}

.date-options .divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* Calendar Dropdown Footer (Back button) */
.calendar-dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid #444444;
}

.back-to-dates-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #444444;
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-dates-btn:hover,
.back-to-dates-btn:focus {
    border-color: #555555;
    outline: none;
}

.back-to-dates-btn .fa-arrow-left {
    font-size: 12px;
}

/* ============================
   Print Styles
   ============================ */

@media print {
    .add-to-calendar-wrapper {
        display: none;
    }
}
