/**
 * Architects Mural Viewer - CSS Styles
 * Production-ready styles for WordPress plugin
 */

/* Container */
.amv-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.amv-iframe-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.amv-iframe-container iframe {
    display: block;
    border: none;
}

/* Viewer */
.amv-viewer {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

/* Loading */
.amv-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 1000;
}

.amv-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: amv-spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes amv-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.amv-error {
    padding: 20px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    border-radius: 4px;
    color: #dc3545;
    text-align: center;
}

/* Controls */
.amv-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1001;
}

.amv-hotspot-select {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.amv-hotspot-select:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.amv-hotspot-select:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* SVG Hotspot Overlay */
.amv-hotspot-overlay {
    pointer-events: none;
}

.amv-hotspot {
    cursor: pointer;
    transition: all 0.2s ease;
}

.amv-hotspot circle,
.amv-hotspot rect,
.amv-hotspot text {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.amv-hotspot:hover circle,
.amv-hotspot:focus circle {
    opacity: 0.88;
}

.amv-hotspot:hover rect,
.amv-hotspot:hover text,
.amv-hotspot:focus rect,
.amv-hotspot:focus text {
    opacity: 0.96;
}

.amv-hotspot:hover,
.amv-hotspot:focus {
    filter: drop-shadow(0 4px 8px rgba(255, 107, 53, 0.5));
}

/* Side Panel */
.amv-panel {
    position: absolute;
    inset: 5%;
    background: #050505;
    border: 1px solid #4b5563;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .7);
    color: #e5e7eb;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.985);
    transition: opacity .22s ease, transform .22s ease;
    z-index: 1002;
    display: flex;
    flex-direction: column;
}

.amv-panel-open {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.amv-panel-header {
    padding: 20px;
    border-bottom: 1px solid #374151;
    background: #050505;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.amv-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    padding-right: 16px;
}

.amv-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #d1d5db;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.amv-panel-close:hover {
    background: #1f2937;
    color: #fff;
}

.amv-panel-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    line-height: 1.6;
    color: #e5e7eb;
}

.amv-wikipedia-loading,
.amv-wikipedia-error { align-items: center; display: flex; justify-content: center; min-height: 16rem; text-align: center; }
.amv-wikipedia-article { color: #e5e7eb; font-size: 15px; line-height: 1.7; }
.amv-wikipedia-article h1,
.amv-wikipedia-article h2,
.amv-wikipedia-article h3,
.amv-wikipedia-article strong { color: #fff; }
.amv-wikipedia-article a { color: #93c5fd; text-underline-offset: 2px; }
.amv-wikipedia-article img { height: auto; max-width: 100%; }
.amv-wikipedia-article table { border-collapse: collapse; display: block; max-width: 100%; overflow-x: auto; }
.amv-wikipedia-article th,
.amv-wikipedia-article td { border-bottom: 1px solid #4b5563; padding: .55rem; vertical-align: top; }
.amv-wikipedia-article .infobox { float: right; margin: 0 0 1.25rem 1.5rem; max-width: min(22rem, 44%); }

.amv-category {
    display: inline-block;
    background: #007cba;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.amv-url-content p {
    margin-bottom: 16px;
    color: #555;
}

.amv-external-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 2px solid #007cba;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.amv-external-link:hover {
    background: #007cba;
    color: #fff;
    text-decoration: none;
}

.amv-text-content,
.amv-html-content {
    color: #333;
    font-size: 14px;
}

.amv-text-content p,
.amv-html-content p {
    margin-bottom: 12px;
}

.amv-text-content p:last-child,
.amv-html-content p:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .amv-panel {
        inset: 2%;
    }
    
    .amv-controls {
        top: 8px;
        right: 8px;
    }
    
    .amv-hotspot-select {
        font-size: 12px;
        padding: 6px 10px;
        max-width: 200px;
    }
    
    .amv-panel-header {
        padding: 16px;
    }
    
    .amv-panel-content {
        padding: 16px;
    }

    .amv-wikipedia-article .infobox { float: none; margin: 0 0 1rem; max-width: 100%; }
}

/* Architects of America experience page */
.amv-experience {
    --amv-midnight: #071426;
    --amv-ink: #0c1724;
    --amv-gold: #d7aa4f;
    --amv-paper: #f1eadb;
    --amv-oxblood: #7d293d;
    background: var(--amv-paper);
    color: var(--amv-ink);
    margin-inline: calc(50% - 50vw);
    overflow: hidden;
}

.amv-experience-page .elementor-location-header,
.amv-experience-page .elementor-location-footer,
.amv-experience-page .entry-title {
    display: none !important;
}

.amv-experience-page .site-main,
.amv-experience-page .page-content {
    margin: 0 !important;
    max-width: none !important;
    padding: 0 !important;
}

.amv-experience h1,
.amv-experience h2,
.amv-experience p { margin-top: 0; }

.amv-hero {
    align-items: end;
    background:
        linear-gradient(90deg, rgba(7, 20, 38, .98) 0 48%, rgba(7, 20, 38, .72)),
        url('../architects-of-america-hero.png') center / cover;
    color: white;
    display: grid;
    gap: clamp(3rem, 8vw, 9rem);
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, .65fr);
    min-height: 72vh;
    padding: clamp(5rem, 10vw, 9rem) max(6vw, calc((100vw - 1320px) / 2));
}

.amv-eyebrow,
.amv-section-label {
    color: var(--amv-gold);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.amv-hero h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(4rem, 9vw, 9rem);
    font-weight: 400;
    letter-spacing: -.065em;
    line-height: .78;
    margin: 1.3rem 0 2.25rem;
}

.amv-hero h1 em {
    color: var(--amv-gold);
    font-weight: 400;
}

.amv-hero-intro {
    font-size: clamp(1.15rem, 1.7vw, 1.5rem);
    line-height: 1.55;
    max-width: 36rem;
}

.amv-hero-action {
    align-items: center;
    border-bottom: 1px solid var(--amv-gold);
    color: white;
    display: inline-flex;
    font-size: .86rem;
    font-weight: 700;
    gap: 1.25rem;
    letter-spacing: .08em;
    padding: .8rem 0;
    text-decoration: none;
    text-transform: uppercase;
}

.amv-scale { border-left: 1px solid rgba(215, 170, 79, .65); padding-left: 2rem; }
.amv-scale-number { color: var(--amv-gold); display: block; font-family: Georgia, serif; font-size: clamp(5rem, 9vw, 8rem); line-height: .8; }
.amv-scale-unit { display: block; font-family: Georgia, serif; font-size: 1.7rem; margin-top: .8rem; }
.amv-scale-detail { color: rgba(255,255,255,.7); display: block; font-size: .76rem; letter-spacing: .06em; margin-top: 1rem; text-transform: uppercase; }

.amv-story,
.amv-viewer-section,
.amv-credits { margin: auto; max-width: 1320px; padding-inline: clamp(1.25rem, 5vw, 4rem); }

.amv-story { display: grid; gap: clamp(2rem, 7vw, 7rem); grid-template-columns: .85fr 1.15fr; padding-block: clamp(4.5rem, 9vw, 8rem); }
.amv-story h2,
.amv-viewer-heading h2 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.5rem, 5vw, 5.25rem); font-weight: 400; letter-spacing: -.045em; line-height: 1; margin: .8rem 0 0; }
.amv-story-copy { border-left: 3px solid var(--amv-oxblood); font-size: clamp(1rem, 1.4vw, 1.22rem); line-height: 1.75; padding-left: clamp(1.5rem, 4vw, 3.5rem); }

