/* VisionCine - Modal and Detail Styles */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Header */
.modal-header {
    background: var(--background-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    padding-top: calc(env(safe-area-inset-top, 24px) + 16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 2001;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    margin-right: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* Modal Content */
.modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Detail Hero Section */
.detail-hero {
    position: relative;
    height: 300px;
    background: linear-gradient(135deg, #333 0%, #555 100%);
    overflow: hidden;
}

@media (min-width: 768px) {
    .detail-hero {
        height: 400px;
    }
}

.detail-backdrop {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease;
}

.detail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top, 
        rgba(15,15,15,0.95) 0%, 
        rgba(15,15,15,0.7) 40%, 
        rgba(15,15,15,0.4) 70%, 
        rgba(15,15,15,0.2) 100%
    );
}

.detail-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px;
    z-index: 1;
}

.detail-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.2;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

@media (min-width: 768px) {
    .detail-title {
        font-size: 32px;
        margin-bottom: 16px;
    }
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (min-width: 768px) {
    .detail-meta {
        font-size: 16px;
        gap: 20px;
    }
}

.detail-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--warning-color);
    font-weight: 600;
}

/* Detail Body */
.detail-body {
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    .detail-body {
        padding: 32px;
        max-width: 800px;
        margin: 0 auto;
    }
}

/* Genre Tags */
.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.genre-tag {
    background: rgba(229, 9, 20, 0.15);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(229, 9, 20, 0.3);
    transition: all 0.2s ease;
}

.genre-tag:hover {
    background: rgba(229, 9, 20, 0.25);
    border-color: rgba(229, 9, 20, 0.5);
}

@media (min-width: 768px) {
    .genre-tag {
        font-size: 13px;
        padding: 8px 16px;
    }
}

/* Detail Sections */
.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.3;
}

.detail-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 15px;
    font-weight: 400;
}

@media (min-width: 768px) {
    .detail-section h4 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .detail-section p {
        font-size: 16px;
        line-height: 1.7;
    }
}

/* Detail Grid Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

@media (min-width: 768px) {
    .action-buttons {
        flex-direction: row;
        gap: 16px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
    will-change: transform, box-shadow;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(229, 9, 20, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

@media (min-width: 768px) {
    .btn-primary {
        padding: 18px 32px;
        font-size: 17px;
    }
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    will-change: transform, background-color, border-color;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(0);
}

@media (min-width: 768px) {
    .btn-secondary {
        padding: 18px 32px;
        font-size: 17px;
    }
}

/* Video Player Styles */
.video-player {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.player-header {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px 20px;
    padding-top: calc(env(safe-area-inset-top, 24px) + 16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 3001;
}

.player-title {
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex: 1;
}

.player-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: black;
}

/* Loading States for Modal */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.modal-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(229, 9, 20, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.modal-loading .loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

/* Error States for Modal */
.modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.modal-error .error-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.modal-error .error-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.modal-error .error-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-error .retry-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-error .retry-button:hover {
    background: var(--primary-dark);
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .modal-header {
        padding: 12px 16px;
        padding-top: calc(env(safe-area-inset-top, 24px) + 12px);
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .detail-hero {
        height: 250px;
    }
    
    .detail-info {
        padding: 20px 16px;
    }
    
    .detail-title {
        font-size: 24px;
    }
    
    .detail-body {
        padding: 20px 16px;
    }
    
    .action-buttons {
        gap: 10px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    .modal-overlay {
        background: rgba(0, 0, 0, 0.97);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .btn-primary,
    .btn-secondary,
    .genre-tag,
    .detail-backdrop {
        transition: none !important;
    }
    
    .btn-primary::before {
        display: none;
    }
    
    .video-player {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-overlay {
        background: black;
    }
    
    .modal-header {
        border-bottom: 2px solid white;
    }
    
    .btn-primary {
        background: var(--primary-color);
        border: 2px solid white;
    }
    
    .btn-secondary {
        border: 2px solid white;
    }
    
    .genre-tag {
        border: 2px solid var(--primary-color);
    }
}



/* Series Selection Styles */
.seasons-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.seasons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 480px) {
    .seasons-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.season-selector,
.episode-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.season-selector label,
.episode-selector label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.season-select,
.episode-select {
    padding: 12px 16px;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.season-select:focus,
.episode-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
}

.season-select:hover,
.episode-select:hover {
    border-color: var(--text-secondary);
}

/* Episode Info */
.episode-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--background-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.episode-details h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.episode-details p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.episode-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.episode-meta span {
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 4px 8px;
    background: var(--background-secondary);
    border-radius: 4px;
}

/* Series/Movie Badges */
.series-badge,
.movie-badge {
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.series-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.movie-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    color: white !important;
}

/* Button States */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for seasons */
.seasons-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.seasons-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

