/* MODAL DE PUBLICIDAD */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at top, rgba(102, 126, 234, 0.24), transparent 38%),
        radial-gradient(circle at bottom right, rgba(118, 75, 162, 0.2), transparent 34%),
        rgba(8, 15, 30, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeInModal 0.35s ease-out;
    backdrop-filter: blur(10px);
    padding: 18px; /* Added padding for smaller screens */
}

.modal-content {
    width: min(600px, calc(100vw - 36px)); /* Reduced max-width */
    max-height: 80vh; /* Reduced max-height to encourage fit */
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.35);
    background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(248,250,252,0.99) 100%);
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.35);
    position: relative;
    animation: modalShellIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-content::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 120px; /* Reduced height */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.16) 0%, rgba(118, 75, 162, 0.08) 55%, transparent 100%);
    pointer-events: none;
}

.modal-close {
    position: absolute;
    top: 12px; /* Adjusted position */
    right: 12px; /* Adjusted position */
    width: 36px; /* Slightly smaller button */
    height: 36px; /* Slightly smaller button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(203, 213, 225, 0.85);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    border-radius: 50%;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.06);
}

.modal-publi {
    padding: 15px; /* Reduced padding */
    flex-grow: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute space */
    overflow-y: auto; /* Add scroll here if needed */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ccc transparent; /* Firefox */
}
.modal-publi::-webkit-scrollbar {
    width: 6px;
}
.modal-publi::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}
.modal-publi::-webkit-scrollbar-track {
    background-color: transparent;
}

.publi-header {
    text-align: center;
    margin-bottom: 15px; /* Reduced margin */
    border-bottom: 1px solid rgba(203, 213, 225, 0.9);
    padding-bottom: 15px; /* Reduced padding */
}

.publi-logo {
    width: 70px; /* Slightly smaller logo */
    height: 70px;
    margin-bottom: 10px; /* Reduced margin */
    animation: pulse-logo 2s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(102, 126, 234, 0.2)); /* Adjusted shadow */
}

.publi-header h2 {
    font-size: clamp(1.4em, 2.5vw, 1.8em); /* Adjusted font size */
    color: #667eea;
    margin: 8px 0; /* Reduced margin */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.publi-tagline {
    color: #666;
    font-size: 0.9em; /* Slightly smaller font size */
    margin: 0;
    letter-spacing: 0.03em; /* Adjusted letter spacing */
    text-transform: uppercase;
}

.publi-body {
    margin: 10px 0; /* Reduced margin */
    display: flex; /* Changed to flex for better vertical distribution */
    flex-direction: column;
    gap: 8px; /* Reduced gap */
    flex-grow: 1; /* Allow body to grow */
}

.publi-body > h3 {
    text-align: center;
    margin: 0 !important; /* Ensure no extra margin */
    font-size: 1.1em; /* Kept similar font size */
    padding: 8px 12px; /* Reduced padding */
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.08) 100%);
}

.publi-section {
    margin-bottom: 0; /* Removed margin-bottom */
    padding: 12px 15px; /* Reduced padding */
    border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 16px; /* Slightly smaller border-radius */
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.98) 100%);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05); /* Adjusted shadow */
    animation: modalCardIn 0.45s ease both;
}

.publi-section:nth-of-type(1) {
    animation-delay: 0.06s;
}

.publi-section:nth-of-type(2) {
    animation-delay: 0.12s;
}

.publi-section h4 {
    font-size: 1em; /* Slightly smaller font size */
    margin-top: 0;
    margin-bottom: 8px; /* Reduced margin */
    color: #2c3e50;
}

.publi-section p {
    margin: 6px 0; /* Reduced margin */
    color: #666;
    line-height: 1.5; /* Adjusted line height */
    font-size: 0.9em; /* Slightly smaller font size */
    overflow-wrap: anywhere;
}

.publi-section strong {
    color: #2c3e50;
}

.publi-footer {
    text-align: center;
    padding-top: 10px; /* Reduced padding */
    border-top: 1px solid rgba(203, 213, 225, 0.9); /* Adjusted border */
    margin-top: 15px; /* Reduced margin */
}

.publi-version {
    font-size: 0.8em; /* Slightly smaller font size */
    color: #999;
    margin: 0;
}

.publi-footer p {
    margin: 8px 0; /* Reduced margin */
    font-size: 0.85em; /* Slightly smaller font size */
    overflow-wrap: anywhere;
}

.btn-start-app {
    width: calc(100% - 30px); /* Adjusted width */
    margin: 15px auto; /* Reduced margin */
    display: block;
    padding: 10px 18px; /* Reduced padding */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px; /* Adjusted border-radius */
    font-size: 1em; /* Slightly smaller font size */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.25); /* Adjusted shadow */
}

.btn-start-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(102, 126, 234, 0.35);
    filter: saturate(1.05);
}

.btn-start-app:active {
    transform: translateY(0);
}

