/**
 * Custer County Events Calendar Styles
 * Matches the Custer County website design system
 */

:root {
    --stone-50: #fafaf9;
    --stone-100: #f5f5f4;
    --stone-800: #292524;
    --stone-900: #1c1917;
    --alpine-blue: #7da3b5;
    --alpine-dark: #5a7c8f;
    --alpine-light: #9fc2d3;
    --mountain-slate: #4a5e54;
    --mountain-deep: #364238;
}

/* Calendar Container */
.cc-calendar-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: 'Work Sans', sans-serif;
}

/* Calendar Header */
.cc-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    background: white;
    border-left: 6px solid var(--alpine-blue);
    margin-bottom: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
}

.cc-calendar-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    font-weight: 900;
    color: var(--stone-900);
    margin: 0;
}

.cc-calendar-nav {
    display: flex;
    gap: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem);
}

.cc-nav-btn {
    background: var(--alpine-blue);
    color: white;
    border: none;
    padding: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem) clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    cursor: pointer;
    transition: background 0.2s;
    min-height: 44px;
    min-width: 44px;
}

.cc-nav-btn:hover {
    background: var(--alpine-dark);
}

.cc-nav-btn:focus {
    outline: 2px solid var(--alpine-blue);
    outline-offset: 2px;
}

.cc-today-btn {
    background: var(--mountain-slate);
}

.cc-today-btn:hover {
    background: var(--mountain-deep);
}

/* Calendar Grid */
.cc-calendar-grid {
    background: white;
    border-left: 6px solid var(--alpine-blue);
    overflow-x: auto;
}

.cc-calendar-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    table-layout: fixed;
}

.cc-calendar-table th {
    background: var(--alpine-light);
    color: var(--stone-900);
    font-family: 'Work Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    text-align: center;
    border-bottom: 2px solid var(--alpine-blue);
}

.cc-calendar-table td {
    border: 1px solid var(--stone-100);
    padding: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem);
    vertical-align: top;
    width: 14.28%; /* Fixed width: 100% / 7 days */
    min-height: 100px;
    background: white;
}

.cc-calendar-table td.cc-other-month {
    background: var(--stone-50);
    color: #999;
}

.cc-calendar-table td.cc-today {
    background: #eff6ff;
    border: 2px solid var(--alpine-blue);
}

.cc-day-number {
    font-weight: 700;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    color: var(--stone-900);
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
}

.cc-other-month .cc-day-number {
    color: #999;
}

.cc-today .cc-day-number {
    color: var(--alpine-dark);
}

/* Event Items in Calendar */
.cc-event-item {
    background: var(--alpine-blue);
    color: white;
    padding: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem) clamp(0.5rem, 0.45rem + 0.25vw, 0.625rem);
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: block;
    text-decoration: none;
    line-height: 1.3;
}

.cc-event-item:hover {
    background: var(--alpine-dark);
    transform: translateX(2px);
}

.cc-event-item:focus {
    outline: 2px solid var(--stone-900);
    outline-offset: 2px;
}

.cc-event-time {
    font-size: clamp(0.65rem, 0.6rem + 0.25vw, 0.75rem);
    opacity: 0.9;
    font-weight: 600;
}

.cc-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-more-events {
    color: var(--alpine-dark);
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    font-weight: 600;
    cursor: pointer;
    margin-top: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
}

.cc-more-events:hover {
    text-decoration: underline;
}

/* Day Events List ("+N more" popup) */
.cc-day-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cc-day-event-row {
    background: var(--alpine-blue);
    color: white;
    padding: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem) clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.cc-day-event-row:hover {
    background: var(--alpine-dark);
    transform: translateX(2px);
}

.cc-day-event-row:focus {
    outline: 2px solid var(--stone-900);
    outline-offset: 2px;
}

.cc-day-event-time {
    font-size: clamp(0.65rem, 0.6rem + 0.25vw, 0.75rem);
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 0.2rem;
}

.cc-day-event-title {
    font-weight: 600;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    line-height: 1.3;
}

/* Event Modal */
.cc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
}

.cc-modal-overlay.active {
    display: flex;
}

