/* ==========================================================================
   ESTUDIO DE VELADORAS - PANEL DE SUBIDA & GENERADOR DE QR
   Diseño de Vanguardia: Obsidian, Glassmorphism, Amber Glow & Print Styles
   ========================================================================== */

:root {
    --bg-dark: #0b0714;
    --bg-card: rgba(23, 14, 33, 0.75);
    --bg-card-hover: rgba(33, 20, 48, 0.85);
    --bg-input: rgba(14, 8, 22, 0.7);

    --amber: #ffaa00;
    --cempasuchil: #ff7700;
    --flame-gold: #ffbe3b;
    --flame-red: #d90429;
    --success: #10b981;

    --text-primary: #fcf9f2;
    --text-secondary: #c4b5a5;
    --text-muted: #857488;
    --text-gold: #ffd166;

    --border-glow: 1px solid rgba(255, 170, 0, 0.25);
    --border-subtle: 1px solid rgba(255, 255, 255, 0.08);

    --gradient-flame: linear-gradient(135deg, #ff9e00 0%, #ff5400 50%, #d00000 100%);
    --gradient-gold: linear-gradient(135deg, #ffe066 0%, #ff9e00 100%);

    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-full: 9999px;

    --shadow-main: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 35px rgba(255, 120, 0, 0.12);
}

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

body.admin-theme {
    min-height: 100vh;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

.font-cinzel {
    font-family: 'Cinzel', serif;
}

.font-mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Resplandor ambiental de fondo */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(255, 110, 0, 0.12) 0%, rgba(180, 40, 0, 0.05) 50%, rgba(11, 7, 20, 0) 80%);
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}

.admin-layout {
    position: relative;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem 1.5rem;
}

/* CABECERA */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 2.25rem;
    padding-bottom: 1.5rem;
    border-bottom: var(--border-subtle);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flame-brand-icon {
    font-size: 2.4rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(36, 18, 52, 0.7);
    border: var(--border-glow);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 25px rgba(255, 130, 0, 0.25);
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fffaf0;
    letter-spacing: 0.03em;
}

.brand-subtitle {
    color: var(--text-gold);
    font-size: 0.88rem;
    font-weight: 400;
}

.server-status-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(22, 13, 31, 0.8);
    border: var(--border-subtle);
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-offline {
    background-color: var(--flame-red);
    box-shadow: 0 0 10px var(--flame-red);
}

.status-divider {
    color: rgba(255, 255, 255, 0.2);
}

/* LAYOUT EN GRID */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: start;
}

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

/* TARJETAS GLASS */
.glass-card {
    background: var(--bg-card);
    border: var(--border-glow);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.75rem;
    box-shadow: var(--shadow-main);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.step-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-flame);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(255, 100, 0, 0.4);
    flex-shrink: 0;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.card-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* FORMULARIO */
.form-group {
    margin-bottom: 1.35rem;
}

.form-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.45rem;
}

.form-label.required::after {
    content: " *";
    color: var(--cempasuchil);
}

.label-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
}

.form-input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.2);
    background: rgba(22, 12, 34, 0.85);
}

.form-hint, .field-hint {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* DROPZONE DE AUDIO */
.file-hidden-input {
    display: none;
}

.file-dropzone {
    border: 2px dashed rgba(255, 170, 0, 0.35);
    background: rgba(18, 10, 28, 0.6);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.file-dropzone:hover, .file-dropzone.dragover {
    border-color: var(--amber);
    background: rgba(30, 16, 46, 0.75);
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.2);
}

.dropzone-icon {
    font-size: 2.2rem;
    margin-bottom: 0.4rem;
}

.dropzone-title {
    font-weight: 600;
    color: var(--text-gold);
    font-size: 0.95rem;
}

.dropzone-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.dropzone-pill {
    display: inline-block;
    margin-top: 0.75rem;
    background: rgba(255, 170, 0, 0.12);
    color: var(--amber);
    border: 1px solid rgba(255, 170, 0, 0.25);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
}

/* Archivo Seleccionado */
.file-selected-box {
    text-align: left;
}

.file-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(28, 16, 42, 0.9);
    border: 1px solid rgba(255, 170, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.file-icon {
    font-size: 1.5rem;
}

.file-details {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.76rem;
    color: var(--text-gold);
}

.btn-remove-file {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ff6b6b;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove-file:hover {
    background: rgba(255, 0, 0, 0.3);
}

.mini-audio-player {
    width: 100%;
    height: 36px;
    margin-top: 0.25rem;
}

/* Fila de Portada */
.cover-dropzone-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: rgba(18, 10, 28, 0.5);
    border: var(--border-subtle);
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.cover-preview-box {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 170, 0, 0.35);
    overflow: hidden;
    flex-shrink: 0;
    background: #140b1e;
}

.cover-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-input-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-subtle {
    background: rgba(36, 20, 52, 0.85);
    border: var(--border-glow);
    color: var(--text-gold);
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.btn-subtle:hover {
    background: rgba(52, 28, 76, 0.95);
    border-color: var(--amber);
}

.btn-text-danger {
    background: none;
    border: none;
    color: #ff8585;
    font-size: 0.76rem;
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
}

/* Barra de Progreso */
.upload-progress-container {
    margin-bottom: 1.25rem;
}

.progress-bar-wrap {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-flame);
    box-shadow: 0 0 10px rgba(255, 110, 0, 0.7);
    transition: width 0.2s ease;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-gold);
}

/* Botón de Envío Principal */
.btn-submit-main {
    width: 100%;
    background: var(--gradient-flame);
    color: #ffffff;
    border: none;
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 84, 0, 0.45);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-submit-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(255, 84, 0, 0.65);
}