/* ANIMACIONES DEL MODAL */
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalShellIn {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* DARK MODE - Modal */
body.dark-mode .modal-content {
    background: linear-gradient(180deg, rgba(31,41,55,0.98) 0%, rgba(17,24,39,0.98) 100%);
    border-color: rgba(71, 85, 105, 0.7);
}

body.dark-mode .modal-close {
    background: rgba(51, 65, 85, 0.92);
    border-color: rgba(71, 85, 105, 0.8);
    color: #e0e0e0; /* Ensure text is visible in dark mode */
}

body.dark-mode .modal-close:hover {
    background: rgba(71, 85, 105, 0.95);
}

body.dark-mode .publi-header {
    border-bottom-color: #334155;
}

body.dark-mode .publi-header h2 {
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .publi-tagline {
    color: #b0b0b0;
}

body.dark-mode .publi-body > h3 {
    background: linear-gradient(135deg, rgba(99,102,241,0.18) 0%, rgba(168,85,247,0.14) 100%);
    color: #e0e0e0; /* Ensure text is visible */
}

body.dark-mode .publi-section {
    background: linear-gradient(180deg, rgba(30,41,59,0.9) 0%, rgba(17,24,39,0.95) 100%);
    border-color: #334155;
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.25);
}

body.dark-mode .publi-section h4 {
    color: #a78bfa; /* Adjusted color for visibility */
}

body.dark-mode .publi-section p,
body.dark-mode .publi-section ul li {
    color: #b0b0b0;
}

body.dark-mode .publi-section strong {
    color: #e0e0e0;
}

body.dark-mode .publi-footer {
    border-top-color: #334155;
}

body.dark-mode .publi-version {
    color: #777;
}

body.dark-mode .publi-footer p {
    color: #b0b0b0;
}

/* Responsive adjustments for modal */
@media screen and (max-width: 768px) {
    .modal-overlay {
        padding: 10px; /* Reduced padding */
    }

    .modal-content {
        width: calc(100vw - 20px); /* Adjusted width */
        max-height: calc(100vh - 20px); /* Adjusted max-height */
        border-radius: 20px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 0.9em;
    }

    .modal-publi {
        padding: 12px; /* Reduced padding */
    }

    .publi-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 8px;
    }

    .publi-header h2 {
        font-size: clamp(1.2em, 2vw, 1.6em);
        margin: 6px 0;
    }

    .publi-tagline {
        font-size: 0.85em;
    }

    .publi-body {
        gap: 6px;
    }

    .publi-body > h3 {
        font-size: 1em;
        padding: 6px 10px;
    }

    .publi-section {
        padding: 10px 12px;
        border-radius: 14px;
    }

    .publi-section h4 {
        font-size: 0.95em;
        margin-bottom: 6px;
    }

    .publi-section p {
        font-size: 0.85em;
        margin: 4px 0;
    }

    .publi-footer {
        padding-top: 8px;
        margin-top: 10px;
    }

    .publi-version {
        font-size: 0.75em;
    }

    .publi-footer p {
        font-size: 0.8em;
        margin: 6px 0;
    }

    .btn-start-app {
        width: calc(100% - 24px); /* Adjusted width */
        margin: 12px auto; /* Adjusted margin */
        padding: 10px 15px;
        font-size: 0.95em;
        border-radius: 12px;
    }
}

@media screen and (max-width: 420px) {
    .modal-overlay {
        padding: 5px;
    }

    .modal-content {
        width: calc(100vw - 10px);
        max-height: calc(100vh - 10px);
        border-radius: 16px;
    }

    .modal-close {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }

    .modal-publi {
        padding: 10px;
    }

    .publi-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 6px;
    }

    .publi-header h2 {
        font-size: clamp(1em, 1.8vw, 1.4em);
        margin: 4px 0;
    }

    .publi-tagline {
        font-size: 0.8em;
    }

    .publi-body {
        gap: 5px;
    }

    .publi-body > h3 {
        font-size: 0.9em;
        padding: 5px 8px;
    }

    .publi-section {
        padding: 8px 10px;
        border-radius: 12px;
    }

    .publi-section h4 {
        font-size: 0.85em;
        margin-bottom: 5px;
    }

    .publi-section p {
        font-size: 0.8em;
        margin: 3px 0;
    }

    .publi-footer {
        padding-top: 6px;
        margin-top: 8px;
    }

    .publi-version {
        font-size: 0.7em;
    }

    .publi-footer p {
        font-size: 0.75em;
        margin: 5px 0;
    }

    .btn-start-app {
        width: calc(100% - 20px);
        margin: 10px auto;
        padding: 8px 12px;
        font-size: 0.85em;
        border-radius: 10px;
    }
}

/* ANIMACIONES GLOBALES (Movidas al inicio para evitar errores de carga) */
@keyframes heroFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes logo-glow {
    0% { filter: drop-shadow(0 0 2px rgba(52, 152, 219, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(52, 152, 219, 0.8)); }
    100% { filter: drop-shadow(0 0 2px rgba(52, 152, 219, 0.4)); }
}

@keyframes float {
    0% { transform: scale(1.1) rotate(5deg) translateY(0px); }
    50% { transform: scale(1.1) rotate(5deg) translateY(-8px); }
    100% { transform: scale(1.1) rotate(5deg) translateY(0px); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}