.cc-modal {
    background: white;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-left: 6px solid var(--alpine-blue);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cc-modal-header {
    background: var(--alpine-light);
    padding: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    position: relative;
}

.cc-modal-close {
    position: absolute;
    top: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    right: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--stone-900);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.cc-modal-close:hover {
    color: var(--alpine-dark);
}

.cc-modal-close:focus {
    outline: 2px solid var(--alpine-blue);
    outline-offset: 2px;
}

.cc-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    font-weight: 900;
    color: var(--stone-900);
    margin: 0;
    padding-right: 44px;
    line-height: 1.25;
}

.cc-modal-body {
    padding: clamp(1.5rem, 1.3rem + 1vw, 2rem);
}

.cc-event-meta {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    margin-bottom: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    background: var(--stone-50);
}

.cc-meta-item {
    display: flex;
    align-items: flex-start;
    gap: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
}

.cc-meta-icon {
    font-size: 1.25rem;
    color: var(--alpine-dark);
    width: 24px;
    flex-shrink: 0;
}

.cc-meta-content {
    flex: 1;
}

.cc-meta-label {
    font-weight: 700;
    color: var(--stone-900);
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
}

.cc-meta-value {
    color: var(--stone-800);
    line-height: 1.5;
}

.cc-event-description {
    color: var(--stone-800);
    line-height: 1.4;
    margin-bottom: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 0.95rem);
}

.cc-event-description p {
    margin: 0 0 0.35em;
}

.cc-event-description p:last-child {
    margin-bottom: 0;
}

.cc-event-description br + br {
    display: none;
}

/* Modal Actions */
.cc-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    padding-top: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    border-top: 1px solid var(--stone-100);
}

.cc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: clamp(0.5rem, 0.45rem + 0.25vw, 0.625rem);
    padding: clamp(0.75rem, 0.675rem + 0.375vw, 1rem) clamp(1.5rem, 1.3rem + 1vw, 2rem);
    background: var(--alpine-blue);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 44px;
    font-family: 'Work Sans', sans-serif;
}

.cc-action-btn:hover {
    background: var(--alpine-dark);
}

.cc-action-btn:focus {
    outline: 2px solid var(--alpine-blue);
    outline-offset: 2px;
}

.cc-action-btn.secondary {
    background: var(--mountain-slate);
}

.cc-action-btn.secondary:hover {
    background: var(--mountain-deep);
}

/* Add to Calendar Dropdown */
.cc-add-calendar-dropdown {
    position: relative;
    display: inline-block;
}

.cc-calendar-options {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--stone-100);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
    min-width: 200px;
    z-index: 10;
    display: none;
}

.cc-calendar-options.active {
    display: block;
}

.cc-calendar-option {
    display: block;
    padding: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    color: var(--stone-900);
    text-decoration: none;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    transition: background 0.2s;
    border-bottom: 1px solid var(--stone-100);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.cc-calendar-option:last-child {
    border-bottom: none;
}

.cc-calendar-option:hover {
    background: var(--stone-50);
}

.cc-calendar-option:focus {
    background: var(--alpine-light);
    outline: none;
}

/* Upcoming Events Widget */
.cc-upcoming-events {
    background: white;
    border-left: 6px solid var(--alpine-blue);
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
}

.cc-upcoming-events h3 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.125rem, 1.05rem + 0.375vw, 1.375rem);
    font-weight: 700;
    color: var(--stone-900);
    margin-bottom: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    padding-bottom: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    border-bottom: 1px solid var(--stone-100);
}

.cc-upcoming-event-item {
    padding: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    border-bottom: 1px solid var(--stone-100);
    transition: background 0.2s;
    cursor: pointer;
}

.cc-upcoming-event-item:last-child {
    border-bottom: none;
}

.cc-upcoming-event-item:hover {
    background: var(--stone-50);
}

