/**
 * Pollander Events Calendar CSS
 */

/* Calendar Container */
.pollander-calendar-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 2rem 0;
}

/* Calendar Controls */
.calendar-controls {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-nav {
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.btn-nav:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

#current-period {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.calendar-views {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.view-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #6b7280;
}

.view-btn.active,
.view-btn:hover {
    background: #6366f1;
    color: white;
}

.calendar-filters select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.9rem;
}

/* Calendar Content */
.calendar-content {
    padding: 1.5rem;
    min-height: 400px;
}

.loading, .error, .no-events {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 1.1rem;
}

.error {
    color: #ef4444;
}

/* Month View */
.calendar-month {
    width: 100%;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.day-header {
    background: #f3f4f6;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.calendar-day:hover {
    background: #f9fafb;
}

.calendar-day.other-month {
    background: #f8fafc;
    color: #9ca3af;
}

.calendar-day.today {
    background: #eff6ff;
    border: 2px solid #3b82f6;
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #374151;
}

.calendar-day.other-month .day-number {
    color: #9ca3af;
}

.calendar-day.today .day-number {
    color: #1d4ed8;
}

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

.calendar-day .event-item {
    background: #6366f1;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-day .event-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.event-title {
    display: block;
    font-weight: 500;
}

.event-time {
    display: block;
    opacity: 0.8;
    font-size: 0.7rem;
}

/* Week View */
.calendar-week {
    width: 100%;
    overflow-x: auto;
}

.week-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    min-width: 800px;
}

.time-header {
    background: #f3f4f6;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.week-header .day-header {
    background: #f3f4f6;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-header .day-header.today {
    background: #dbeafe;
    color: #1d4ed8;
}

.day-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.day-number {
    font-size: 1.2rem;
    font-weight: 700;
}

.week-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    min-width: 800px;
}

.time-row {
    display: contents;
}

.time-slot {
    background: #f8fafc;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 60px;
}

.day-slot {
    background: white;
    padding: 4px;
    min-height: 60px;
    position: relative;
    border-bottom: 1px solid #f3f4f6;
}

.day-slot:hover {
    background: #f9fafb;
}

.week-grid .event-item {
    background: #6366f1;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.week-grid .event-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.week-grid .event-title {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
}

.week-grid .event-location {
    display: block;
    opacity: 0.8;
    font-size: 0.7rem;
}

/* List View */
.calendar-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-event-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.list-event-item:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.event-date {
    background: #6366f1;
    color: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    min-width: 80px;
    flex-shrink: 0;
}

.date-day {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.date-month {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-details {
    flex: 1;
}

.list-event-item .event-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.event-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-meta i {
    color: #9ca3af;
}

.event-excerpt {
    color: #6b7280;
    line-height: 1.5;
}

/* Event Modal */
.event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.event-modal .modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.event-modal .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #6b7280;
    transition: all 0.2s ease;
    z-index: 1;
}

.event-modal .close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #374151;
}

.event-modal-content {
    padding: 2rem;
}

