/**
 * Calendar Month View Styles
 * @package Vieww
 */

.vieww-calendar-view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header */
.vieww-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.vieww-cal-title {
    font-size: 1.75rem;
    margin: 0;
    font-weight: 600;
    color: #333;
}

.vieww-cal-nav {
    background: transparent;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    /* Better touch targets for mobile */
    min-width: 44px;
    min-height: 44px;
}

.vieww-cal-nav:hover {
    background: var(--e-global-color-accent, #2A7A7A);
    color: #fff;
    border-color: var(--e-global-color-accent, #2A7A7A);
}

/* Remove hover effects on touch devices */
@media (hover: none) {
    .vieww-cal-nav:hover {
        background: transparent;
        color: #666;
        border-color: #ddd;
    }

    .vieww-cal-nav:active {
        background: var(--e-global-color-accent, #2A7A7A);
        color: #fff;
        border-color: var(--e-global-color-accent, #2A7A7A);
    }
}

.vieww-cal-today {
    padding: 8px 16px;
    background: var(--e-global-color-primary, #2A7A7A);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.3s;
    /* Better touch target */
    min-height: 44px;
}

.vieww-cal-today:hover {
    opacity: 0.9;
}

@media (hover: none) {
    .vieww-cal-today:hover {
        opacity: 1;
    }

    .vieww-cal-today:active {
        opacity: 0.9;
    }
}

/* Grid */
.vieww-cal-grid {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    /* Prevent horizontal scrolling on mobile */
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.vieww-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.vieww-cal-weekday {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Days Grid */
.vieww-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.vieww-cal-day {
    min-height: 120px;
    padding: 8px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    position: relative;
}

.vieww-cal-day:nth-child(7n) {
    border-right: none;
}

.vieww-cal-empty {
    background: #fafafa;
}

.vieww-cal-day-number {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.vieww-cal-today-cell {
    background: #fffbf0;
}

.vieww-cal-today-cell .vieww-cal-day-number {
    color: var(--e-global-color-accent, #2A7A7A);
    font-weight: 700;
}

.vieww-cal-has-events {
    background: #f9f9f9;
}

/* Events */
.vieww-cal-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vieww-cal-event {
    display: block;
    background: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 11px;
    line-height: 1.3;
    border-left: 3px solid var(--e-global-color-primary, #2A7A7A);
    transition: all 0.2s;
    overflow: hidden;
}

.vieww-cal-event:hover {
    background: #e0f0ff;
    transform: translateX(2px);
}

.vieww-cal-event-img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
    margin-bottom: 4px;
}

.vieww-cal-event-content {
    display: flex;
    flex-direction: column;
}

.vieww-cal-event-time {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
}

.vieww-cal-event-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vieww-cal-more {
    font-size: 11px;
    color: #999;
    font-style: italic;
    padding: 4px 6px;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .vieww-calendar-view {
        padding: 15px;
    }

    .vieww-cal-day {
        min-height: 100px;
        padding: 6px;
    }

    .vieww-cal-event {
        font-size: 10px;
        padding: 3px 5px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .vieww-calendar-view {
        padding: 10px;
        border-radius: 8px;
    }

    .vieww-cal-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }

    .vieww-cal-title {
        font-size: 1.3rem;
        order: 1;
        width: 100%;
        text-align: center;
    }

    .vieww-cal-nav {
        order: 2;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .vieww-cal-today {
        order: 2;
        font-size: 13px;
        padding: 6px 12px;
    }

    .vieww-cal-day {
        min-height: 70px;
        padding: 4px;
    }

    .vieww-cal-day-number {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .vieww-cal-event {
        font-size: 9px;
        padding: 2px 4px;
        border-left-width: 2px;
    }

    .vieww-cal-event-title {
        -webkit-line-clamp: 1;
        font-size: 10px;
    }

    .vieww-cal-event-time {
        font-size: 9px;
    }

    .vieww-cal-event-img {
        display: none;
    }

    .vieww-cal-weekday {
        font-size: 9px;
        padding: 8px 2px;
    }

    .vieww-cal-more {
        font-size: 9px;
        padding: 2px 4px;
    }
}

/* Small Mobile (phones in portrait) */
@media (max-width: 480px) {
    .vieww-calendar-view {
        padding: 8px;
        margin: 0 -10px; /* Bleed to edges on very small screens */
        border-radius: 0;
    }

    .vieww-cal-header {
        padding: 0 5px;
        margin-bottom: 10px;
    }

    .vieww-cal-title {
        font-size: 1.1rem;
    }

    .vieww-cal-nav {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .vieww-cal-today {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Compress the calendar cells more on tiny screens */
    .vieww-cal-day {
        min-height: 60px;
        padding: 3px;
    }

    .vieww-cal-day-number {
        font-size: 11px;
        margin-bottom: 3px;
    }

    /* Show abbreviated weekdays on very small screens */
    .vieww-cal-weekday {
        font-size: 8px;
        padding: 6px 1px;
        letter-spacing: 0;
    }

    /* Simplify events on small screens */
    .vieww-cal-event {
        font-size: 8px;
        padding: 2px 3px;
        gap: 2px;
    }

    .vieww-cal-event-title {
        font-size: 9px;
    }

    .vieww-cal-event-time {
        display: none; /* Hide time on very small screens to save space */
    }

    /* Show only 2 events max on mobile */
    .vieww-cal-events {
        gap: 2px;
    }
}

/* Landscape mode on mobile devices */
@media (max-width: 896px) and (orientation: landscape) {
    .vieww-calendar-view {
        padding: 10px;
    }

    .vieww-cal-header {
        margin-bottom: 10px;
    }

    .vieww-cal-title {
        font-size: 1.2rem;
    }

    .vieww-cal-day {
        min-height: 65px;
        padding: 3px;
    }

    .vieww-cal-day-number {
        font-size: 11px;
    }

    .vieww-cal-event {
        font-size: 9px;
        padding: 2px 3px;
    }

    .vieww-cal-weekday {
        font-size: 9px;
        padding: 6px 2px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .vieww-cal-nav,
    .vieww-cal-today,
    .vieww-cal-event {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vieww-cal-grid {
        border-width: 2px;
    }

    .vieww-cal-day {
        border-width: 2px;
    }

    .vieww-cal-event {
        border-left-width: 4px;
    }
}

/* Print styles */
@media print {
    .vieww-calendar-view {
        box-shadow: none;
        border: 1px solid #000;
    }

    .vieww-cal-nav,
    .vieww-cal-today,
    .vieww-view-toggle {
        display: none;
    }

    .vieww-cal-event:hover {
        transform: none;
        background: #fff;
    }

    .vieww-cal-day {
        min-height: 100px;
    }

    .vieww-mobile-modal,
    .vieww-mobile-list-view {
        display: none !important;
    }
}

/* View Toggle Button */
.vieww-view-toggle {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s;
    min-height: 44px;
    display: none; /* Hidden by default, shown on mobile */
}

.vieww-view-toggle:hover {
    background: #e0e0e0;
}

@media (max-width: 768px) {
    .vieww-view-toggle {
        display: inline-block;
        order: 3;
        width: 100%;
        margin-top: 5px;
    }
}

/* Mobile List View */
.vieww-mobile-list-view {
    padding: 15px 0;
}

.vieww-mobile-events-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vieww-mobile-event-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.vieww-mobile-event-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.vieww-mobile-event-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.vieww-mobile-event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vieww-mobile-event-details {
    padding: 15px;
}

.vieww-mobile-event-date {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.vieww-mobile-event-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.vieww-mobile-event-time {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.vieww-mobile-event-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.vieww-mobile-event-link {
    display: inline-block;
    background: var(--e-global-color-primary, #2A7A7A);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.vieww-mobile-event-link:hover {
    opacity: 0.9;
    color: #fff;
}

/* Mobile Modal */
.vieww-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vieww-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.vieww-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: viewwModalSlideUp 0.3s ease-out;
}

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

.vieww-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.vieww-modal-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

.vieww-modal-body {
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

.vieww-modal-events {
    display: flex;
    flex-direction: column;
}

.vieww-modal-event {
    padding: 15px 0;
}

.vieww-modal-event:first-child {
    padding-top: 0;
}

.vieww-modal-event:last-child {
    padding-bottom: 0;
}

.vieww-modal-event-image {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.vieww-modal-event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vieww-modal-event-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    padding-right: 30px; /* Space for close button */
}

.vieww-modal-event-time {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.vieww-modal-event-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 15px 0;
}

.vieww-modal-event-link {
    display: inline-block;
    background: var(--e-global-color-primary, #2A7A7A);
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.vieww-modal-event-link:hover {
    opacity: 0.9;
    color: #fff;
}

.vieww-modal-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 20px 0;
}

/* Make calendar days clickable on mobile */
@media (max-width: 768px) {
    .vieww-cal-day.vieww-cal-has-events {
        cursor: pointer;
        transition: background-color 0.2s;
    }

    .vieww-cal-day.vieww-cal-has-events:active {
        background: #f0f0f0;
    }

    /* Disable pointer events on event links inside days on mobile */
    .vieww-cal-day.vieww-cal-has-events .vieww-cal-event {
        pointer-events: none;
    }
}

/* Desktop: modal should not appear */
@media (min-width: 769px) {
    .vieww-modal {
        display: none !important;
    }

    .vieww-view-toggle {
        display: none !important;
    }

    .vieww-mobile-list-view {
        display: none !important;
    }
}