.cc-upcoming-event-date {
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    color: var(--alpine-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
}

.cc-upcoming-event-title {
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    font-weight: 600;
    color: var(--stone-900);
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
    line-height: 1.375;
}

.cc-upcoming-event-time {
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    color: var(--stone-800);
}

.cc-no-events {
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    text-align: center;
    color: var(--stone-800);
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    font-style: italic;
}

/* Loading State */
.cc-loading {
    text-align: center;
    padding: clamp(2rem, 1.7rem + 1.5vw, 3rem);
    color: var(--alpine-dark);
}

.cc-loading::after {
    content: '⏳';
    font-size: 2rem;
    display: block;
    margin-top: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cc-calendar-header {
        flex-direction: column;
        gap: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    }
    
    .cc-calendar-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .cc-nav-btn {
        flex: 1;
    }
    
    .cc-calendar-table th {
        font-size: 0.65rem;
        padding: 0.5rem 0.25rem;
    }
    
    .cc-calendar-table td {
        min-height: 80px;
        height: auto;
        padding: 0.5rem 0.25rem;
    }
    
    .cc-day-number {
        font-size: 0.75rem;
    }
    
    .cc-event-item {
        font-size: 0.65rem;
        padding: 0.25rem;
    }
    
    .cc-event-time {
        font-size: 0.6rem;
    }
    
    .cc-modal {
        max-height: 95vh;
    }
    
    .cc-modal-actions {
        flex-direction: column;
    }
    
    .cc-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .cc-calendar-nav,
    .cc-modal-actions,
    .cc-modal-close {
        display: none;
    }
    
    .cc-modal-overlay {
        position: static;
        background: none;
    }
    
    .cc-modal {
        max-width: none;
        box-shadow: none;
    }
}

/* Accessibility Enhancements */
.cc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--alpine-blue);
    outline-offset: 2px;
}

/* View Switcher */
.cc-view-switcher {
    display: flex;
    gap: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem);
    background: white;
    padding: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem);
    border-radius: 4px;
}

.cc-view-btn {
    background: var(--stone-100);
    color: var(--stone-900);
    border: none;
    padding: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem) clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-height: 44px;
    border-radius: 4px;
}

.cc-view-btn:hover {
    background: var(--alpine-light);
}

.cc-view-btn.active {
    background: var(--alpine-blue);
    color: white;
}

/* Week View Styles - VERTICAL LAYOUT - Clean Mobile Design */
.cc-calendar-week-view {
    display: none;
}

.cc-calendar-week-view.active {
    display: block;
}

.cc-calendar-month-view.active {
    display: block;
}

.cc-calendar-month-view {
    display: none;
}

.cc-week-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: var(--space-8);
}

.cc-week-day-card {
    background: white;
    border-left: 6px solid var(--alpine-blue);
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.cc-week-day-card.cc-today {
    background: #eff6ff;
    border-left-color: var(--alpine-dark);
}

.cc-week-day-card.cc-other-month {
    opacity: 0.5;
}

.cc-week-day-header {
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    background: #f9fafb;
    border-bottom: 2px solid var(--alpine-blue);
}

.cc-week-day-date {
    font-size: clamp(2rem, 1.7rem + 1.5vw, 2.5rem);
    font-weight: 900;
    color: var(--alpine-dark);
    line-height: 1;
}

.cc-week-day-name {
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stone-800);
    font-weight: 700;
    margin-top: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
}

.cc-week-events-container {
    display: flex;
    flex-direction: column;
    padding: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
    min-height: 80px;
}

.cc-week-event-card {
    background: var(--alpine-blue);
    color: white;
    padding: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    margin-bottom: clamp(0.5rem, 0.45rem + 0.25vw, 0.75rem);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.cc-week-event-card:last-child {
    margin-bottom: 0;
}

.cc-week-event-card:hover {
    background: var(--alpine-dark);
    transform: translateX(4px);
}

.cc-week-event-time {
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    font-weight: 700;
    margin-bottom: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
    opacity: 0.9;
}

.cc-week-event-title {
    font-weight: 600;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    line-height: 1.4;
}

.cc-week-no-events {
    color: var(--stone-800);
    font-style: italic;
    font-size: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
    text-align: center;
    padding: clamp(2rem, 1.8rem + 1vw, 3rem) clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
}

/* Mobile List View (for smaller screens) */
.cc-mobile-list-view {
    display: none;
}

/* Mobile adjustments - Show list view on small screens */
@media (max-width: 768px) {
    /* Vertical week cards on mobile */
    .cc-week-day-card {
        grid-template-columns: 1fr;
        gap: clamp(0.75rem, 0.675rem + 0.375vw, 1rem);
    }
    
    .cc-week-day-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .cc-week-day-date {
        font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    }
    
    /* Ensure calendar header stacks nicely */
    .cc-calendar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .cc-calendar-header > div {
        width: 100%;
    }
    
    /* Make nav buttons full width on mobile */
    .cc-calendar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .cc-nav-btn {
        width: 100%;
    }
}
