/* ============================================
   KV-Stream - Modal Components
   PIXEL-PERFECT NETFLIX MODALS
   ============================================ */

/* ============================================
   PLAYER MODAL
   ============================================ */
.player-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
}

.player-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.2s ease;
}

.player-modal__content {
    position: relative;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    margin: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--netflix-bg-card);
    border-radius: 6px;
    animation: slideUp 0.3s ease;
    scrollbar-width: none;
}

.player-modal__content::-webkit-scrollbar {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.player-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--netflix-bg);
    border: none;
    color: var(--netflix-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    transition: all var(--transition-base);
}

.player-modal__close:hover {
    background: var(--netflix-text);
    color: var(--netflix-bg);
}

.player-modal__close svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MODAL INFO SECTION
   ============================================ */
.player-modal__info {
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(to top, var(--netflix-bg-card), transparent);
}

.player-modal__title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 4px;
    color: var(--netflix-text);
}

.player-modal__meta {
    font-size: var(--font-size-sm);
    color: var(--netflix-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-modal__meta span::after {
    content: '•';
    margin-left: 8px;
    color: var(--netflix-text-muted);
}

.player-modal__meta span:last-child::after {
    content: none;
}

/* ============================================
   QUALITY SELECTOR
   ============================================ */
.player-modal__quality {
    display: flex;
    gap: 6px;
}

.quality-btn {
    padding: 6px 14px;
    background: rgba(42, 42, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--btn-radius);
    color: var(--netflix-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quality-btn:hover {
    background: rgba(60, 60, 60, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--netflix-text);
}

.quality-btn.active {
    background: var(--netflix-red);
    border-color: var(--netflix-red);
    color: var(--netflix-text);
}

/* ============================================
   PLAYER CONTAINER
   ============================================ */
.player-container {
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

/* ============================================
   EPISODE LIST
   ============================================ */
.player-modal__episodes {
    margin-top: 0;
    padding: 20px 24px;
    background: var(--netflix-bg-card);
}

.player-modal__episodes-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 16px;
    color: var(--netflix-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-modal__episodes-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--netflix-red);
    border-radius: 2px;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
}

.episode-btn {
    padding: 10px 8px;
    background: var(--netflix-bg-elevated);
    border: 1px solid var(--netflix-border);
    border-radius: var(--btn-radius);
    color: var(--netflix-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.episode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--netflix-red);
    color: var(--netflix-text);
}

.episode-btn.active {
    background: var(--netflix-red);
    border-color: var(--netflix-red);
    color: var(--netflix-text);
    font-weight: var(--font-weight-bold);
}

/* ============================================
   GENERIC MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.modal__content {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 24px;
    padding: 24px;
    background: var(--netflix-bg-card);
    border-radius: 6px;
    animation: slideUp 0.3s ease;
}

.modal__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 20px;
    color: var(--netflix-text);
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--netflix-text-secondary);
    margin-bottom: 8px;
}

.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--netflix-bg-elevated);
    border: 1px solid var(--netflix-border);
    border-radius: var(--btn-radius);
    color: var(--netflix-text);
    font-family: inherit;
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.input::placeholder {
    color: var(--netflix-text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--netflix-text);
    background: var(--netflix-bg);
}

select.input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238c8c8c' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: calc(var(--z-modal) + 100);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    background: var(--netflix-bg-card);
    border-radius: var(--btn-radius);
    box-shadow: var(--shadow-dropdown);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 260px;
    color: var(--netflix-text);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast--success {
    border-left: 3px solid var(--netflix-green);
}

.toast--error {
    border-left: 3px solid var(--netflix-red);
}

.toast--info {
    border-left: 3px solid #00a8e1;
}

/* ============================================
   PLAYER SKELETON
   ============================================ */
.player-skeleton {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--netflix-bg-elevated);
    position: relative;
}

.player-skeleton__play {
    width: 70px;
    height: 70px;
    background: var(--netflix-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.player-skeleton__play:hover {
    transform: scale(1.1);
}

.player-skeleton__play svg {
    width: 28px;
    height: 28px;
    color: var(--netflix-bg);
    margin-left: 4px;
}