/**
 * Brands Dashboard - Diseño Premium
 * Fondo cálido + Cards con color del sistema
 */

/* ============================================
   VARIABLES (paleta global)
   ============================================ */
:root {
    /* Fondo cálido (gradientes de marca, se mantienen) */
    --brand-warm-1: #D4754E;
    --brand-warm-2: #C86B45;
    --brand-warm-3: #B85D3A;
    --brand-warm-4: #8B4332;
    --brand-warm-5: #5C2D22;
    
    /* Texto e iconos: paleta global */
    --brand-text-light: var(--text-primary);
    --brand-text-gold: var(--text-primary);
    --brand-text-muted: var(--text-muted);
}

/* ============================================
   CONTENEDOR PRINCIPAL
   El offset del sidebar lo aplica #app-container; este contenedor solo rellena su área.
   ============================================ */
.brand-dashboard-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: var(--brand-warm-4);
    transition: left 0.3s ease;
    padding-top: 48px; /* Espacio para header transparente */
}

/* ============================================
   MODO SECUNDARIO: INFO EXPANDIDO
   ============================================ */
.brand-dashboard-container {
    transition: padding 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brand-dashboard-container.info-mode-secondary {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: calc(48px + 15px) 15px 15px 15px !important; /* Respeta header principal (48px) + padding */
    padding-left: max(15px, env(safe-area-inset-left)) !important;
    padding-right: max(15px, env(safe-area-inset-right)) !important;
    padding-bottom: max(15px, env(safe-area-inset-bottom)) !important;
    transition: padding 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: padding;
    min-height: 100%;
    box-sizing: border-box;
}

/* Ocultar elementos del modo principal cuando está en modo secundario */
.brand-dashboard-container.info-mode-secondary .brand-cards-zone,
.brand-dashboard-container.info-mode-secondary .brand-corner-bottom-left {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
    will-change: opacity, transform;
}

/* Asegurar que elementos vuelvan a ser visibles cuando NO está en modo secundario */
.brand-dashboard-container:not(.info-mode-secondary) .brand-cards-zone,
.brand-dashboard-container:not(.info-mode-secondary) .brand-corner-bottom-left {
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s,
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
    will-change: opacity, transform;
}


@media (max-width: 768px) {
    .brand-dashboard-container {
        left: 0;
    }
}

/* ============================================
   FONDO CON GRADIENTE
   Cuando hay colores de marca (brand_colors), BrandsView aplica el mismo
   degradado inteligente que HogarView (organización) vía inline style.
   Sin colores, se usa este degradado estático (fallback).
   ============================================ */
.brand-dashboard-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.background-gradient {
    position: absolute;
    inset: 0;
    /* Fallback cuando no hay colores de marca; JS sobrescribe con degradado dinámico si hay brand_colors */
    background: 
        radial-gradient(ellipse 150% 100% at 10% 60%, var(--brand-warm-1) 0%, transparent 50%),
        radial-gradient(ellipse 120% 80% at 60% 20%, var(--brand-warm-2) 0%, transparent 45%),
        radial-gradient(ellipse 100% 150% at 30% 90%, var(--brand-warm-3) 0%, transparent 50%),
        linear-gradient(145deg, var(--brand-warm-4) 0%, var(--brand-warm-5) 100%);
}

/* Textura removida - era pesada para GPU */
.background-texture {
    display: none;
}

/* ============================================
   FONDO: solo el fondo usa skeleton; transición fluida por crossfade
   ============================================ */
.background-skeleton {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--bg-primary);
    transition: opacity 1.15s cubic-bezier(0.33, 0, 0.2, 1);
}
.background-gradient {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.15s cubic-bezier(0.33, 0, 0.2, 1);
}
.brand-dashboard-container.brands-background-ready .background-skeleton {
    opacity: 0;
    pointer-events: none;
}
.brand-dashboard-container.brands-background-ready .background-gradient {
    opacity: 1;
}

