/* =========================================
   VARIABLES — MODO CLARO
========================================= */

:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-text: #1a1a1a;

    --color-border: #e5e7eb;
    --color-border-light: #f1f5f9;
    --color-hover: #eef2f7;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;

    --radius: 6px;
    --radius-lg: 10px;

    --shadow-soft: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-strong: 0 4px 14px rgba(0,0,0,0.08);

    --font-main: "Inter", system-ui, sans-serif;

    --transition: 0.25s ease;
}

/* =========================================
   MODO OSCURO
========================================= */

body.dark-mode {
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-text: #f1f5f9;

    --color-border: #334155;
    --color-border-light: #475569;
    --color-hover: #2d3648;

    --color-primary: #4f7fc7;
    --color-primary-hover: #426dae;

    --shadow-soft: 0 2px 6px rgba(0,0,0,0.4);
    --shadow-strong: 0 6px 18px rgba(0,0,0,0.55);
}

/* =========================================
   ESTILOS BASE
========================================= */

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

main {
    width: 100%;
    padding: 32px 0;
}

/* =========================================
   CONTENEDORES (CORREGIDO)
========================================= */

.page-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 32px;
    box-sizing: border-box;
}

/* =========================================
   SECCIONES DE LA HOME (CENTRADAS)
========================================= */

.hero,
.tools-section,
.about-section {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 32px;
    box-sizing: border-box;
}

/* =========================================
   BOTONES GENERALES
========================================= */

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

button.primary {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
}

button.primary:hover {
    background: var(--color-primary-hover);
}

/* =========================================
   INPUTS Y SELECTS
========================================= */

input,
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    color: var(--color-text);
    font-size: 15px;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* =========================================
   TARJETAS / BOXES
========================================= */

.box,
.card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
}

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

/* =========================================
   FOOTER — CORREGIDO
========================================= */

.footer {
    width: 100%;
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 14px 0;
    color: var(--color-text);
}

.footer-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 32px;
    font-size: 14px;
}

/* =========================================
   ADS PLACEHOLDER
========================================= */

.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.ad-debug {
    width: 100%;
    max-width: 900px;
    height: 120px;
    border: 2px dashed var(--color-primary);
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 15px;
    opacity: 0.8;
}

.ad-top { margin-top: 16px; }
.ad-bottom { margin-bottom: 32px; }

body.dark-mode .ad-debug {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-bg);
}

/* =========================================
   BUY ME A COFFEE
========================================= */

.bmc-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

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

/* =========================================
   UTILIDADES
========================================= */

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* =========================================
   TOAST
========================================= */

#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    padding: 16px 22px;
    background: #ef4444;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 999999999;
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Toast de error */
#toast.error {
    background: #ef4444; /* rojo */
}

/* Toast de éxito */
#toast.success {
    background: #22c55e; /* verde */
}


/* =========================================
   BOTÓN FLOTANTE
========================================= */

.bmc-floating {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0.85;
    transition: all .2s ease;
    z-index: 99999;
}

.bmc-floating:hover {
    opacity: 1;
    transform: scale(1.08);
}

/* =========================================
   TOOLTIP
========================================= */

.bmc-tooltip {
    position: absolute;
    right: 60px;
    bottom: 50%;
    transform: translateY(50%);
    background: #facc15;
    color: #1a1a1a;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #eab308;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

/* Flecha */
.bmc-tooltip::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent transparent #facc15;
}

/* Mostrar tooltip con hover */
.bmc-floating:hover .bmc-tooltip {
    opacity: 1;
    transform: translateY(50%) translateX(-4px);
}

/* Mostrar tooltip automáticamente (sin hover) */
.bmc-tooltip.show {
    opacity: 1;
    transform: translateY(50%) translateX(-4px);
    pointer-events: auto;
}

@media (max-width: 768px) {
    .bmc-floating {
        display: none !important;
        right: auto;
        left: 50%;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
        transform: translateX(-50%);
        opacity: 0;
        pointer-events: none;
    }

    .bmc-floating:hover {
        transform: translateX(-50%);
    }

    .bmc-floating.is-footer-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .bmc-tooltip {
        display: none;
    }
}
