/* Media Center 2.0 - Main2 CSS - COMBINACIÓN DE ESTILOS */

/* ===== RESET BÁSICO ===== */
* {
    box-sizing: border-box;
}

/* ===== HEADER ===== */
.header {
    background: none;
    padding: 0 32px;
    margin-bottom: 32px;
    border: none;
    box-shadow: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid #e5e7eb;
}

.header-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.025em;
}

.header-info p {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 0 0;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ===== FILTROS ===== */
.filters-container {
    margin-bottom: 24px;
    padding: 0 32px;
}

.filters-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-tabs {
    display: flex;
    gap: 0;
}

.category-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.category-tab:first-child {
    padding-left: 0;
}

.category-tab:hover {
    color: #374151;
    background: #f9fafb;
    border-radius: 6px;
}

.category-tab.active {
    color: #111827;
    font-weight: 600;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: #3b82f6;
    border-radius: 1px;
}

.category-tab:first-child.active::after {
    left: 0;
}

/* ===== VIDEOS CONTAINER ===== */
.videos-container {
    background: #ffffff;
    min-height: 400px;
    padding: 0 32px;
}

.videos-section {
    padding: 8px 0;
}

.videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.videos-stats {
    font-size: 14px;
    color: #6b7280;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== VIDEO CARD ===== */
.video-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.video-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.video-card.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.draft-card {
    background: #f8f9fa;
    border-left: 4px solid #6b7280;
}

.exported-card {
    background: #ffffff;
    border-left: 4px solid #10b981;
}

.uploaded-card {
    background: #ffffff;
    border-left: 4px solid #8b5cf6;
}

.avatar-card {
    background: #ffffff;
    border-left: 4px solid #f59e0b;
}

.script-card {
    background: #ffffff;
    border-left: 4px solid #06b6d4;
}

.workflow-card {
    background: #ffffff;
    border-left: 4px solid #ec4899;
}

/* ===== VIDEO THUMBNAIL (9:16 Aspect Ratio for TikTok/Reels) ===== */
.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 177.78%; /* 9:16 aspect ratio */
    background: #f9fafb;
    overflow: hidden;
    cursor: pointer;
}

.video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crops to fill, maintaining aspect ratio */
    transition: transform 0.2s ease;
}

.video-card:hover .video-preview {
    transform: scale(1.05);
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    color: #9ca3af;
    gap: 8px;
    transition: background 0.2s ease;
}

.video-card:hover .video-placeholder {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.video-placeholder span {
    font-size: 12px;
    font-weight: 500;
}

/* ===== VIDEO STATUS BADGE ===== */
.video-status-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #6b7280;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.video-status-badge.draft {
    background: #6b7280;
}

.video-status-badge.ready {
    background: #10b981;
}

.video-status-badge.processing {
    background: #f59e0b;
}

.video-status-badge.error {
    background: #ef4444;
}

.video-status-badge.uploaded {
    background: #3b82f6;
}

/* ===== EDIT ICON HOVER ===== */
.video-title:hover .edit-icon,
.video-card:hover .edit-icon {
    opacity: 0.6 !important;
}

/* ===== VIDEO OVERLAY ===== */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.video-card:hover .video-overlay {
    opacity: 1;
}

/* Fallback placeholder for broken thumbnails */
.video-placeholder-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    color: #9ca3af;
    gap: 8px;
}

/* ===== PLAY BUTTON ===== */
.play-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.play-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.play-btn i {
    color: #1f2937;
    transition: color 0.2s ease;
}

.play-btn:hover i {
    color: #3b82f6;
}

/* ===== VIDEO INFO ===== */
.video-info {
    padding: 16px 20px;
}

.video-title-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.video-card-select {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 15;
    padding: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-card:hover .video-card-select {
    opacity: 1;
}

.video-card-select:has(.video-checkbox:checked) {
    opacity: 1;
}

.video-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #9ca3af;
    border-radius: 3px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-checkbox:hover {
    border-color: #6b7280;
}

.video-checkbox:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.video-checkbox:checked::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.4;
    flex: 1;
}

.audience-name {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.3;
    margin-bottom: 6px;
}

.video-details-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.video-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: #9ca3af;
}

.download-icon-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-icon-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.download-icon-btn:active {
    background: #e5e7eb;
}

.voice-info {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f3f4f6;
}

/* ===== BULK ACTIONS ===== */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.selection-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-count {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 32px;
    color: #6b7280;
}

