/* ============================================================
   index-page.css
   Estilos estáticos para index.php (extraídos del bloque inline)
   Las variables dinámicas (colores, fuentes desde BD) se mantienen
   en el <style> inline de index.php como PHP puro.
   ============================================================ */

/* ─── Layout principal ─────────────────────────────────────── */
body {
    font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

/* ─── Utilities de radio dinámico ───────────────────────────── */
.card {
    border-radius: var(--radius-custom, 16px);
}

.btn {
    border-radius: calc(var(--radius-custom, 16px) / 2);
}

/* ─── Animaciones del CMS Transition Engine ─────────────────── */
@keyframes dissolve {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-slide {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes wipe {
    from { opacity: 0; clip-path: inset(0 100% 0 0); }
    to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes flash {
    0%   { opacity: 0;   filter: brightness(3) contrast(1.5); }
    50%  { opacity: 0.8; filter: brightness(2) contrast(1.2); }
    100% { opacity: 1;   filter: brightness(1) contrast(1); }
}

.animate-in {
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Preview classes — permiten forzar una transición concreta desde el editor */
body.trans-dissolve  .animate-in, [data-animation="dissolve"]  { animation-name: dissolve   !important; opacity: 1 !important; }
body.trans-fade-slide .animate-in,[data-animation="fade-slide"]{ animation-name: fade-slide !important; opacity: 1 !important; }
body.trans-wipe      .animate-in, [data-animation="wipe"]      { animation-name: wipe       !important; opacity: 1 !important; }
body.trans-flash     .animate-in, [data-animation="flash"]     { animation-name: flash      !important; opacity: 1 !important; }
body.trans-none      .animate-in, [data-animation="none"]      { animation: none            !important; opacity: 1 !important; }

/* Forzar visibilidad para elementos con animación individual */
[data-animation]:not([data-animation="none"]) {
    opacity: 0;
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-cms-key],
.btn,
.card {
    transition: all 0.3s ease;
}

/* ─── CMS Editor: Hover / Selected Outlines ─────────────────── */
.cms-hover-outline {
    outline: 2px dashed #3b82f6 !important;
    cursor: pointer !important;
}

.cms-selected-outline {
    outline: 2px solid #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2) !important;
    position: relative !important;
}

/* ─── CMS Resize Handles ────────────────────────────────────── */
.cms-resize-handle {
    position: absolute;
    background: white;
    border: 2px solid #3b82f6;
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.cms-resize-handle:hover {
    transform: scale(1.2);
    background: #3b82f6;
}

/* Corners */
.cms-handle-tl, .cms-handle-tr, .cms-handle-bl, .cms-handle-br {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.cms-handle-tl { top: -6px; left: -6px;   cursor: nwse-resize; }
.cms-handle-tr { top: -6px; right: -6px;  cursor: nesw-resize; }
.cms-handle-bl { bottom: -6px; left: -6px;  cursor: nesw-resize; }
.cms-handle-br { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Sides */
.cms-handle-t, .cms-handle-b { width: 20px; height: 6px; border-radius: 3px; }
.cms-handle-l, .cms-handle-r { width: 6px; height: 20px; border-radius: 3px; }

.cms-handle-t { top: -4px;    left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.cms-handle-b { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.cms-handle-l { left: -4px;   top: 50%;  transform: translateY(-50%); cursor: ew-resize; }
.cms-handle-r { right: -4px;  top: 50%;  transform: translateY(-50%); cursor: ew-resize; }

/* ─── CMS Floating Toolbar ──────────────────────────────────── */
@keyframes toolbar-pop {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

#cms-floating-toolbar {
    position: fixed;
    z-index: 2147483647;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 99px;
    padding: 6px 12px;
    display: none;
    align-items: center;
    gap: 4px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1);
    pointer-events: auto;
    animation: toolbar-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}

.cms-tool-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cms-tool-btn:hover  { background: rgba(59, 130, 246, 0.2); color: #3b82f6; transform: translateY(-2px); }
.cms-tool-btn:active { transform: scale(0.9); }
.cms-tool-btn.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); }

.cms-zoom-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    height: 40px;
}

.cms-zoom-control input[type="range"] {
    width: 100px;
    cursor: pointer;
    accent-color: var(--primary);
}

.cms-zoom-val {
    font-size: 0.75rem;
    color: white;
    width: 35px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.cms-tool-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 6px;
}

.cms-drag-handle         { cursor: grab;    color: rgba(255, 255, 255, 0.4); }
.cms-drag-handle:active  { cursor: grabbing; }

.cms-font-select {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
    width: 120px;
    margin: 0 4px;
}

.cms-font-select option { background: #0f172a; color: white; }

.cms-ghost {
    opacity: 0.4;
    background: var(--primary-glow) !important;
    border: 2px dashed var(--primary) !important;
}

/* ─── Utilities extra ───────────────────────────────────────── */
:root {
    --glass-blur: blur(25px);
    --glass-grad: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.premium-glass {
    background: var(--glass-grad) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--glass-border) !important;
}

/* ─── Plan Cards ────────────────────────────────────────────── */
#planes {
    position: relative;
    z-index: 10;
    margin-top: 6rem;
    padding-top: 1rem;
}

#planes .plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

#planes .plan-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 1.2rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
    padding: 1.9rem;
    min-height: 520px;
    color: #0f172a;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

#planes .plan-card h3     { font-size: 2rem;  margin-bottom: 0.8rem; font-weight: 800; color: #0e1f3d; }
#planes .plan-card .plans-price { font-size: 3rem; font-weight: 900; }
#planes .plan-card ul li  { margin-bottom: 0.9rem; font-size: 1rem; }

#planes .plan-card-recommended {
    border-color: var(--primary) !important;
    transform: scale(1.015);
}

#planes .plan-badge {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 0.6rem 0;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
    color: #fff;
    background: var(--primary);
    border-top-left-radius: 1.2rem;
    border-top-right-radius: 1.2rem;
    z-index: 12;
}

#planes + section { margin-top: 5rem; position: relative; z-index: 1; }

#planes-rates        { margin-top: 5rem; position: relative; z-index: 1; }
#planes-rates .card  { position: relative; z-index: 1; }

/* Plan card hover */
.plan-card:hover {
    background: #0f172a !important;
    color: #ffffff !important;
    transform: translateY(-6px) !important;
    box-shadow: 0 26px 52px rgba(0, 0, 0, 0.25);
}

.plan-card:hover h3,
.plan-card:hover span,
.plan-card:hover li      { color: #ffffff !important; }

.plan-card:hover .plan-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #ffffff !important;
}

.plan-card:hover .plan-btn-primary { background: #ffffff !important; color: var(--primary) !important; }
.plan-card:hover .plan-icon        { color: #ffffff !important; }

/* ─── Desktop Hero Section ──────────────────────────────────── */
/* Hidden on small screens — the original mobile layout takes over */
@media (max-width: 860px) {
    #desktop-hero { display: flex !important; flex-direction: column !important; gap: 3rem !important; padding: 2rem 0 !important; text-align: center; align-items: center; }
    #desktop-hero > div { width: 100% !important; max-width: 100% !important; min-width: 100% !important; }
    #desktop-hero h1 { margin-inline: auto !important; }
    #desktop-hero p { margin-inline: auto !important; }
    #desktop-hero div[style*="flex-wrap: wrap"] { justify-content: center !important; }
}

/* Light-mode overrides for the desktop hero */
body.light-mode #desktop-hero .card  { background: #ffffff !important; }
body.light-mode #desktop-hero h1     { color: #0f172a !important; }
body.light-mode #desktop-hero p      { color: #64748b !important; }
body.light-mode #desktop-hero span   { color: inherit; }

body.light-mode #desktop-hero a[href*="tiktok"] {
    background: rgba(0,0,0,0.04) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

body.light-mode #desktop-hero a span { color: #0f172a !important; }

/* ─── Responsive — Medium screens ──────────────────────────── */
@media (max-width: 1024px) {
    #planes .plan-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
    }
}

/* ─── Responsive — Tablet / Mobile ─────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem;
    }

    .nav {
        padding: 0.85rem 1.25rem;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center;
        gap: 0.5rem;
        height: 70px !important;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(6, 9, 18, 0.8);
        backdrop-filter: blur(20px);
    }

    .logo-img { height: 35px !important; }
    .logo-main    { font-size: 1.1rem !important; }
    .logo-subtext { display: none; }

    .nav-actions          { width: auto; gap: 0.5rem !important; }
    .nav-actions .btn-sm  { padding: 6px 10px; font-size: 0.7rem; border-radius: 8px; }
    #theme-toggle { width: 34px !important; height: 34px !important; }
    .nav-actions [href*="notifications"] { width: 34px !important; height: 34px !important; }

    /* Tipografía fluida */
    h1 { font-size: 2.2rem !important; line-height: 1.1 !important; }
    h2 { font-size: 1.6rem !important; margin-bottom: 1rem !important; }
    p  { font-size: 0.9rem !important; }

    /* Hero secodario (app-hero) */
    .app-hero {
        padding: 3rem 1.5rem !important;
        margin-top: 1rem !important;
        text-align: center;
        border-radius: calc(var(--radius-custom, 16px) / 1.5);
    }

    .app-hero h1 { font-size: 2.5rem !important; }

    /* Founder */
    #founder              { margin-top: 4rem !important; }
    #founder .card        { padding: 1.5rem !important; text-align: center; }
    #founder .card > div  { flex-direction: column !important; gap: 2rem !important; }

    .founder-img-container { width: 100% !important; height: 280px !important; margin-top: 1rem; }

    /* Planes */
    #planes               { margin-top: 5rem !important; }
    #planes .plan-grid    { grid-template-columns: 1fr !important; gap: 1.5rem !important; padding: 0 0.5rem; }
    .plan-card            { min-height: auto !important; padding: 2rem !important; }

    /* Grids apilables */
    .explore-grid,
    .grid-2-cols,
    .grid-3-cols,
    [style*="display: grid;"] {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* Greeting + QR */
    #cms-greeting-wrapper { flex-direction: column !important; text-align: center; align-items: center !important; }
    #cms-qr-card          { width: 100% !important; flex-direction: row !important; padding: 1rem !important; max-width: 300px; }

    /* Toolbar responsivo */
    #cms-floating-toolbar {
        max-width: calc(100vw - 16px) !important;
        border-radius: 24px !important;
        padding: 6px 10px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    #cms-floating-toolbar .cms-tool-btn                         { width: 32px !important; height: 32px !important; }
    #cms-floating-toolbar .cms-tool-divider                     { display: none !important; }
    #cms-floating-toolbar .cms-zoom-control                     { padding: 0 10px !important; height: 34px !important; }
    #cms-floating-toolbar .cms-zoom-control input[type="range"] { width: 70px !important; }
    #cms-floating-toolbar .cms-zoom-val                         { width: 30px !important; }
    #cms-floating-toolbar .cms-font-select                      { width: 95px !important; }
}

/* ─── Responsive — Phone (≤ 480px) ─────────────────────────── */
@media (max-width: 480px) {
    .nav {
        padding: 0.75rem 1rem !important;
    }

    .nav-actions .btn-sm span { display: none; } /* Hide text "Perfil" if needed, but let's keep it for now if it fits */
    .nav-actions .btn-sm { min-width: 40px; justify-content: center; }

    h1 { font-size: 1.8rem !important; }
    .app-hero h1 { font-size: 2rem !important; }
    
    .card { padding: 1.25rem !important; }
    
    #cms-greeting-wrapper { 
        padding: 1.5rem !important;
        margin-top: 1rem !important;
    }
    
    #cms-qr-card {
        padding: 1rem !important;
        max-width: 100% !important;
    }
    #cms-floating-toolbar {
        padding: 6px 8px !important;
        border-radius: 20px !important;
        gap: 4px !important;
    }

    #cms-floating-toolbar .cms-zoom-control {
        width: 100% !important;
        justify-content: center;
        margin-top: 2px;
    }
}
