/**
 * Pelita Ilmu Fisiatris - UI Components
 * Modals, Lightbox, and Interactive Elements
 */

/* ==================== VIDEO MODAL ==================== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.video-modal-content {
    position: relative;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
}

.video-modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.video-modal-close:hover {
    background: white;
    color: #000;
    transform: rotate(90deg);
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================== LIGHTBOX ==================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: zoom-out;
}

.lightbox-content {
    position: relative;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
    color: #000;
    transform: scale(1.1);
}

.lightbox-close {
    top: 2rem;
    right: 2rem;
    font-size: 2rem;
}

.lightbox-prev {
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next {
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-image-wrapper {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-weight: 600;
}

/* ==================== PRELOADER ==================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.preloader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== BACK TO TOP ==================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.back-to-top.active {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

/* ==================== SLIDER DOTS ==================== */
.slider-dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.slider-dot {
    width: 12px;
    height: 12px;
    background: #d1d5db;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot:hover {
    background: #9ca3af;
}

.slider-dot.active {
    width: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* ==================== TESTIMONIAL SLIDER ==================== */
.testimonial-slider {
    position: relative;
    overflow: hidden;
}

.testimonial-slider .testimonial-card {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.testimonial-slider .testimonial-card.active {
    display: block;
    opacity: 1;
}

/* ==================== TOAST NOTIFICATION ==================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: -400px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10000;
    transition: right 0.3s ease;
    max-width: 400px;
}

.toast.show {
    right: 2rem;
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.toast.error .toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

.toast.info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: #6b7280;
}

.toast-close {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #111827;
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control.error {
    border-color: #ef4444;
}

.form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ==================== ACCORDION ==================== */
.accordion-item {
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.accordion-header {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #111827;
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: #f9fafb;
}

.accordion-icon {
    width: 24px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.accordion-item.active .accordion-icon {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 1.5rem 1.25rem;
    color: #6b7280;
}

/* ==================== TABS ==================== */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 2rem;
}

.tab-button {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.tab-button:hover {
    color: #3b82f6;
}

.tab-button.active {
    color: #3b82f6;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* ==================== PROGRESS BAR ==================== */
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 1rem;
    transition: width 0.5s ease;
}

/* ==================== SKELETON LOADER ==================== */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-image {
    height: 200px;
    width: 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .video-modal-close,
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .back-to-top {
        bottom: 5rem;
        left: 1rem;
        width: 40px;
        height: 40px;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        max-width: calc(100% - 2rem);
    }

    .toast.show {
        right: 1rem;
    }
}