/* Entrada suave del contenido al pintar */
.brand-dashboard-container .brand-corner-bottom-left,
.brand-dashboard-container .brand-cards-zone {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.brand-dashboard-container.brands-ready .brand-corner-bottom-left,
.brand-dashboard-container.brands-ready .brand-cards-zone {
    opacity: 1;
    transform: translateY(0);
}
.brand-dashboard-container.brands-ready .brand-cards-zone .brand-card {
    animation: brands-card-fade-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
.brand-dashboard-container.brands-ready .brand-cards-zone .brand-card:nth-child(1) { animation-delay: 0.05s; }
.brand-dashboard-container.brands-ready .brand-cards-zone .brand-card:nth-child(2) { animation-delay: 0.12s; }
.brand-dashboard-container.brands-ready .brand-cards-zone .brand-card:nth-child(3) { animation-delay: 0.19s; }
@keyframes brands-card-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   WIDGETS ELIMINADOS - Forzar ocultación
   ============================================ */
.brand-corner-top-left,
.brand-realtime-row,
.brand-realtime-clock,
.team-avatars-floating,
[class*="asc:"],
[class*="realtime"],
[class*="real-time"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ============================================
   FOOTER - MARCA + INFO (esquina inferior)
   ============================================ */
.brand-corner-bottom-left {
    position: absolute;
    bottom: 2rem;
    left: 2.5rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Header: redes/web arriba; nombre de marca abajo, todo a la izquierda */
.brand-main-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.brand-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-name-large {
    font-size: 6rem !important;
    font-weight: 700;
    color: var(--brand-text-light);
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1;
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
    animation: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -o-animation: none !important;
    will-change: auto !important;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -o-transform: none !important;
    scale: 1 !important;
    -webkit-scale: 1 !important;
    zoom: 1 !important;
}

/* Asegurar tamaño GRANDE en el contenedor exacto (override a base.css) */
#brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large,
#brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:hover,
#brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:active,
#brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:focus {
    font-size: 6rem !important;
    line-height: 1 !important;
    letter-spacing: -0.02em !important;
}

/* Eliminar hover del nombre de marca - REGLAS MÁS ESPECÍFICAS */
.brand-name-large:hover,
.brand-name-large.editable-field:hover,
.brand-name-large[contenteditable="true"]:hover,
h1.brand-name-large:hover,
h1.brand-name-large.editable-field:hover,
h1.brand-name-large[contenteditable="true"]:hover,
.brand-name-row:hover .brand-name-large,
.brand-main-info:hover .brand-name-large,
.brand-corner-bottom-left:hover .brand-name-large {
    background: transparent !important;
    border-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    max-width: none !important;
    min-height: auto !important;
    max-height: none !important;
    scale: 1 !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
}

/* Status dot - sin animación para evitar problemas de rendimiento */
.brand-status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ADE80;
}

/* Lista de URLs editables (header arriba a la izquierda, poco espacio entre ítems) */
.brand-links-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand-link-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
}

.brand-link-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Mismo estilo que el título: sin fondo, sin bordes; mostrar toda la URL */
.brand-link-input {
    flex: 1;
    min-width: 14rem;
    max-width: 100%;
    padding: 0.25rem 0;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    color: var(--brand-text-light);
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: hidden;
    text-overflow: unset;
}

.brand-link-input::placeholder {
    color: var(--brand-text-muted);
}

.brand-link-input:hover,
.brand-link-input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none;
}

/* Mercado objetivo debajo */
.brand-market-row {
    margin-top: 0.25rem;
}

.market-label {
    font-size: 0.75rem;
    color: var(--brand-text-muted);
}

/* ============================================
   CARDS - USANDO COLORES DEL SISTEMA
   ============================================ */
