/* Components CSS - Modals, Forms, and UI Components */

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.7);
    transition: transform var(--transition-normal);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--light-gray);
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-gray);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    color: var(--gray);
    transition: color var(--transition-fast);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-md);
}

.modal-close:hover {
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
}

.modal-body {
    padding: var(--spacing-xl);
}

/* Form Styles */
.share-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: var(--font-size-sm);
}

.form-group input,
.form-group textarea {
    padding: var(--spacing-md);
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group input:invalid {
    border-color: var(--danger-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

/* Video Player Components */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.video-player:hover .video-controls {
    opacity: 1;
}

.control-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.progress-container {
    flex: 1;
    margin: 0 var(--spacing-md);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: var(--border-radius-full);
    width: 0%;
    transition: width 0.1s ease;
}

.progress-bar:hover .progress-fill {
    background: var(--primary-light);
}

.time-display {
    color: var(--white);
    font-size: var(--font-size-sm);
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

/* Search Suggestions */
.search-suggestions {
    border: 1px solid var(--light-gray);
}

.suggestion-item {
    padding: var(--spacing-md);
    cursor: pointer;
    border-bottom: 1px solid var(--light-gray);
    transition: background-color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--light-gray);
}

.suggestion-icon {
    font-size: var(--font-size-lg);
    opacity: 0.7;
}

.suggestion-text {
    flex: 1;
}

.suggestion-category {
    font-size: var(--font-size-xs);
    color: var(--gray);
    background: var(--light-gray);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
}

/* Search Results */
.search-results {
    display: none;
    padding: var(--spacing-2xl) 0;
}

.search-results.show {
    display: block;
}

.results-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.results-count {
    color: var(--gray);
    font-size: var(--font-size-sm);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

.result-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.result-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-thumbnail .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    border-radius: var(--border-radius-full);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    transition: all var(--transition-fast);
}

.result-card:hover .play-overlay {
    background: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.result-info {
    padding: var(--spacing-lg);
}

.result-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--dark-gray);
    line-height: 1.3;
}

.result-description {
    color: var(--gray);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
    color: var(--gray);
}

.result-category {
    background: var(--primary-color);
    color: var(--white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
}

.result-duration {
    font-weight: 500;
}

/* Notification/Toast Components */
.toast {
    position: fixed;
    top: 100px;
    right: var(--spacing-lg);
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-lg);
    max-width: 400px;
    z-index: var(--z-tooltip);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    border-left: 4px solid var(--primary-color);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.toast-title {
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: var(--gray);
    padding: 0;
}

.toast-body {
    color: var(--gray);
    font-size: var(--font-size-sm);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
}

.loading-text {
    color: var(--gray);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-md);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--light-gray) 25%, #e9ecef 50%, var(--light-gray) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-text {
    height: 1em;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-sm);
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

.skeleton-thumbnail {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius-lg);
}

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

/* Dropdown Components */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    min-width: 150px;
    transition: all var(--transition-fast);
}

.dropdown-toggle:hover {
    border-color: var(--primary-color);
}

.dropdown-toggle.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border-bottom: 1px solid var(--light-gray);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--light-gray);
}

.dropdown-item.selected {
    background: var(--primary-color);
    color: var(--white);
}

/* Responsive Components */
@media (min-width: 576px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-actions {
        flex-direction: row;
    }
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-content {
        width: 80%;
    }
    
    .toast {
        right: var(--spacing-xl);
    }
}

@media (min-width: 992px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        width: 60%;
    }
}

@media (max-width: 575px) {
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .toast {
        left: var(--spacing-md);
        right: var(--spacing-md);
        max-width: none;
    }
    
    .video-controls {
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }
    
    .control-btn {
        min-width: 36px;
        height: 36px;
        font-size: var(--font-size-base);
    }
    
    .time-display {
        font-size: var(--font-size-xs);
        min-width: 70px;
    }
}

/* Dark mode support for components */
@media (prefers-color-scheme: dark) {
    .modal-content,
    .dropdown-toggle,
    .dropdown-menu,
    .result-card,
    .toast {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .form-group input,
    .form-group textarea {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .suggestion-item:hover,
    .dropdown-item:hover {
        background: #4a5568;
    }
    
    .skeleton {
        background: linear-gradient(90deg, #4a5568 25%, #2d3748 50%, #4a5568 75%);
        background-size: 200% 100%;
    }
}
