/**
 * MW Quick Calendar Module Styles
 * Modern calendar module for Joomla 5/6
 * Copyright (C) 2026 Mertsch Web
 */

/* Reset and Base */
.mwqc-module,
.mwqc-module * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Module Container */
.mwqc-module {
    --mwqc-header-bg: #1a5f5f;
    --mwqc-header-text: #ffffff;
    --mwqc-background: #e8eaed;
    --mwqc-card-bg: #ffffff;
    --mwqc-date-bg: #9ee7e3;
    --mwqc-date-text: #1a365d;
    --mwqc-title-color: #1a365d;
    --mwqc-meta-text: #4a5568;
    --mwqc-button-bg: #1a5f5f;
    --mwqc-button-text: #ffffff;
    
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 100%;
    background: var(--mwqc-background);
    border-radius: 12px;
    overflow: hidden;
}

/* Header */
.mwqc-header {
    padding: 18px 20px;
    background: var(--mwqc-header-bg);
    border-bottom: 4px solid rgba(0, 0, 0, 0.15);
}

.mwqc-title {
    color: var(--mwqc-header-text);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

/* Events List */
.mwqc-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mwqc-empty {
    padding: 24px;
    text-align: center;
    color: var(--mwqc-meta-text);
    font-size: 0.95rem;
    background: var(--mwqc-card-bg);
    border-radius: 12px;
}

/* Powered By */
.mwqc-powered-by {
    padding: 10px 16px 14px;
    text-align: right;
    background: var(--mwqc-background);
}

.mwqc-powered-by a {
    font-size: 0.75rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease;
}

.mwqc-powered-by a:hover {
    color: var(--mwqc-header-bg);
    text-decoration: underline;
}

/* Event Card */
.mwqc-card {
    background: var(--mwqc-card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.mwqc-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.mwqc-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
}

.mwqc-link:hover,
.mwqc-link:focus {
    text-decoration: none !important;
}

.mwqc-link:focus {
    outline: 2px solid var(--mwqc-header-bg);
    outline-offset: -2px;
    border-radius: 12px;
}

/* Date Box */
.mwqc-date-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    width: 60px;
    height: 60px;
    background-color: var(--mwqc-date-bg);
    border-radius: 10px;
    flex-shrink: 0;
}

.mwqc-day {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mwqc-date-text);
    line-height: 1.1;
}

.mwqc-month {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mwqc-date-text);
    text-transform: capitalize;
    line-height: 1.3;
}

/* Date Range Box */
.mwqc-date-box.mwqc-date-range {
    flex-direction: row;
    min-width: 130px;
    width: auto;
    padding: 8px 12px;
    gap: 6px;
}

.mwqc-date-range .mwqc-date-start,
.mwqc-date-range .mwqc-date-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mwqc-date-range .mwqc-day {
    font-size: 1.2rem;
}

.mwqc-date-range .mwqc-month {
    font-size: 0.7rem;
}

.mwqc-date-separator {
    font-size: 1rem;
    font-weight: 600;
    color: var(--mwqc-date-text);
    opacity: 0.6;
    align-self: center;
}

/* Event Content */
.mwqc-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.mwqc-event-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--mwqc-title-color);
    line-height: 1.35;
    transition: color 0.15s ease;
}

.mwqc-card:hover .mwqc-event-title {
    color: var(--mwqc-header-bg);
}

.mwqc-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--mwqc-meta-text);
    line-height: 1.4;
}

.mwqc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mwqc-meta-separator {
    color: #9ca3af;
    margin: 0 2px;
}

.mwqc-icon {
    width: 14px;
    height: 14px;
    color: var(--mwqc-meta-text);
    flex-shrink: 0;
}