.brand-cards-zone {
    position: absolute;
    top: calc(48px + 1.5rem); /* Respeta el header principal (48px) + espacio */
    right: 1.5rem;
    bottom: 1.5rem;
    width: 380px;
    z-index: 1010; /* Por encima del header principal (z-index: 1000) */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    scrollbar-width: none;
    transition: bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-dashboard-container.info-expanded .brand-cards-zone {
    bottom: 1.5rem;
    min-height: auto;
}

.brand-cards-zone::-webkit-scrollbar {
    width: 0;
}

/* Card base - usa paleta global */
.brand-card {
    background: var(--bg-card) !important;
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
    border: 1px solid var(--border-color) !important;
    cursor: default !important;
    transition: none !important;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-text-gold);
    margin: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card-arrow {
    color: var(--brand-text-gold);
    font-size: 0.875rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.card-arrow:hover {
    transform: translateX(3px);
}

.card-arrow-sub {
    color: var(--icon-button);
    font-size: 0.75rem;
    text-decoration: none;
    margin-top: 0.25rem;
    display: inline-block;
}

/* Icono grid */
.card-icon-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-divider);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-button);
    padding: 5px;
}

.card-icon-circle svg {
    width: 100%;
    height: 100%;
}

/* Card content */
.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-spacer {
    height: 1.5rem;
}

.card-current {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.current-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.current-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-stats {
    margin-top: 0.5rem;
    text-align: right;
}

.stats-value {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Progress bar */
.card-progress {
    margin-top: 0.5rem;
    text-align: right;
}

.progress-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #C44536;
    width: 0%;
    transition: width 0.5s ease;
}

.card-footer {
    margin-top: 1rem;
    text-align: right;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   CARDS ESPECÍFICAS
   ============================================ */

/* INFO - Barra interactiva (color contenedores interactivos) */
.card-info {
    min-height: 50px;
    padding: 1rem 1.25rem;
    cursor: pointer !important;
    transition: none !important;
    overflow: hidden;
    background: var(--bg-interactive) !important;
    border: 1px solid var(--border-color) !important;
}

.card-info:hover {
    background: var(--bg-hover) !important;
}

.card-info .card-header {
    align-items: center;
    position: relative;
    justify-content: space-between !important;
}

/* Ocultar flecha cuando INFO está expandido */
.card-info.expanded .card-arrow {
    display: none !important;
}

/* Botón cerrar en header */
.info-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    padding: 0;
}

.info-close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* INFO expandida - Modo secundario (adaptado a todas las pantallas) */
.brand-dashboard-container.info-mode-secondary .card-info.expanded,
#brandsListContainer > div.brand-card.card-info.expanded {
    position: relative !important;
    width: 100% !important;
    max-width: min(960px, 100%) !important; /* Ancho máximo en pantallas grandes, 100% en móvil */
    min-width: 0 !important;
    min-height: calc(100vh - 48px - 30px);
    min-height: calc(100dvh - 48px - 30px);
    height: calc(100vh - 48px - 30px);
    height: calc(100dvh - 48px - 30px);
    max-height: calc(100dvh - 48px - 30px);
    padding: 1.25rem;
    margin: 0 auto !important;
    margin-bottom: 15px !important;
    z-index: 1010;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s,
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
    will-change: opacity, transform;
}

/* Contenedor del panel INFO: se adapta al espacio disponible y hace scroll */
.card-info.expanded .card-content-expanded,
#infoPanelContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeInContent 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s both;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--icon-button) transparent;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    will-change: opacity, transform;
}

.card-info.expanded .card-content-expanded::-webkit-scrollbar {
    width: 8px;
}

.card-info.expanded .card-content-expanded::-webkit-scrollbar-track {
    background: transparent;
}

.card-info.expanded .card-content-expanded::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.card-info.expanded .card-content-expanded::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contenido expandido */
.card-content-expanded {
    display: none;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: var(--icon-button) transparent;
}

.card-content-expanded::-webkit-scrollbar {
    width: 8px;
}

.card-content-expanded::-webkit-scrollbar-track {
    background: transparent;
}

.card-content-expanded::-webkit-scrollbar-thumb {
    background: var(--icon-button);
    border-radius: 4px;
}

.card-content-expanded::-webkit-scrollbar-thumb:hover {
    background: var(--accent-yellow-hover);
}

