/**
 * Cowdray Events Widget - Base Styles
 * These provide defaults that can be overridden via Elementor controls
 */

/* Widget Container */
.ce-events-widget {
    font-family: inherit;
    line-height: 1.6;
}

.ce-events-widget * {
    box-sizing: border-box;
}

/* ===========================
   SEARCH BAR
   =========================== */
.ce-search-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 0;
    margin-bottom: 20px;
}

.ce-search-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    position: relative;
}

.ce-search-icon {
    color: #c9a227;
    flex-shrink: 0;
}

.ce-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #333;
    background: transparent;
    padding: 8px 0;
    border-radius: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.ce-search-input::placeholder {
    color: #999;
}

.ce-search-button {
    padding: 12px 24px;
    background: #c9a227;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.ce-search-button:hover {
    background: #b08f1f;
}

/* Autocomplete Dropdown */
.ce-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.ce-autocomplete.active {
    display: block;
}

.ce-autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f5f5f5;
}

.ce-autocomplete-item:last-child {
    border-bottom: none;
}

.ce-autocomplete-item:hover,
.ce-autocomplete-item.selected {
    background: #f9f9f9;
}

.ce-autocomplete-title {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.ce-autocomplete-date {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    margin-left: 12px;
}

/* View Toggle */
.ce-view-toggle {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ce-view-toggle button {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.ce-view-toggle button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.ce-view-toggle button:hover {
    color: #333;
}

.ce-view-toggle button.active {
    color: #333;
}

.ce-view-toggle button.active::after {
    background: #c9a227;
}

/* ===========================
   DATE NAVIGATION
   =========================== */
.ce-date-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    margin-bottom: 20px;
}

.ce-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ce-nav-arrow:hover {
    color: #333;
}

.ce-today-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ce-today-btn:hover {
    border-color: #ccc;
    color: #333;
}

.ce-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ce-date-range-text {
    font-size: 24px;
    font-weight: 400;
    color: #333;
}

.ce-dropdown-arrow {
    color: #999;
}

/* ===========================
   EVENTS LIST
   =========================== */
.ce-events-list {
    /* Container for events */
}

.ce-month-group {
    margin-bottom: 0;
}

.ce-month-header {
    font-size: 14px;
    font-weight: 400;
    color: #666;
    margin: 0 0 16px 0;
    padding: 0;
    position: relative;
}

.ce-month-header::after {
    content: '';
    position: absolute;
    left: 120px;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e5e5e5;
}

/* ===========================
   EVENT ROW
   =========================== */
.ce-event-row {
    display: flex;
    gap: 24px;
    padding: 32px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
}

.ce-event-row:last-child {
    border-bottom: none;
}

/* Date Column */
.ce-event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    width: 60px;
    flex-shrink: 0;
    text-align: center;
}

.ce-date-weekday {
    font-size: 11px;
    font-weight: 500;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.ce-date-day {
    font-size: 32px;
    font-weight: 400;
    color: #333;
    line-height: 1;
}

/* Content Column */
.ce-event-content {
    flex: 1;
    min-width: 0;
}

.ce-event-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.3;
}

.ce-event-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ce-event-title a:hover {
    color: #c9a227;
}

.ce-event-datetime {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ce-recurring-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #c9a227;
    text-decoration: none;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ce-recurring-link:hover {
    text-decoration: underline;
}

.ce-event-venue {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

.ce-event-venue strong {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.ce-event-description {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ce-event-footer {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ce-buy-tickets {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ce-buy-tickets:hover {
    color: #c9a227;
}

.ce-event-price {
    font-size: 14px;
    color: #666;
}

/* Image Column */
.ce-event-image {
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
}

.ce-event-image a {
    display: block;
}

.ce-event-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* No Events */
.ce-no-events {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* ===========================
   MONTH VIEW - CALENDAR
   =========================== */
.ce-month-view {
    display: none;
}

.ce-events-list[data-view="month"] .ce-month-view {
    display: block;
}

.ce-events-list[data-view="month"] .ce-month-group,
.ce-events-list[data-view="month"] .ce-event-row {
    display: none;
}

.ce-calendar {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
}

.ce-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
}

.ce-calendar-header span {
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ce-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.ce-calendar-day {
    min-height: 100px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.ce-calendar-day:hover {
    background: #fafafa;
}

.ce-calendar-day.other-month {
    background: #f9f9f9;
}

.ce-calendar-day.other-month .ce-day-number {
    color: #ccc;
}

.ce-calendar-day.today {
    background: #fffbeb;
}

.ce-calendar-day.today .ce-day-number {
    color: #c9a227;
    font-weight: 600;
}

.ce-day-number {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.ce-day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ce-day-event {
    font-size: 11px;
    padding: 4px 6px;
    background: #ffc03a;
    color: #333;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ce-day-event:hover {
    background: #e6ad34;
}

.ce-day-more {
    font-size: 11px;
    color: #999;
    padding: 2px 0;
}

/* ===========================
   DAY VIEW
   =========================== */
.ce-day-view {
    display: none;
}

.ce-events-list[data-view="day"] .ce-day-view {
    display: block;
}

.ce-events-list[data-view="day"] .ce-month-group,
.ce-events-list[data-view="day"] .ce-event-row,
.ce-events-list[data-view="day"] .ce-month-view {
    display: none;
}

.ce-day-view-header {
    text-align: center;
    padding: 24px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 24px;
}

.ce-day-view-date {
    font-size: 48px;
    font-weight: 300;
    color: #333;
    line-height: 1;
    margin-bottom: 8px;
}

.ce-day-view-weekday {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ce-day-view-events {
    /* Events for the selected day */
}

.ce-day-view-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Mobile Calendar Tooltip (JS-controlled) */
.ce-calendar-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    padding: 10px 14px;
    border-radius: 4px;
    max-width: 280px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ce-calendar-tooltip.visible {
    opacity: 1;
}

/* ===========================
   RESPONSIVE - CALENDAR
   =========================== */
@media (max-width: 768px) {
    .ce-calendar-day {
        min-height: 70px;
        padding: 6px;
    }

    .ce-day-number {
        font-size: 12px;
    }

    .ce-day-event {
        font-size: 10px;
        padding: 3px 4px;
    }

    .ce-calendar-header span {
        padding: 10px 4px;
        font-size: 10px;
    }

    .ce-day-view-date {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .ce-calendar-day {
        min-height: 50px;
        padding: 4px;
        position: relative;
    }

    .ce-day-events {
        display: flex;
        flex-direction: row;
        gap: 3px;
        flex-wrap: wrap;
        margin-top: 4px;
    }

    .ce-day-event {
        width: 8px;
        height: 8px;
        min-width: 8px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        overflow: hidden;
    }

    /* Hide CSS tooltip on mobile - using JS tooltip instead */
    .ce-calendar-day.has-events::after,
    .ce-calendar-day.has-events::before {
        display: none;
    }

    .ce-calendar-day.has-events:hover::after,
    .ce-calendar-day.has-events:focus::after,
    .ce-calendar-day.has-events:active::after {
        opacity: 1;
        visibility: visible;
    }

    .ce-calendar-day.has-events:hover::before,
    .ce-calendar-day.has-events:focus::before,
    .ce-calendar-day.has-events:active::before {
        opacity: 1;
        visibility: visible;
    }

    .ce-day-more {
        font-size: 9px;
        width: auto;
    }

    .ce-calendar-header span {
        font-size: 9px;
        letter-spacing: 0;
    }
}

/* ===========================
   LOADING STATE
   =========================== */
.ce-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    color: #999;
}

.ce-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top-color: #c9a227;
    border-radius: 50%;
    animation: ce-spin 0.8s linear infinite;
}

@keyframes ce-spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
    .ce-event-image {
        width: 220px;
        min-width: 220px;
    }

    .ce-event-image img {
        height: 140px;
    }
}

@media (max-width: 768px) {
    /* Search Bar - Mobile */
    .ce-search-bar {
        flex-direction: column;
        gap: 0;
        padding: 20px;
        border: none;
        background: transparent;
    }

    .ce-search-wrapper {
        display: flex;
        width: 100%;
        flex-wrap: nowrap !important;
        gap: 12px;
        padding-bottom: 20px;
        border-bottom: 1px solid #f0f0f0;
    }

    .ce-search-icon {
        display: none;
    }

    .ce-search-input {
        flex: 1 1 auto;
        min-width: 0 !important;
        width: auto;
        border: 1px solid #e5e5e5;
        border-radius: 0;
        padding: 14px 16px;
        font-size: 15px;
    }

    .ce-search-button {
        flex: 0 0 auto;
        width: auto !important;
        padding: 14px 24px;
    }

    /* View Toggle - Mobile */
    .ce-view-toggle {
        width: 100%;
        justify-content: center;
        padding: 16px 0;
        gap: 24px;
    }

    /* Date Navigation - Mobile */
    .ce-date-navigation {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        align-items: center;
        padding: 12px 0;
    }

    .ce-nav-arrow {
        width: 32px;
        height: 32px;
    }

    .ce-today-btn {
        padding: 8px 16px;
        margin-left: 8px;
    }

    .ce-date-range {
        width: auto;
        margin-left: auto;
    }

    .ce-date-range-text {
        font-size: 18px;
    }

    /* Event Row - Mobile */
    .ce-event-row {
        display: flex;
        flex-wrap: wrap;
        padding: 24px 0;
        gap: 12px;
    }

    .ce-event-date {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 50px;
        min-width: 50px;
        flex-shrink: 0;
        order: 1;
    }

    .ce-date-weekday {
        margin-bottom: 0;
        font-size: 12px;
    }

    .ce-date-day {
        font-size: 36px;
        line-height: 1.1;
    }

    .ce-event-image {
        flex: 1;
        min-width: 0 !important;
        width: auto !important;
        order: 2;
        margin-left: 0;
    }

    .ce-event-image img {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    .ce-event-content {
        width: calc(100% - 62px);
        flex: 0 0 calc(100% - 62px);
        margin-left: 62px;
        padding-left: 0;
        box-sizing: border-box;
        order: 3;
    }

    .ce-event-title {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .ce-event-datetime {
        font-size: 13px;
    }

    .ce-month-header {
        padding-left: 0;
    }

    .ce-month-header::after {
        left: 120px;
    }
}

@media (max-width: 480px) {
    .ce-search-bar {
        padding: 16px;
    }

    .ce-search-input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .ce-search-button {
        padding: 12px 16px;
        font-size: 13px;
    }

    .ce-view-toggle {
        gap: 16px;
    }

    .ce-view-toggle button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .ce-date-range-text {
        font-size: 16px;
    }

    .ce-event-date {
        padding-left: 16px;
    }

    .ce-event-content {
        padding-left: 0;
    }

    .ce-event-title {
        font-size: 20px;
    }

    .ce-event-description {
        font-size: 14px;
    }
}