.amv-viewer-section { padding-bottom: clamp(5rem, 9vw, 8rem); }
.amv-viewer-heading { align-items: end; display: flex; gap: 3rem; justify-content: space-between; margin-bottom: 2rem; }
.amv-viewer-heading > p { color: #4e5863; line-height: 1.6; max-width: 25rem; }
.amv-viewer-section .amv-container { border: 1px solid rgba(215,170,79,.55); border-radius: 0; box-shadow: 0 24px 70px rgba(7,20,38,.22); }

.amv-credits { border-top: 1px solid rgba(12,23,36,.2); display: flex; justify-content: space-between; padding-block: 2rem 3rem; }
.amv-credits p { margin-bottom: 0; }
.amv-credits span { color: #626b73; }

@media (max-width: 760px) {
    .amv-hero { align-items: start; grid-template-columns: 1fr; min-height: auto; }
    .amv-scale { margin-top: 1rem; }
    .amv-story { grid-template-columns: 1fr; }
    .amv-viewer-heading { align-items: start; flex-direction: column; gap: 1rem; }
    .amv-credits { flex-direction: column; gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .amv-experience * { scroll-behavior: auto !important; }
}

@media (max-width: 480px) {
    .amv-controls {
        position: static;
        background: rgba(0, 0, 0, 0.8);
        padding: 8px;
        width: 100%;
    }
    
    .amv-hotspot-select {
        width: 100%;
        max-width: none;
    }
}

/* OpenSeadragon Customizations */
.amv-viewer .openseadragon-container {
    background-color: #000 !important;
}

.amv-viewer .openseadragon-canvas {
    outline: none;
}

.amv-viewer .openseadragon-navigator {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
}

/* Accessibility */
.amv-viewer:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.amv-hotspot:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* WordPress Admin Styles */
.wp-admin .amv-container {
    max-width: 100%;
}

/* High DPI / Retina Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .amv-spinner {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {
    .amv-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .amv-panel {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-top: 20px;
    }
    
    .amv-controls {
        display: none;
    }
}