/* INFO: quitar padding/border/margin inferior del div interno (card-header) */
#brandsListContainer > div.brand-cards-zone > div.brand-card.card-info > div {
    padding: 0 !important;
    border: 0 !important;
    margin-bottom: 0 !important;
}

/* Visual de marca (antes CONCEPT LAB) */
.card-concept {
    min-height: 200px;
}

/* Ocultar elementos antiguos de CONCEPT LAB si quedan */
.card-concept .card-arrow-sub,
.card-concept .card-spacer,
.card-concept .card-current,
.card-concept .current-label,
.card-concept .current-value,
.card-concept .card-stats,
.card-concept .stats-value {
    display: none !important;
}

/* Secciones visuales */
.visual-section {
    margin-bottom: 1.25rem;
}

.visual-section:last-of-type {
    margin-bottom: 0;
}

.visual-section-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    position: relative;
    cursor: default;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.05);
}

/* Circulito eliminar: solo visible al hover del swatch; sobresale en la esquina derecha */
.color-delete-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s ease, transform 0.15s ease, background 0.15s ease;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

.color-swatch:hover .color-delete-btn {
    opacity: 1;
    pointer-events: auto;
}

.color-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

/* Botón agregar color (máx 4 colores) */
.color-swatch-add-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.color-swatch-add-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.color-swatch-add-btn span {
    font-size: 1.25rem;
    line-height: 1;
}

/* ============================================
   EDITOR DE COLOR (modal: rueda tono + SL + hex + formato)
   ============================================ */
.color-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.color-editor-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow-floating);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
}

.color-editor-wheel-wrap {
    position: relative;
}

.color-editor-hue-ring {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    position: relative;
    cursor: crosshair;
}

.color-editor-sl-area {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    cursor: crosshair;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.color-editor-sl-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.color-editor-hue-handle {
    position: absolute;
    top: -6px;
    left: 50%;
    margin-left: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.color-editor-current {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.color-editor-hex-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-editor-hex-input {
    width: 100px;
    padding: 0.4rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-primary);
}

.color-editor-format {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-primary);
    cursor: pointer;
}

.color-editor-actions {
    display: flex;
    gap: 0.5rem;
}

.color-editor-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.color-editor-btn-apply {
    background: var(--bg-interactive);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.color-editor-btn-cancel {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Typography Preview */
.typography-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.typography-font-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.typography-samples {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.typography-sample {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.typography-sample.heading {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.typography-sample.body {
    font-weight: 400;
}

/* Separador */
.visual-separator {
    height: 1px;
    background: var(--border-divider);
    margin: 1rem 0;
}

/* System Status */
.visual-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: 0.5rem;
}

.visual-status-synced {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.visual-status-synced::before {
    content: '✔';
    color: #4ADE80;
    font-size: 0.625rem;
}

/* Archivos de identidad (antes Featured Products/EVENTS) */
.card-identity {
    min-height: 160px;
}

.identity-files {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.identity-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.identity-file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.identity-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.identity-file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-file-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.identity-file-empty {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0;
}

.identity-file-empty-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.identity-file-empty-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.identity-cta {
    margin-top: 1rem;
    text-align: right;
}

.identity-cta-link {
    font-size: 0.75rem;
    color: var(--icon-button);
    text-decoration: none;
    transition: opacity 0.2s;
}

/* Botón Subir archivo (contenedor interactivo) */
.file-upload-btn {
    margin-top: 1rem !important;
    padding: 0.5rem 1rem !important;
    background: var(--bg-interactive) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: background 0.2s ease, border-color 0.2s ease !important;
}

.file-upload-btn:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-light) !important;
}

.file-upload-btn i {
    color: var(--icon-button) !important;
}

.identity-cta-link:hover {
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .brand-cards-zone {
        width: 340px;
    }
    .brand-name-large {
        font-size: 5rem !important;
    }
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:hover,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:active,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:focus {
        font-size: 5rem !important;
    }
}

@media (max-width: 900px) {
    .brand-cards-zone {
        width: 300px;
    }
    .brand-name-large {
        font-size: 4.25rem !important;
    }
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:hover,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:active,
    #brandsListContainer .brand-corner-bottom-left .brand-main-info .brand-name-row .brand-name-large:focus {
        font-size: 4.25rem !important;
    }
    .brand-main-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .brand-dashboard-container {
        position: relative;
        top: 0;
        min-height: calc(100vh - 48px);
        overflow-y: auto;
    }
    .brand-corner-bottom-left {
        position: relative;
        padding: 1.5rem;
    }
    .brand-cards-zone {
        position: relative;
        width: 100%;
        padding: 1rem;
    }
}

/* ============================================
   CONTENIDO EXPANDIDO DE INFO
   ============================================ */

/* Secciones del contenido expandido */
.card-content-expanded .info-section {
    margin-bottom: 2.5rem;
}

.card-content-expanded .info-section:last-child {
    margin-bottom: 0;
}

.card-content-expanded .info-section-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin: 0 0 1.25rem 0;
}

.card-content-expanded .info-section-content {
    color: var(--text-primary);
}

/* Sección de identidad - sin fondo, sin bordes */
.card-content-expanded .info-section-identity {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 2.5rem;
}

/* Fila: logo + redes/web (junto al logo) */
.card-content-expanded .info-identity-row {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Contenedor de logo - circular, input encima para subir */
.card-content-expanded .info-identity-row .info-logo-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
}

.card-content-expanded .info-logo-container .info-logo-input {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.card-content-expanded .info-logo-container .info-logo-preview,
.card-content-expanded .info-logo-container .info-logo-placeholder {
    pointer-events: none;
}

.card-content-expanded .info-logo-container .info-logo-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--bg-interactive);
    border: 1px dashed var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 3rem;
}

.card-content-expanded .info-logo-container .info-logo-placeholder.visible {
    display: flex;
}

/* Redes y web dentro de INFO (junto al logo) */
.card-content-expanded .info-links-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 200px;
}

.card-content-expanded .info-links-list .brand-link-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}