.event-modal .event-image {
    margin: -2rem -2rem 1.5rem -2rem;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

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

.event-modal .event-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.event-meta-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.meta-item i {
    color: #6366f1;
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.meta-item div {
    flex: 1;
}

.meta-item strong {
    color: #374151;
}

.meta-item a {
    color: #6366f1;
    text-decoration: none;
}

.meta-item a:hover {
    text-decoration: underline;
}

.event-content {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: #374151;
}

.event-content h1, .event-content h2, .event-content h3 {
    color: #1f2937;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.event-content p {
    margin-bottom: 1rem;
}

.event-taxonomy {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.event-categories, .event-tags {
    margin-bottom: 0.5rem;
}

.event-categories:last-child, .event-tags:last-child {
    margin-bottom: 0;
}

.category-tag, .tag {
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.poll-integration {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.poll-integration h4 {
    color: #0369a1;
    margin-bottom: 0.5rem;
}

.poll-integration p {
    margin-bottom: 0.5rem;
    color: #0c4a6e;
}

.poll-integration p:last-child {
    margin-bottom: 0;
}

.event-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.event-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.event-actions .btn-primary {
    background: #6366f1;
    color: white;
}

.event-actions .btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.event-actions .btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.event-actions .btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.event-actions .btn-accent {
    background: #10b981;
    color: white;
}

.event-actions .btn-accent:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Events List (Shortcode) */
.pollander-events-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pollander-events-list .event-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    gap: 1.5rem;
}

.pollander-events-list .event-item:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.pollander-events-list .event-image {
    flex-shrink: 0;
    width: 200px;
}

.pollander-events-list .event-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.pollander-events-list .event-content {
    padding: 1.5rem;
    flex: 1;
}

.pollander-events-list .event-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.pollander-events-list .event-title a {
    color: #1f2937;
    text-decoration: none;
}

.pollander-events-list .event-title a:hover {
    color: #6366f1;
}

.pollander-events-list .event-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.pollander-events-list .event-meta div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pollander-events-list .event-meta i {
    color: #9ca3af;
    width: 16px;
}

.pollander-events-list .event-excerpt {
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.pollander-events-list .event-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.pollander-events-list .event-link:hover {
    text-decoration: underline;
}

/* Admin Styles */
.poll-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.poll-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.poll-status-completed {
    background: #d1fae5;
    color: #065f46;
}

.poll-status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .calendar-navigation {
        justify-content: center;
    }
    
    .calendar-views {
        justify-content: center;
    }
    
    .week-header,
    .week-grid {
        min-width: 600px;
    }
    
    .time-slot {
        font-size: 0.7rem;
        padding: 4px;
    }
}

@media (max-width: 768px) {
    .pollander-calendar-container {
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    .calendar-controls {
        padding: 1rem;
    }
    
    .calendar-content {
        padding: 1rem;
    }
    
    #current-period {
        font-size: 1.25rem;
        min-width: auto;
    }
    
    .calendar-views {
        width: 100%;
        justify-content: center;
    }
    
    .view-btn {
        flex: 1;
        text-align: center;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 0.8rem;
    }
    
    .calendar-day .event-item {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
    
    .list-event-item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .event-date {
        align-self: flex-start;
        min-width: 60px;
    }
    
    .date-day {
        font-size: 1.5rem;
    }
    
    .pollander-events-list .event-item {
        flex-direction: column;
    }
    
    .pollander-events-list .event-image {
        width: 100%;
    }
    
    .pollander-events-list .event-content {
        padding: 1rem;
    }
    
    .event-modal {
        padding: 1rem;
    }
    
    .event-modal .modal-content {
        max-height: 95vh;
    }
    
    .event-modal-content {
        padding: 1.5rem;
    }
    
    .event-modal .event-title {
        font-size: 1.5rem;
        padding-right: 2rem;
    }
    
    .event-actions {
        flex-direction: column;
    }
    
    .event-actions .btn {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .calendar-controls {
        padding: 0.75rem;
    }
    
    .calendar-content {
        padding: 0.75rem;
    }
    
    .btn-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    #current-period {
        font-size: 1.1rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 2px;
    }
    
    .day-number {
        font-size: 0.75rem;
    }
    
    .calendar-day .event-item {
        font-size: 0.65rem;
        padding: 1px 2px;
    }
    
    .event-modal-content {
        padding: 1rem;
    }
    
    .event-modal .event-title {
        font-size: 1.25rem;
        padding-right: 1.5rem;
    }
    
    .meta-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .meta-item i {
        align-self: flex-start;
    }
}

/* Print Styles */
@media print {
    .calendar-controls,
    .event-modal,
    .event-actions {
        display: none !important;
    }
    
    .pollander-calendar-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .calendar-content {
        padding: 0;
    }
    
    .calendar-day .event-item {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #ccc;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .pollander-calendar-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .calendar-controls {
        background: #374151;
        border-color: #4b5563;
    }
    
    .calendar-header .day-header {
        background: #4b5563;
        color: #f9fafb;
    }
    
    .calendar-day {
        background: #1f2937;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .calendar-day:hover {
        background: #374151;
    }
    
    .calendar-day.other-month {
        background: #111827;
        color: #6b7280;
    }
    
    .event-modal .modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .list-event-item {
        background: #1f2937;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .pollander-events-list .event-item {
        background: #1f2937;
        border-color: #4b5563;
    }
}

/* Accessibility */
.calendar-day:focus,
.event-item:focus,
.view-btn:focus,
.btn-nav:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.event-item[aria-selected="true"] {
    box-shadow: 0 0 0 2px #6366f1;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .calendar-day .event-item {
        border: 2px solid currentColor;
    }
    
    .btn-nav,
    .view-btn.active {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .calendar-day .event-item,
    .list-event-item,
    .btn-nav,
    .view-btn,
    .event-modal .modal-content {
        transition: none;
    }
    
    .event-modal .modal-content {
        animation: none;
    }
}
