/**
 * Strimy Video Importer - Estilos CSS
 * 
 * Estilos para la interfaz de importación de videos de Strimy
 */

/* Contenedor principal */
.strimy-importer-container {
    margin: 20px 0;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Contenedor principal del importador */
.strimy-importer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.strimy-importer-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #23282d;
}

/* Contenedor principal de controles dentro del postbox */
.strimy-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

/* Contenedor de búsqueda */
.strimy-search-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

/* Contenedor de acciones */
.strimy-action-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Contenedor de búsqueda (legacy - mantener por compatibilidad) */
.strimy-search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

/* Input de búsqueda */
.strimy-search-input,
#strimy-search {
    flex: 1;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    height: 32px;
    box-sizing: border-box;
}

/* Botón de búsqueda */
.strimy-search-container .button {
    height: 32px;
    line-height: 30px;
    padding: 0 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Contenedor de acciones */
.strimy-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botones de acción */
.strimy-actions .button {
    height: 32px;
    line-height: 30px;
    padding: 0 12px;
    white-space: nowrap;
}

.strimy-messages {
    margin-bottom: 20px;
}

/* LAYOUT WORDPRESS ADMIN - ESTRUCTURA OFICIAL */
.strimy_video_page_strimy-import .wrap {
    margin: 10px 20px 0 2px;
}

.strimy_video_page_strimy-import #poststuff {
    padding-top: 10px;
}

.strimy_video_page_strimy-import #post-body.columns-1 {
    max-width: none;
}

.strimy_video_page_strimy-import .postbox-container {
    width: 100%;
}

.strimy_video_page_strimy-import .postbox {
    margin-bottom: 20px;
}

.strimy_video_page_strimy-import .postbox .inside {
    margin: 11px 0;
    padding: 0 12px 12px;
}

/* Estilo básico para tarjetas de video - sin interferir con el grid inline */
.strimy-video-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    transition: all 0.2s ease;
}

.strimy-video-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    border-color: #0073aa;
}

/* Tarjetas de video - Grid compatible */
.strimy-video-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    grid-column: span 1;
    align-self: stretch;
}

/* Videos ya importados */
.strimy-video-card.strimy-video-imported {
    background: #f8f9fa;
    border-color: #28a745;
    opacity: 0.8;
}

.strimy-video-card.strimy-video-imported:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.strimy-video-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    border-color: #0073aa;
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumbnail:hover img {
    transform: scale(1.05);
}

/* Duración del video */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Badge de video importado */
.video-imported-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

/* Estado de importado en meta */
.video-imported-status {
    color: #28a745;
    font-weight: 600;
    font-size: 12px;
}

.video-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.video-date {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Selector de video */
.strimy-video-select {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.strimy-video-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Checkbox deshabilitado para videos importados */
.video-checkbox-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.video-checkbox-label.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.video-checkbox-label.disabled input[type="checkbox"]:disabled {
    opacity: 0.5;
}

/* Estado de importación (legacy - mantener por compatibilidad) */
.strimy-video-imported {
    background: #46b450;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
}

/* Paginación */
.strimy-pagination {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.strimy-pagination-info {
    color: #666;
    font-size: 13px;
}

.strimy-pagination-links {
    display: flex;
    gap: 5px;
}

.strimy-pagination-links a,
.strimy-pagination-links span {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #0073aa;
    background: #f7f7f7;
    cursor: pointer;
}

.strimy-pagination-links span.current {
    background: #0073aa;
    color: white;
    border-color: #006291;
}

.strimy-pagination-links a:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

/* Acciones */
.strimy-importer-actions {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.strimy-importer-actions .button-primary {
    margin-left: 10px;
}

/* Estados de carga */
.strimy-loading {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.strimy-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: strimy-spin 1s linear infinite;
    margin-bottom: 15px;
}

.strimy-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 115, 170, 0.2);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: strimy-spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Mensajes */
.strimy-message {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 3px;
    border-left: 4px solid;
}

/* Mensaje de no videos */
.strimy-no-videos {
    text-align: center;
    padding: 40px 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin: 20px auto;
    max-width: 600px;
}

.strimy-no-videos-title {
    font-size: 18px;
    font-weight: 600;
    color: #555;
    margin-bottom: 15px;
}

.strimy-no-videos-help {
    color: #777;
    font-size: 14px;
    line-height: 1.5;
}

.strimy-message-success {
    background-color: #f0f9e8;
    border-color: #46b450;
}

.strimy-message-error {
    background-color: #fbeaea;
    border-color: #dc3232;
}

.strimy-message-info {
    background-color: #e5f5fa;
    border-color: #00a0d2;
}

.strimy-message-warning {
    background-color: #fff8e5;
    border-color: #ffb900;
}

/* Metabox de sincronización */
.strimy-sync-metabox {
    margin-top: 15px;
}

.strimy-sync-info {
    margin-bottom: 10px;
}

.strimy-sync-info p {
    margin: 5px 0;
}

.strimy-sync-date {
    font-style: italic;
    color: #666;
}

.video-actions {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.video-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0073aa;
    cursor: pointer;
    user-select: none;
}

.video-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.video-checkbox:checked + .checkmark {
    color: #0073aa;
}

.checkmark {
    transition: color 0.2s ease;
}

/* Responsive Design - WordPress Admin Standards */
@media screen and (max-width: 1200px) {
    .strimy-videos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .strimy-importer-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .strimy-search-container {
        min-width: auto;
        width: 100%;
    }
    
    .strimy-search-input {
        max-width: none;
    }
    
    .strimy-actions {
        justify-content: flex-start;
        width: 100%;
    }
}

@media screen and (max-width: 782px) {
    .strimy-videos-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 15px !important;
    }
    
    .strimy-importer-header {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .strimy-search-container {
        width: 100%;
        min-width: auto;
    }
    
    .strimy-search-input {
        max-width: none;
        width: 100%;
    }
    
    .strimy-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .strimy-actions .button {
        flex: 0 0 auto;
    }
    
    .video-thumbnail {
        height: 200px;
    }
}

@media screen and (max-width: 600px) {
    .strimy-videos-grid {
        padding: 10px !important;
        gap: 10px !important;
    }

    .video-info {
        padding: 12px;
    }

    .video-actions {
        padding: 12px;
    }
}

@media (max-width: 1200px) {
    #strimy-videos-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    #strimy-videos-container {
        grid-template-columns: 1fr !important;
    }
}