.card-content-expanded .info-links-list .brand-link-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.card-content-expanded .info-links-list .brand-link-input {
    flex: 1;
    min-width: 10rem;
    padding: 0.2rem 0;
    font-size: inherit;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent !important;
    border: none !important;
    outline: none;
    box-shadow: none;
    overflow-x: auto;
    text-overflow: unset;
}

.card-content-expanded .info-links-list .brand-link-input::placeholder {
    color: var(--text-muted);
}

/* Lista de redes (brand_social_links): múltiples por plataforma */
.brand-social-links-list {
    list-style: none;
    margin: 0 0 0.75rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.brand-social-links-list .brand-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

/* URL como input editable (no enlace ni redirección) */
.brand-social-links-list .brand-link-url-input {
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0.4rem;
    font-size: inherit;
    color: var(--text-primary);
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    outline: none;
}

.brand-social-links-list .brand-link-url-input:focus {
    border-color: rgba(255,255,255,0.3);
}

.brand-social-links-list .brand-link-platform-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.brand-social-links-list .brand-link-btn-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.8rem;
}

.brand-social-links-list .brand-link-btn-delete:hover {
    color: var(--text-primary);
}

.brand-social-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.brand-social-platform-select {
    min-width: 120px;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.2);
    color: var(--text-primary);
}

.brand-social-url-input {
    flex: 1;
    min-width: 140px;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.2);
    color: var(--text-primary);
}

.brand-link-btn-add {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    cursor: pointer;
}

.brand-link-btn-add:hover {
    background: rgba(255,255,255,0.15);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Grid de secciones (Esencia y Lenguaje) */
.card-content-expanded .info-sections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
    .card-content-expanded .info-sections-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

.card-content-expanded .info-identity-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-content-expanded .info-identity-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.card-content-expanded .info-identity-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.card-content-expanded .info-logo-container .info-logo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}