.btn-submit-main:active {
    transform: translateY(0);
}

.btn-submit-main:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* TARJETA DE RESULTADO INSTANTÁNEO */
.result-card {
    border-color: rgba(255, 170, 0, 0.65);
    box-shadow: 0 15px 40px rgba(255, 120, 0, 0.25);
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.badge-success {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.85rem;
    border-radius: var(--radius-full);
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #fffaf0;
}

.result-dedication {
    font-size: 0.86rem;
    color: var(--text-gold);
    font-style: italic;
    margin-top: 0.2rem;
}

/* CAJA DE VISUALIZACIÓN DEL QR */
.qr-display-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.25rem;
}

.qr-canvas-wrapper {
    background: #ffffff;
    padding: 16px;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 180, 50, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qr-canvas-wrapper img, .qr-canvas-wrapper canvas {
    display: block;
    border-radius: 4px;
}

.qr-scan-instruction {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.65rem;
    text-align: center;
}

/* GRUPO DE COPIAR URL */
.url-copy-box {
    margin-bottom: 1.25rem;
}

.url-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    display: block;
}

.url-input-group {
    display: flex;
    gap: 0.5rem;
}

.btn-copy {
    background: rgba(38, 22, 54, 0.9);
    border: var(--border-glow);
    color: var(--text-gold);
    padding: 0 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--amber);
    color: #11081a;
}

/* ACCIONES DE RESULTADO */
.result-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-action-primary {
    background: var(--gradient-flame);
    color: #fff;
    border: none;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(255, 100, 0, 0.35);
}

.btn-action-primary:hover {
    box-shadow: 0 6px 20px rgba(255, 100, 0, 0.55);
    transform: translateY(-1px);
}

.btn-action-outline {
    background: rgba(30, 16, 44, 0.7);
    border: var(--border-glow);
    color: var(--text-gold);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-action-outline:hover {
    background: rgba(46, 24, 68, 0.9);
    border-color: var(--amber);
}

.btn-action-view {
    background: transparent;
    color: #fff;
    text-align: center;
    font-size: 0.84rem;
    padding: 0.5rem;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.btn-action-view:hover {
    opacity: 1;
    color: var(--amber);
}

/* HISTORIAL DE VELADORAS */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-count-badge {
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid rgba(255, 170, 0, 0.25);
    color: var(--text-gold);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
}

.tracks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.3rem;
}

.tracks-list::-webkit-scrollbar {
    width: 6px;
}
.tracks-list::-webkit-scrollbar-thumb {
    background: rgba(255, 170, 0, 0.25);
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 320px;
    margin: 0 auto;
}

/* FILA DE CANCIÓN */
.track-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(18, 10, 26, 0.7);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    transition: all 0.2s ease;
}

.track-row:hover {
    border-color: rgba(255, 170, 0, 0.35);
    background: rgba(28, 16, 42, 0.85);
}

.track-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.track-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    flex: 1;
    overflow: hidden;
}

.track-info-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-info-dedication {
    font-size: 0.78rem;
    color: var(--text-gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.track-info-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.1rem;
}

.badge-code {
    color: var(--amber);
}

.meta-dot {
    opacity: 0.5;
}

.track-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.btn-track-action {
    background: rgba(38, 22, 54, 0.85);
    border: var(--border-subtle);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-track-action:hover {
    background: var(--amber);
    color: #0b0714;
    border-color: var(--amber);
}

.btn-delete-track:hover {
    background: var(--flame-red);
    color: #fff;
    border-color: var(--flame-red);
}

/* MODAL DE CÓDIGO QR */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 4, 11, 0.82);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s ease;
}

.modal-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    text-align: center;
    border: var(--border-glow);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.modal-tag {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-gold);
    display: block;
    margin-bottom: 0.3rem;
}

.modal-title {
    font-size: 1.35rem;
    color: #fff;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-gold);
    font-style: italic;
    margin-top: 0.2rem;
}

.modal-qr-container {
    background: #ffffff;
    padding: 16px;
    border-radius: 18px;
    display: inline-flex;
    margin: 1.25rem auto;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

.modal-url {
    background: rgba(14, 8, 22, 0.8);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    color: var(--amber);
    word-break: break-all;
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-actions button {
    flex: 1;
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (Etiquetas de Veladoras)
   ========================================================================== */
@media print {
    body * {
        visibility: hidden !important;
    }
    #printStickerTemplate, #printStickerTemplate * {
        visibility: visible !important;
    }
    #printStickerTemplate {
        display: block !important;
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 7.5cm !important;
        height: 10cm !important;
        padding: 0.4cm !important;
        background: #ffffff !important;
        color: #000000 !important;
        box-sizing: border-box !important;
    }
    .sticker-frame {
        border: 2px solid #000000;
        border-radius: 8px;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 0.4cm;
        text-align: center;
        box-sizing: border-box;
    }
    .sticker-flower { font-size: 1.4rem; }
    .sticker-title { font-size: 1.1rem; font-weight: bold; margin: 0; }
    .sticker-dedication { font-size: 0.85rem; font-style: italic; margin: 0; }
    .sticker-instruction { font-size: 0.75rem; margin: 0; }
    .sticker-brand { font-size: 0.65rem; letter-spacing: 2px; font-weight: bold; }
    .sticker-qr-box img, .sticker-qr-box canvas {
        width: 4.2cm !important;
        height: 4.2cm !important;
    }
}