.empty-icon {
    margin-bottom: 20px;
    color: #9ca3af;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
}

.empty-state p {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ===== LOADING STATE ===== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: #ffffff;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid #e5e7eb;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinning animation for loading icons */
.spinning {
    animation: spin 1s linear infinite;
}

/* ===== CUSTOM MODAL (Styleguide Style) ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

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

.modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal--active .modal__content {
    transform: scale(1);
}

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

.modal__header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal__close:hover {
    background: #f3f4f6;
    color: #111827;
}

.modal__body {
    padding: 24px;
}

.modal__body p {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* Ghost button for modal */
.btn--ghost {
    background: transparent;
    color: #374151;
    border: 1px solid transparent;
}

.btn--ghost:hover:not(:disabled) {
    background: #f3f4f6;
    color: #111827;
}

/* ===== MODALS ===== */
.video-modal,
.upload-modal,
.create-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.video-modal-content,
.upload-modal-content,
.create-video-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 1);
    transform: scale(1.1);
}

/* ===== VIDEO MODAL ===== */
#modal-video {
    width: 100%;
    height: 100%;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

/* ===== UPLOAD MODAL ===== */
.upload-modal-header,
.create-video-modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.upload-modal-header h3,
.create-video-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.upload-modal-body,
.create-video-modal-body {
    padding: 24px;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.upload-hint {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 12px;
}



/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .filters-container {
        padding: 0 16px;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .videos-container {
        padding: 0 16px;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .bulk-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .category-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }

    .category-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px;
    }

    .filters-container {
        padding: 0 12px;
    }

    .videos-container {
        padding: 0 12px;
    }

    .category-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========================================
   STICKY HEADER & FILTERS (Viral Studio Style)
   ======================================== */

/* Main Content Wrapper */
.main-content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Fix para que sticky funcione - el main no debe tener overflow */
body:has(.header--sticky) main {
    overflow-y: visible !important;
}

/* Header Sticky */
.header--sticky {
    position: sticky !important;
    top: 0;
    z-index: 100;
    background: #ffffff !important;
    box-shadow: none;
    padding: 2rem 4rem 1.5rem 4rem !important;
    margin: 0 -4rem !important;
    width: calc(100% + 8rem);
    margin-bottom: 0 !important;
}

.header--sticky .header__title {
    display: flex;
    align-items: center;
    font-size: 1.875rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1f2937;
}

.header--sticky .header__title i {
    color: #3b82f6;
}

.header--sticky .header__description {
    font-size: 1.125rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

/* Filters Bar Sticky */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 4rem;
    margin: 0 -4rem 1.5rem -4rem;
    width: calc(100% + 8rem);
    flex-wrap: wrap;
    position: sticky;
    top: 120px;
    z-index: 99;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filters-group--end {
    margin-left: auto;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Pills Styling */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #ffffff;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
}

.pill:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.pill--active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.pill--active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Scrollable Content */
.scrollable-content {
    padding-top: 1rem;
}

.scrollable-content .videos-container {
    padding: 0;
}

/* Updated Empty State */
.empty-state__icon {
    margin-bottom: 1.5rem;
    color: #9ca3af;
}

.empty-state__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.75rem;
}

.empty-state__description {
    font-size: 1rem;
    color: #4b5563;
    margin: 0 0 1.5rem;
    max-width: 500px;
}

/* Button Styles with BEM modifiers */
.btn--primary {
    background-color: #3b82f6;
    color: #ffffff;
    border: 1px solid #3b82f6;
}

.btn--primary:hover:not(:disabled) {
    background-color: #2563eb;
    border-color: #2563eb;
}

.btn--secondary {
    background-color: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e2e8f0;
}

.btn--secondary:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn--danger {
    background-color: #ef4444;
    color: #ffffff;
    border: 1px solid #ef4444;
}

.btn--danger:hover:not(:disabled) {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Bulk actions in filter bar */
.filters-bar .bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
}

.filters-bar .selected-count {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

/* Responsive adjustments for new layout */
@media (max-width: 768px) {
    .main-content-wrapper {
        padding: 0 16px;
    }

    .header--sticky {
        padding: 1.5rem 0 1rem !important;
    }

    .header--sticky .header__title {
        font-size: 1.5rem;
    }

    .header--sticky .header__description {
        font-size: 1rem;
    }

    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        top: 100px;
    }

    .filters-group--end {
        margin-left: 0;
        width: 100%;
    }

    .filter-pills {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .pill {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .filters-bar {
        top: 90px;
    }
}
