/* styles.css - Estilos para Metadata Extractor */

:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3a1;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-light: #e9ecef;
    --gray-medium: #adb5bd;
    --gray-dark: #495057;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --success-color: #27ae60;
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 6px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    min-height: 100vh;
    overflow-x: hidden;

}

/* ==================== HEADER ==================== */
header {
    background-color: var(--primary-color);
    color: white;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.header-btn {
    padding: 10px 14px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    background-color: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.85rem;
}

.header-btn:hover:not(:disabled) {
    background-color: rgba(255,255,255,0.25);
}

.header-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botones ocultos temporalmente (NO se borran: funciones y listeners intactos).
   Para reactivarlos, eliminar solo estas reglas. */
#importBtn,
#exportBtn,
#metadataImportBtn,
#htmlOpenBtn {
    display: none;
}

.lang-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
}

/* ==================== APP CONTAINER ==================== */
.app-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-light);
    height: calc(100vh - var(--header-height));
    position: fixed;
    left: 0;
    padding: 20px;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--gray-light);
    padding-bottom: 8px;
}

#searchInput {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

.pages-list {
    list-style: none;
}

.page-item {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

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

.page-item.active {
    background-color: rgba(79,195,161,0.1);
    border: 1px solid var(--accent-color);
}

.page-count {
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    min-width: 24px;
    text-align: center;
}

.page-number {
    color: var(--gray-medium);
    font-size: 0.85rem;
    font-weight: 400;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 25px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-light);
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary{
    background: var(--secondary-color);
    color: white;
}
.btn-danger{
    background: var(--danger-color);
    color: white;
}
.btn-success {
    background: var(--success-color);
    color: white;
}

.btn:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== BULK EDITOR ==================== */
.bulk-editor {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: none;
}

.bulk-editor h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.bulk-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    padding: 6px 6px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
}

.bulk-actions {
    display: flex;
    gap: 10px;
}

/* ==================== MEDIA GRID ==================== */
.media-grid {
    display: grid;
    gap: 25px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-medium);
}

.media-item {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.media-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--light-color);
    border-bottom: 1px solid var(--gray-light);
}

.media-type {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-image {
    background: #d4edda;
    color: #155724;
}

.type-video {
    background: #d1ecf1;
    color: #0c5460;
}

.type-audio {
    background: #fff3cd;
    color: #856404;
}

.type-iframe {
    background: #f8d7da;
    color: #721c24;
}

.media-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
    padding: 10px;
}
.media-checkbox{
transform:scale(2);
}
.media-dat {
    padding: 6px;
    border:1px solid var(--gray-light);
    border-radius: var(--border-radius);
}
.media-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 6px;
}

.media-viewer img {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
}

.media-viewer video,
.media-viewer audio {
    width: 100%;
    max-height: 240px;
}

.media-viewer iframe {
    width: 100%;
    height: 260px;
    border: none;
}

.media-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}
.media-alt {

}
textarea{
min-height:70px;
border:1px solid var(--gray-light);
border-radius: var(--border-radius);
}
/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: white;
    font-size: 1.1rem;
}

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

/* ==================== MODALS ==================== */
.csv-import,
.code-modal,
.template-modal,
.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.csv-import-content,
.code-modal-content,
.template-modal-content,
.preview-modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.template-modal-content {
    max-width: 600px;
}

.code-modal-content {
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.code-textarea {
    flex: 1;
    font-family: monospace;
    padding: 15px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    margin: 20px 0;
    resize: none;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-medium);
}

.close-btn:hover {
    color: var(--dark-color);
}

/* ==================== PREVIEW MODAL ==================== */
.preview-modal-content {
    width: 90%;
    max-width: none;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

.preview-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-light);
    flex-shrink: 0;
}

.preview-tab {
    min-width: 38px;
    padding: 7px 12px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    background: #fff;
    color: var(--dark-color);
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.preview-tab:hover:not(.active) {
    background: var(--gray-light);
}

.preview-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    margin-top: 14px;
    padding: 14px 10px;
    background: #fafafa;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
}