/* Campos de información */
.card-content-expanded .info-field {
    margin-bottom: 1.5rem;
}

.card-content-expanded .info-field:last-child {
    margin-bottom: 0;
}

.card-content-expanded .info-field-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.card-content-expanded .info-field-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Inputs de INFO - contenedores interactivos #201D26 */
.card-content-expanded .info-field-value.editable-field {
    display: block;
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    background: var(--bg-interactive) !important;
    color: var(--text-primary) !important;
    min-height: 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.card-content-expanded .info-field-value.editable-field:hover,
.card-content-expanded .info-field-value.editable-field:active,
.card-content-expanded .info-field-value.editable-field:focus,
.card-content-expanded .info-field-value.editable-field[contenteditable="true"]:hover,
.card-content-expanded .info-field-value.editable-field[contenteditable="true"]:active,
.card-content-expanded .info-field-value.editable-field[contenteditable="true"]:focus {
    background: var(--bg-hover) !important;
    border: 1px solid var(--border-color) !important;
    padding: 0.75rem 1rem !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Select y multiselect dentro de INFO - contenedores interactivos */
.card-content-expanded .editable-select,
.card-content-expanded .info-field-value select {
    width: 100% !important;
    padding: 0.5rem 0.75rem !important;
    background: var(--bg-interactive) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    color: var(--text-primary) !important;
    font-size: 0.875rem !important;
}

.card-content-expanded .multiselect-trigger {
    background: var(--bg-interactive) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.card-content-expanded .multiselect-trigger:hover,
.card-content-expanded .multiselect-trigger.open {
    background: var(--bg-hover) !important;
    border-color: var(--border-light) !important;
    box-shadow: none !important;
}

.card-content-expanded .multiselect-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
}

.card-content-expanded .multiselect-option:hover {
    background: var(--bg-hover) !important;
}

.card-content-expanded .multiselect-option.selected {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

.card-content-expanded .multiselect-tag {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

/* Tags editables (Objetivos, Palabras a evitar) */
.card-content-expanded .editable-tag {
    padding: 0.25rem 0.5rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
}

.card-content-expanded .editable-tag-remove {
    cursor: pointer;
    margin-left: 0.25rem;
    color: var(--icon-button);
}

.card-content-expanded .editable-tag-remove:hover {
    color: var(--text-primary);
}

/* Input "+ Agregar" en multiselect dentro de INFO */
.card-content-expanded .editable-tag-input {
    padding: 0.25rem 0.5rem !important;
    background: var(--bg-interactive) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    color: var(--text-primary) !important;
}

.card-content-expanded .editable-tag-input::placeholder {
    color: var(--text-muted);
}

.card-content-expanded .editable-tag-input:focus {
    outline: none;
    border-color: var(--border-light) !important;
    background: var(--bg-hover) !important;
}

.card-content-expanded .info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-content-expanded .info-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-primary);
}

.card-content-expanded .info-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--icon-button);
    font-weight: bold;
}

.card-content-expanded .info-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
    margin: 0;
}

/* ============================================
   CAMPOS EDITABLES
   ============================================ */

/* Reglas de .editable-field heredan de base.css - sin duplicación */


/* Responsive: panel INFO y card expandida en pantallas pequeñas */
@media (max-width: 768px) {
    .brand-dashboard-container.info-mode-secondary {
        padding: calc(48px + 10px) 10px 10px 10px !important;
        padding-left: max(10px, env(safe-area-inset-left)) !important;
        padding-right: max(10px, env(safe-area-inset-right)) !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }

    .brand-dashboard-container.info-mode-secondary .card-info.expanded,
    #brandsListContainer > div.brand-card.card-info.expanded {
        width: 100% !important;
        max-width: 100% !important;
        min-height: min(500px, calc(100dvh - 48px - 24px));
        max-height: calc(100dvh - 48px - 24px);
        padding: 1rem;
    }

    .card-info.expanded .card-content-expanded,
    #infoPanelContent {
        margin-top: 1rem;
    }

    .card-content-expanded .info-identity-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}
