/* ═════════════════════════════════════════════════════════════════
   RAKJO Metadatos — Estilos Globales
   ═════════════════════════════════════════════════════════════════ */

:root {
    --primary-blue:   #1a3a5c;
    --secondary-blue: #2c5aa0;
    --accent-gold:    #c9a84c;
    --bg-light:       #f5f7fa;
    --bg-white:       #ffffff;
    --text-dark:      #333333;
    --text-gray:      #666666;
    --border-light:   #e0e0e0;
    --success:        #4caf50;
    --warning:        #ff9800;
    --error:          #f44336;
    --radius:         8px;
    --shadow-sm:  0 2px 4px rgba(0,0,0,.1);
    --shadow-md:  0 4px 12px rgba(0,0,0,.15);
    --shadow-lg:  0 20px 60px rgba(0,0,0,.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

a { color: var(--primary-blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-gold); }

/* ─────────────────────────────────────────────────────────────────
   HEADER
   ───────────────────────────────────────────────────────────────── */

.rakjo-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    backdrop-filter: blur(10px);
    color: white;
}

.title-section h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
    color: white;
}

.title-section p {
    font-size: 12px;
    opacity: .75;
    color: white;
}

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

.language-selector {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    padding: 6px 10px;
    color: white;
}

.language-selector select {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    outline: none;
}

.language-selector select option {
    background: var(--primary-blue);
    color: white;
}

.icon-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all .3s;
    text-decoration: none;
}

.icon-btn:hover {
    background: rgba(255,255,255,.25);
    transform: translateY(-2px);
    color: white;
}

/* ─────────────────────────────────────────────────────────────────
   CONTAINER & GRID
   ───────────────────────────────────────────────────────────────── */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .layout-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .3s;
    display: flex;
    flex-direction: column;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(to right, var(--bg-light), transparent);
}

.card-header h2,
.card-header h3 {
    color: var(--primary-blue);
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.card-header h2 i,
.card-header h3 i {
    color: var(--accent-gold);
}

/* ─────────────────────────────────────────────────────────────────
   UPLOAD AREA
   ───────────────────────────────────────────────────────────────── */

.upload-area {
    padding: 40px 30px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all .3s;
    margin: 20px;
}

.upload-area:hover {
    border-color: var(--accent-gold);
    background: rgba(201,168,76,.04);
}

.upload-area.dragover {
    border-color: var(--secondary-blue);
    background: rgba(44,90,160,.06);
    transform: scale(1.01);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.upload-placeholder > * { pointer-events: none; }
.upload-placeholder .btn-open-file { pointer-events: auto; }

.upload-placeholder i {
    font-size: 46px;
    color: var(--accent-gold);
}

.upload-placeholder p {
    color: var(--text-gray);
    font-size: 15px;
    font-weight: 500;
}

.upload-or {
    color: #bbb;
    font-size: 13px;
}

.btn-open-file {
    padding: 9px 22px;
    background: linear-gradient(135deg, var(--accent-gold), #e8a020);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-open-file:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201,168,76,.45);
}

.supported-formats {
    padding: 12px 20px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-gray);
}

/* ─────────────────────────────────────────────────────────────────
   FILE LIST (selected file)
   ───────────────────────────────────────────────────────────────── */

.file-list {
    padding: 0 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-top: 12px;
}

.file-item-info { flex: 1; }

.file-item-name {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    word-break: break-all;
}

.file-item-size {
    color: var(--text-gray);
    font-size: 12px;
}

/* ─────────────────────────────────────────────────────────────────
   SECTION ACTIONS
   ───────────────────────────────────────────────────────────────── */

.section-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-light);
    text-align: center;
    margin-top: auto;
}

.download-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────── */