.preview-content .exe-layout-3-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.preview-content .exe-col {
    flex: 1 1 30%;
    min-width: 220px;
}

.preview-content figure {
    margin: 0 0 14px;
}

.preview-content .exe-no-resources {
    margin: 0;
    padding: 10px 14px;
    font-style: italic;
    color: var(--text-muted, #666);
    border: 1px dashed var(--gray-light);
    border-radius: var(--border-radius);
}
.preview-content .exe-figure img{
    max-width: 200px !important;
    max-height: 200px !important;
    height: auto;
}
/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 10px;
}

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

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

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

.toast-info {
    background: var(--primary-color);
}

/* ==================== TEMPLATE SYSTEM ==================== */
.template-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.template-item {
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-item:hover {
    border-color: var(--accent-color);
    background-color: rgba(79, 195, 161, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.template-header h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.template-details {
    font-size: 0.9rem;
    color: var(--gray-dark);
}

.template-details div {
    margin: 5px 0;
}

.repeat-badge {
  background: var(--warning-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}


.btn-template {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.btn-template:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.btn-template svg {
    display: block;
}

/* ==================== HIDDEN INPUTS ==================== */
#zipFileInput,
#metadataFileInput,
#csvFileInput {
    display: none;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1200px) {
    .media-content,
    .media-form,
    .bulk-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-controls {
        flex-wrap: wrap;
    }
    
    .page-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .page-actions .btn {
        width: 100%;
    }
}
/* Cabecera del editor */
.bulk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

/* Botón pequeño sin texto, solo icono */
.btn-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius:50%;
  background-image: url('data:image/svg+xml;utf8,\
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 14" fill="none" stroke="currentColor" stroke-width="2">\
      <path d="M6 9l6 -6 6 6"/>\
    </svg>');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.2s;
  border:1px solid #333333;

}

/* Cuando está colapsado el botón apunta hacia la derecha */
.bulk-editor.collapsed .btn-toggle {
  transform: rotate(180deg);
}

/* El contenido se oculta con max-height para poder animar */
.bulk-content {
  overflow: hidden;
  max-height: 600px; /* bastante grande */
  transition: max-height 0.3s ease;
}

.bulk-editor.collapsed .bulk-content {
  max-height: 0;
}
.btn-toggle:hover{
background-color:yellow;
}
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);display:none;align-items:center;justify-content:center;z-index:1001}
.modal-box{background:#fff;padding:1.5rem;border-radius:6px;width:90%;max-width:420px}
.modal-actions{margin-top:1rem;text-align:right;display:flex;gap:.5rem;justify-content:flex-end}
.auth-group{background:#eef4fb;border:1px solid #cfe0f2;border-radius:6px;padding:.75rem;margin-bottom:.75rem}
.auth-tabs{display:flex;gap:.5rem;margin-bottom:.5rem;align-items:center}
.auth-tab{padding:.35rem .7rem;border:1px solid #ccc;background:#f5f5f5;border-radius:4px;cursor:pointer}
.auth-tab.active{background:#4a6fa5;color:#fff;border-color:#4a6fa5}
.auth-tab-content{margin-top:.5rem}
.auth-help-btn{margin-left:auto;width:22px;height:22px;line-height:1;border-radius:50%;border:1px solid #4a6fa5;background:#fff;color:#4a6fa5;font-weight:bold;cursor:pointer;padding:0}
.auth-help-btn:hover{background:#4a6fa5;color:#fff}
.media-preview{margin-top:.5rem;padding:.5rem .6rem;background:#f7f7f7;border:1px dashed #ccc;border-radius:4px;font-size:.85rem;color:#444}
.media-preview .preview-auth a, .media-preview .preview-license a{color:#166088}
.media-preview .sep{color:#999}

.figcaption{
text-align: center;
}