/**
 * Speakers Manager - Modal Styles
 *
 * Scoped styles for the speaker detail modal.
 * Uses BEM-style naming to avoid conflicts with theme styles.
 *
 * Accessibility considerations:
 * - High contrast focus states
 * - Reduced motion support
 * - Screen reader friendly structure
 *
 * @package SpeakersManager
 * @since 1.0.0
 */

/* ==========================================================================
   Body State
   ========================================================================== */

body.speakers-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Modal Container
   ========================================================================== */

.speakers-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.speakers-modal[hidden] {
    display: none;
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.speakers-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: speakersModalFadeIn 0.2s ease-out;
}

/* ==========================================================================
   Modal Container & Dialog
   ========================================================================== */

.speakers-modal-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.speakers-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: speakersModalSlideIn 0.3s ease-out;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Close Button
   ========================================================================== */

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

.speakers-modal-close:hover {
    background: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.speakers-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.speakers-modal-close:active {
    transform: scale(0.95);
}

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

/* ==========================================================================
   Modal Body
   ========================================================================== */

.speakers-modal-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.speakers-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    min-height: 300px;
}

.speakers-modal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: speakersModalSpin 0.8s linear infinite;
    margin-bottom: 16px;
}

.speakers-modal-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.speakers-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    min-height: 250px;
}

.speakers-modal-error svg {
    color: #d63638;
    margin-bottom: 16px;
}

.speakers-modal-error p {
    margin: 0 0 20px;
    color: #666;
    font-size: 15px;
}

.speakers-modal-retry {
    padding: 10px 24px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.speakers-modal-retry:hover {
    background: #005a87;
}

.speakers-modal-retry:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.5);
}

/* ==========================================================================
   Modal Content - Header
   ========================================================================== */

.speakers-manager-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 40px 24px;
    text-align: center;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

@media (min-width: 600px) {
    .speakers-manager-modal-header {
        flex-direction: row;
        text-align: left;
        padding: 32px 40px;
    }
}

/* ==========================================================================
   Modal Content - Image
   ========================================================================== */

.speakers-manager-modal-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (min-width: 600px) {
    .speakers-manager-modal-image {
        width: 140px;
        height: 140px;
        margin-bottom: 0;
        margin-right: 28px;
    }
}

.speakers-manager-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   Modal Content - Title
   ========================================================================== */

.speakers-manager-modal-title-wrap {
    flex: 1;
}

.speakers-manager-modal-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: #1e1e1e;
}

@media (min-width: 600px) {
    .speakers-manager-modal-title {
        font-size: 28px;
    }
}

.speakers-manager-modal-title:focus {
    outline: none;
}

.speakers-manager-hidden-badge {
    display: inline-block;
    margin-left: 12px;
    padding: 4px 10px;
    background: #d63638;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    vertical-align: middle;
}

/* ==========================================================================
   Modal Content - Role
   ========================================================================== */

.speakers-manager-modal-role {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.4;
}

@media (min-width: 600px) {
    .speakers-manager-modal-role {
        font-size: 18px;
    }
}

/* ==========================================================================
   Modal Content - Body
   ========================================================================== */

.speakers-manager-modal-content {
    padding: 24px 40px 32px;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
}

.speakers-manager-modal-content p {
    margin: 0 0 1em;
}

.speakers-manager-modal-content p:last-child {
    margin-bottom: 0;
}

.speakers-manager-modal-content a {
    color: #0073aa;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.speakers-manager-modal-content a:hover {
    color: #005a87;
}

.speakers-manager-modal-content h2,
.speakers-manager-modal-content h3,
.speakers-manager-modal-content h4 {
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
    color: #1e1e1e;
}

.speakers-manager-modal-content h2:first-child,
.speakers-manager-modal-content h3:first-child,
.speakers-manager-modal-content h4:first-child {
    margin-top: 0;
}

.speakers-manager-modal-content ul,
.speakers-manager-modal-content ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.speakers-manager-modal-content li {
    margin-bottom: 0.5em;
}

.speakers-manager-modal-content blockquote {
    margin: 1.5em 0;
    padding: 16px 24px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    font-style: italic;
}

.speakers-manager-modal-content blockquote p:last-child {
    margin-bottom: 0;
}

.speakers-manager-modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ==========================================================================
   Modal Content - Footer
   ========================================================================== */

.speakers-manager-modal-footer {
    padding: 20px 40px 32px;
    border-top: 1px solid #e8e8e8;
    background: #f8f9fa;
}

.speakers-manager-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.speakers-manager-modal-link:hover {
    background: #005a87;
    color: #fff;
    transform: translateY(-1px);
}

.speakers-manager-modal-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.5);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes speakersModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes speakersModalSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .speakers-modal-overlay,
    .speakers-modal-dialog {
        animation: none;
    }
    
    .speakers-modal-close,
    .speakers-manager-modal-link {
        transition: none;
    }
    
    .speakers-modal-spinner {
        animation: none;
        border-top-color: #0073aa;
        border-right-color: #0073aa;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .speakers-modal-dialog {
        background: #1e1e1e;
    }
    
    .speakers-modal-close {
        background: rgba(30, 30, 30, 0.9);
        color: #fff;
    }
    
    .speakers-modal-close:hover {
        background: #2d2d2d;
    }
    
    .speakers-modal-loading p,
    .speakers-modal-error p {
        color: #a0a0a0;
    }
    
    .speakers-manager-modal-header {
        background: linear-gradient(180deg, #2d2d2d 0%, #1e1e1e 100%);
    }
    
    .speakers-manager-modal-title {
        color: #f0f0f0;
    }
    
    .speakers-manager-modal-role {
        color: #a0a0a0;
    }
    
    .speakers-manager-modal-content {
        color: #d0d0d0;
    }
    
    .speakers-manager-modal-content h2,
    .speakers-manager-modal-content h3,
    .speakers-manager-modal-content h4 {
        color: #f0f0f0;
    }
    
    .speakers-manager-modal-content blockquote {
        background: #2d2d2d;
    }
    
    .speakers-manager-modal-footer {
        background: #2d2d2d;
        border-top-color: #404040;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

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