/* Modal Styles */
.mwqc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mwqc-modal.is-open,
.mwqc-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.mwqc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.mwqc-modal-container {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.mwqc-modal.is-open .mwqc-modal-container,
.mwqc-modal[aria-hidden="false"] .mwqc-modal-container {
    transform: scale(1) translateY(0);
}

.mwqc-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mwqc-modal-close:hover {
    background: #ffffff;
    transform: scale(1.05);
}

.mwqc-modal-close:focus {
    outline: 2px solid var(--mwqc-button-bg, #1a6b6b);
    outline-offset: 2px;
}

.mwqc-modal-close svg {
    width: 20px;
    height: 20px;
}

/* Modal Image */
.mwqc-modal-image-container {
    display: none;
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    flex-shrink: 0;
}

.mwqc-modal-image-container.has-image {
    display: block;
}

.mwqc-modal-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modal Content */
.mwqc-modal-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.mwqc-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a365d;
    line-height: 1.3;
    margin-bottom: 16px;
}

.mwqc-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.mwqc-modal-meta-item {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #4b5563;
}

.mwqc-modal-meta-item.visible {
    display: flex;
}

.mwqc-modal-meta-item svg {
    color: var(--mwqc-button-bg, #1a6b6b);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.mwqc-modal-description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #4b5563;
}

.mwqc-modal-description:empty {
    display: none;
}

.mwqc-modal-actions {
    display: none;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.mwqc-modal-actions.visible {
    display: block;
}

.mwqc-modal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mwqc-button-text, #ffffff) !important;
    background-color: var(--mwqc-button-bg, #1a6b6b);
    border: none;
    border-radius: 8px;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

.mwqc-modal-button:hover {
    filter: brightness(0.9);
    color: var(--mwqc-button-text, #ffffff) !important;
    text-decoration: none !important;
    transform: translateY(-1px);
}

/* Narrow Sidebar / Container Query Fallback */
.mwqc-module {
    container-type: inline-size;
    container-name: mwqc;
}

/* Narrow Container (Sidebar) Styles */
@container mwqc (max-width: 320px) {
    .mwqc-header {
        padding: 12px 14px;
    }
    
    .mwqc-title {
        font-size: 1rem;
    }
    
    .mwqc-list {
        padding: 10px;
        gap: 8px;
    }
    
    .mwqc-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }
    
    .mwqc-date-box {
        min-width: 50px;
        width: 50px;
        height: 50px;
        border-radius: 8px;
    }
    
    .mwqc-day {
        font-size: 1.25rem;
    }
    
    .mwqc-month {
        font-size: 0.7rem;
    }
    
    .mwqc-date-box.mwqc-date-range {
        min-width: auto;
        width: 100%;
        padding: 8px 12px;
        justify-content: center;
    }
    
    .mwqc-date-range .mwqc-day {
        font-size: 1.1rem;
    }
    
    .mwqc-content {
        width: 100%;
    }
    
    .mwqc-event-title {
        font-size: 0.95rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .mwqc-meta {
        font-size: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .mwqc-meta-separator {
        display: none;
    }
    
    .mwqc-powered-by {
        padding: 8px 10px 10px;
        text-align: center;
    }
    
    .mwqc-powered-by a {
        font-size: 0.65rem;
    }
}

/* Medium Container Styles */
@container mwqc (min-width: 321px) and (max-width: 400px) {
    .mwqc-header {
        padding: 14px 16px;
    }
    
    .mwqc-title {
        font-size: 1.1rem;
    }
    
    .mwqc-list {
        padding: 12px;
        gap: 10px;
    }
    
    .mwqc-link {
        gap: 12px;
        padding: 14px;
    }
    
    .mwqc-date-box {
        min-width: 54px;
        width: 54px;
        height: 54px;
    }
    
    .mwqc-day {
        font-size: 1.35rem;
    }
    
    .mwqc-event-title {
        font-size: 1rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .mwqc-meta {
        font-size: 0.85rem;
    }
}

/* Responsive Fallback for older browsers */
@media (max-width: 480px) {
    .mwqc-module {
        border-radius: 8px;
    }
    
    .mwqc-header {
        padding: 14px 16px;
    }
    
    .mwqc-title {
        font-size: 1.1rem;
    }
    
    .mwqc-list {
        padding: 12px;
        gap: 10px;
    }
    
    .mwqc-card {
        border-radius: 10px;
    }
    
    .mwqc-link {
        gap: 12px;
        padding: 12px;
    }
    
    .mwqc-date-box {
        min-width: 52px;
        width: 52px;
        height: 52px;
        border-radius: 8px;
    }
    
    .mwqc-day {
        font-size: 1.3rem;
    }
    
    .mwqc-month {
        font-size: 0.7rem;
    }
    
    .mwqc-date-box.mwqc-date-range {
        min-width: 110px;
        padding: 6px 10px;
        gap: 4px;
    }
    
    .mwqc-date-range .mwqc-day {
        font-size: 1rem;
    }
    
    .mwqc-date-range .mwqc-month {
        font-size: 0.6rem;
    }
    
    .mwqc-date-separator {
        font-size: 0.85rem;
    }
    
    .mwqc-event-title {
        font-size: 1rem;
    }
    
    .mwqc-meta {
        font-size: 0.85rem;
    }
    
    .mwqc-modal {
        padding: 10px;
    }
    
    .mwqc-modal-container {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .mwqc-modal-content {
        padding: 20px;
    }
    
    .mwqc-modal-title {
        font-size: 1.25rem;
    }
    
    .mwqc-modal-meta {
        flex-direction: column;
        gap: 10px;
    }
}

@media print {
    .mwqc-modal {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mwqc-modal,
    .mwqc-modal-container,
    .mwqc-card,
    .mwqc-link,
    .mwqc-modal-close,
    .mwqc-modal-button {
        transition: none;
    }
}
