/**
 * Sedana Video Gallery Styles
 */

/* Persistent Player Container */
#svg-persistent-player {
    position: fixed;
    z-index: 9999;
    transition: all 0.3s ease;
}

#svg-persistent-player.hidden {
    display: none !important;
}

/* Normal Mode (Bottom Right) */
#svg-persistent-player.svg-player-normal {
    bottom: 20px;
    right: 20px;
    width: 480px;
    height: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

/* Picture-in-Picture Mode (Small Corner) */
#svg-persistent-player.svg-player-pip {
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 200px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    cursor: move;
}

/* Fullscreen Mode */
#svg-persistent-player.svg-player-fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    background: #000;
}

/* Minimized Mode (Widget Bar Only) */
#svg-persistent-player.svg-player-minimized {
    bottom: 0;
    right: 20px;
    width: 300px;
    height: 44px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

#svg-persistent-player.svg-player-minimized .svg-player-wrapper {
    height: 44px;
}

#svg-persistent-player.svg-player-minimized #svg-player {
    display: none;
}

#svg-persistent-player.svg-player-minimized .svg-player-header {
    background: transparent;
    height: 100%;
}

#svg-persistent-player.svg-player-minimized .svg-drag-handle {
    height: 44px;
}

/* Player Wrapper */
.svg-player-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* Player Header */
.svg-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 100%);
    color: #fff;
    font-size: 14px;
    position: relative;
    z-index: 10;
}

.svg-player-title {
    font-weight: 600;
    flex: 1;
}

.svg-player-controls {
    display: flex;
    gap: 8px;
}

.svg-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.svg-control-btn:active {
    transform: scale(0.95);
}

/* Video Player Container */
#svg-player {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #000;
}

#svg-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Drag Handle */
.svg-drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    cursor: move;
    z-index: 5;
}

#svg-persistent-player.svg-player-fullscreen .svg-drag-handle {
    cursor: default;
}

/* Gallery Styles */
.sedana-video-gallery {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.sedana-video-gallery .video-item {
    min-height: 280px;
}

.svg-video-trigger {
    cursor: pointer;
    position: relative;
    min-height: 200px;
}

.svg-video-trigger:hover {
    opacity: 0.95;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #svg-persistent-player.svg-player-normal {
        width: 90vw;
        height: 50vw;
        bottom: 10px;
        right: 5vw;
    }

    #svg-persistent-player.svg-player-pip {
        width: 60vw;
        height: 35vw;
        bottom: 10px;
        right: 10px;
    }

    .sedana-video-gallery {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .sedana-video-gallery .video-item {
        min-height: 240px;
    }

    .svg-video-trigger {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    #svg-persistent-player.svg-player-normal {
        width: 95vw;
        height: 55vw;
        bottom: 5px;
        right: 2.5vw;
    }

    #svg-persistent-player.svg-player-pip {
        width: 70vw;
        height: 40vw;
    }

    .svg-player-header {
        padding: 6px 8px;
        font-size: 12px;
    }

    .svg-control-btn {
        padding: 4px;
    }

    .svg-control-btn svg {
        width: 16px;
        height: 16px;
    }

    .sedana-video-gallery .video-item {
        min-height: 200px;
    }

    .svg-video-trigger {
        min-height: 150px;
    }
}

/* Animation */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#svg-persistent-player:not(.hidden) {
    animation: slideInUp 0.3s ease-out;
}

/* Loading State */
.svg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #000;
}

.svg-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for Tailwind conflicts */
.sedana-video-gallery * {
    box-sizing: border-box;
}

/* Modal Styles */
.svg-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.svg-modal.hidden {
    display: none !important;
}

.svg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.svg-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideInDown 0.3s ease;
    z-index: 1;
}

.svg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.svg-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.svg-modal-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #6b7280;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #111827;
    transform: rotate(90deg);
}

.svg-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.svg-modal-body::-webkit-scrollbar {
    width: 8px;
}

.svg-modal-body::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.svg-modal-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.svg-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Modal Video Items */
.svg-modal-video-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.svg-modal-video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.svg-modal-video-item.active {
    ring: 3px;
    ring-color: #ef4444;
    box-shadow: 0 0 0 3px #ef4444;
}

.svg-modal-video-thumbnail {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
}

.svg-modal-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.svg-modal-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.svg-modal-video-item:hover .svg-modal-video-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 100%);
}

.svg-modal-play-icon {
    width: 60px;
    height: 60px;
    background: rgba(239, 68, 68, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.svg-modal-video-item:hover .svg-modal-play-icon {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

.svg-modal-video-info {
    padding: 12px;
}

.svg-modal-video-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.svg-modal-video-index {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

/* Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Modal */
@media (max-width: 768px) {
    .svg-modal-content {
        max-width: 95%;
        max-height: 85vh;
    }

    .svg-modal-header {
        padding: 16px;
    }

    .svg-modal-title {
        font-size: 20px;
    }

    .svg-modal-body {
        padding: 16px;
    }

    #svg-modal-playlist {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .svg-modal-play-icon {
        width: 48px;
        height: 48px;
    }

    .svg-modal-video-title {
        font-size: 13px;
    }
}

/* Floating Widget Icon */
.svg-floating-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    cursor: pointer;
    transition: all 0.3s ease;
}

.svg-floating-widget.hidden {
    display: none !important;
}

.svg-floating-content {
    position: relative;
    background: #FF0000;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(255, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.svg-floating-widget:hover .svg-floating-content {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(255, 0, 0, 0.6);
    background: #CC0000;
}

.svg-floating-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50px;
    background: #FF0000;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: -1;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

.svg-floating-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.svg-floating-text {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* Floating Widget Animation */
@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.svg-floating-widget:not(.hidden) {
    animation: slideInRight 0.4s ease-out;
}

/* Responsive Floating Widget */
@media (max-width: 768px) {
    .svg-floating-widget {
        bottom: 15px;
        right: 15px;
    }

    .svg-floating-content {
        padding: 10px 16px;
    }

    .svg-floating-icon {
        width: 28px;
        height: 28px;
    }

    .svg-floating-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .svg-floating-widget {
        bottom: 10px;
        right: 10px;
    }

    .svg-floating-content {
        padding: 8px 14px;
    }

    .svg-floating-icon {
        width: 24px;
        height: 24px;
    }

    .svg-floating-icon svg {
        width: 14px;
        height: 14px;
    }

    .svg-floating-text {
        font-size: 12px;
    }
}