button, .btn {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .3s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-secondary {
    background: var(--accent-gold);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .3s;
    flex: 1;
    justify-content: center;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: #b8953e;
}

.btn-clear {
    background: #9e9e9e;
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .3s;
    flex: 1;
    justify-content: center;
}

.btn-clear:hover {
    background: #757575;
    transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────
   LOADING SPINNER
   ───────────────────────────────────────────────────────────────── */

.loading-spinner {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* ─────────────────────────────────────────────────────────────────
   RESULTS / METADATA DISPLAY
   ───────────────────────────────────────────────────────────────── */

.results-list {
    padding: 20px;
    max-height: 520px;
    overflow-y: auto;
}

.metadata-section {
    background: var(--bg-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent-gold);
    margin-bottom: 14px;
    padding: 14px;
}

.metadata-section h3 {
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.metadata-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

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

.metadata-key {
    color: var(--text-gray);
    font-weight: 500;
    word-break: break-word;
}

.metadata-value {
    color: var(--text-dark);
    word-break: break-word;
}

.warnings {
    background: #fff8e1;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 10px;
}

.warnings h3 {
    color: #e65100;
    font-size: 13px;
    margin-bottom: 8px;
}

.warning-item {
    color: #e65100;
    font-size: 13px;
    margin-bottom: 4px;
}

/* ─────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────── */

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

/* ─────────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────────── */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.45);
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
    animation: fadeIn .25s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 620px;
    width: 92%;
    max-height: 82vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: var(--primary-blue);
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 26px;
    color: var(--text-gray);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all .2s;
}

.modal-close:hover { background: var(--bg-light); color: var(--primary-blue); }

.modal-body {
    padding: 20px;
}

.modal-body h4 {
    color: var(--primary-blue);
    margin: 20px 0 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.modal-body h4:first-child { margin-top: 0; }

.modal-body p {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.7;
}

.modal-body ul {
    margin-left: 18px;
}

.modal-body li {
    margin-bottom: 6px;
    color: var(--text-gray);
    font-size: 14px;
}

.help-step {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.help-step:last-child { border-bottom: none; margin-bottom: 0; }

.help-step strong {
    display: block;
    color: var(--primary-blue);
    margin-bottom: 4px;
    font-size: 14px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    text-align: right;
}

/* ─────────────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    margin-bottom: 10px;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn .3s ease-out;
    border-left: 4px solid var(--success);
    font-size: 14px;
    color: var(--text-dark);
}

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

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .header-content { flex-wrap: wrap; gap: 12px; }
    .upload-area { padding: 28px 16px; }
    .metadata-item { grid-template-columns: 130px 1fr; }
    .download-row { flex-direction: column; }
}

/* ═════════════════════════════════════════════════════════════════
   LAYOUT RAIE ESTÁNDAR — S011
   ═════════════════════════════════════════════════════════════════ */

html, body { overflow: hidden; }

.app-layout {
    display: flex; height: 100vh; overflow: hidden;
}

/* ── Sidebar overlay (móvil) ── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ── Sidebar ── */
.sidebar {
    width: 240px; background: #1a3a5c; display: flex;
    flex-direction: column; flex-shrink: 0; overflow: hidden;
    transition: transform .25s; z-index: 200;
}
.sidebar-logo {
    display: flex; align-items: center; padding: 20px 16px 12px;
}
.logo-mark {
    width: 40px; height: 40px; background: #e8a020; color: #1a3a5c;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; margin-right: 10px; flex-shrink: 0;
}
.logo-text { font-weight: 700; font-size: 14px; color: #fff; }
.logo-text small { display: block; font-size: 10px; opacity: .7; font-weight: 400; }

.sidebar-nav {
    padding: 4px 8px 8px; flex: 1; display: flex; flex-direction: column;
    overflow-y: auto;
}
.sidebar-nav a {
    display: block; padding: 10px 12px; color: rgba(255,255,255,.75) !important;
    border-radius: 6px; font-size: 13px; font-weight: 500;
    text-decoration: none !important; transition: background .15s, color .15s; margin-bottom: 2px;
    border: none !important;
}
.sidebar-nav a:hover, .sidebar-nav a.nav-active {
    background: rgba(255,255,255,.12); color: #fff !important;
}
.nav-section-title {
    font-size: 10px; font-weight: 600; color: rgba(255,255,255,.4);
    text-transform: uppercase; letter-spacing: .08em;
    padding: 14px 12px 4px; margin-top: 4px;
}

/* ── Sidebar footer ── */
.sidebar-footer {
    padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12);
    display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}
.sidebar-lang { display: flex; align-items: center; gap: 6px; }
.sidebar-lang select {
    flex: 1; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.85); border-radius: 6px; padding: 5px 8px;
    font-size: 12px; cursor: pointer;
}
.sidebar-lang select option { background: #1a3a5c; color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: 8px; }
.user-avatar {
    width: 32px; height: 32px; background: #e8a020; color: #1a3a5c;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong {
    display: block; font-size: 13px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info small { display: block; font-size: 11px; color: rgba(255,255,255,.6); }
.btn-sidebar-icon {
    background: none; border: none; color: rgba(255,255,255,.6);
    cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px;
    flex-shrink: 0; text-decoration: none; line-height: 1; display: flex;
    align-items: center; justify-content: center;
}
.btn-sidebar-icon:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── Main content ── */
.main-content {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-light);
}

/* ── Topbar ── */
.main-topbar {
    background: #fff; padding: 12px 24px; display: flex; align-items: center;
    gap: 12px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.main-topbar h1 {
    font-size: 16px; font-weight: 600; color: #1a3a5c; flex: 1; margin: 0;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Content scroll ── */
.content-scroll {
    flex: 1; overflow-y: auto; padding: 28px 32px;
}

/* ── Override container (ya no se usa el header de portal) ── */
.container { max-width: none; margin: 0; padding: 0; }

/* ── Botón ayuda topbar ── */
#btn-help {
    padding: 0 !important;
    border: 1px solid rgba(26,58,92,.3) !important;
    background: none !important;
    color: #1a3a5c !important;
    width: 30px !important; height: 30px !important;
    border-radius: 50% !important;
    font-weight: 700 !important; font-size: 14px !important;
    cursor: pointer; flex-shrink: 0;
    display: flex !important; align-items: center !important; justify-content: center !important;
    line-height: 1 !important;
}

/* ── Hamburger (móvil) ── */
.hamburger-btn {
    background: none; border: none; font-size: 20px;
    cursor: pointer; color: #1a3a5c; padding: 4px 6px; flex-shrink: 0;
}
.hide-desktop { display: none; }

@media (max-width: 768px) {
    .hide-desktop { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; height: 100%; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .content-scroll { padding: 20px 16px; }
    .layout-grid { grid-template-columns: 1fr !important; }
}
