/**
 * Demostraciones Web - Estilos Optimizados
 * Noelyth Softworks
 */

/* Asegurar que el header principal sea visible */
body > header,
header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
}

#header-placeholder {
    display: block !important;
    visibility: visible !important;
}

#header-placeholder > header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Google Translate Widget */
#google-translate-widget {
    display: block !important;
    visibility: visible !important;
}

/* Asegurar que el nav esté visible */
nav,
header nav {
    display: flex !important;
    visibility: visible !important;
}

/* ==========================================
   HERO SECTION
   ========================================== */
.demo-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    text-align: center;
    padding: 200px 20px 80px;
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding-top: 200px;
}

.demo-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.demo-header .container {
    position: relative;
    z-index: 2;
}

.demo-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.demo-header p {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin-bottom: 50px;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Statistics */
.demo-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    min-width: 100px;
}

.stat-number {
    display: block;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: clamp(0.9rem, 2vw, 1rem);
    opacity: 0.8;
    font-weight: 500;
}

/* ==========================================
   CATEGORY NAVIGATION
   ========================================== */
.demo-nav {
    background-color: white;
    padding: 25px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 153, 204, 0.1);
    position: static;
    z-index: 10;
}

.category-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.category-btn {
    background: var(--light-color);
    border: 2px solid transparent;
    color: var(--secondary-color);
    padding: 14px 24px;
    border-radius: 50px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    white-space: nowrap;
}

.category-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 153, 204, 0.3);
}

.category-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-btn i {
    font-size: 1.1em;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.demo-main {
    background-color: #fafbfc;
    padding: 60px 20px;
    min-height: 50vh;
}

.demo-section {
    margin-bottom: 80px;
}

.demo-section:last-child {
    margin-bottom: 0;
}

.demo-section.is-hidden {
    display: none;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-weight: 600;
    position: relative;
    padding-bottom: 15px;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.section-header p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: #666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==========================================
   DEMO GRID
   ========================================== */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.demo-grid.single-item {
    grid-template-columns: 1fr;
    max-width: 500px;
}

/* ==========================================
   DEMO CARDS
   ========================================== */
.demo-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 153, 204, 0.1);
    position: relative;
    display: block;
    opacity: 1;
    visibility: visible;
}

.demo-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.demo-card.featured {
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 153, 204, 0.2);
}

.demo-card.featured::before {
    content: 'DESTACADO';
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 3;
    letter-spacing: 0.5px;
}

.demo-card.hidden {
    display: none;
}

.demo-card.visible {
    display: block;
}

/* Card Image */
.demo-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--light-color), #e8f4f8);
}

.demo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.demo-card:hover .demo-image img {
    transform: scale(1.05);
}

/* Card Overlay */
.demo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 51, 102, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.demo-card:hover .demo-overlay {
    opacity: 1;
}

.demo-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
}

.btn-demo {
    background: white;
    color: var(--secondary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-height: 44px;
}

.btn-demo:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-preview {
    background: var(--accent-color);
    color: white;
}

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

/* Card Content */
.demo-content {
    padding: 25px;
}

.demo-content h3 {
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    color: var(--secondary-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.demo-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

/* Technology Tags */
.demo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: rgba(0, 153, 204, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(0, 153, 204, 0.2);
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    border-radius: 15px;
    width: 90%;
    max-width: 1000px;
    height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: var(--secondary-color);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary-color);
}

.modal-header div {
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-header a {
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.modal-header a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.modal-header h3 {
    margin: 0;
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    font-weight: 600;
}

.close-modal {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
}

.close-modal:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

#info-modal-body {
    padding: 30px;
    overflow-y: auto;
}

.project-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.info-section h4 {
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.info-section li:before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    margin-right: 10px;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.tech-item {
    background: var(--light-color);
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--primary-color);
}

/* ==========================================
   CTA SECTION
   ========================================== */
.demo-cta {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.demo-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
}

.demo-cta > * {
    position: relative;
    z-index: 2;
}

.demo-cta h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 20px;
    font-weight: 700;
}

.demo-cta p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-bottom: 40px;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cta-buttons .btn {
    padding: 15px 35px;
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 180px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-primary {
    background: white;
    color: var(--secondary-color);
    border: 2px solid white;
}

.btn-primary:hover {
    background: transparent;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: var(--secondary-color);
    transform: translateY(-3px);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 992px) {
    .demo-header {
        padding: 160px 20px 60px;
        padding-top: 160px;
        margin-top: 0;
    }

    .demo-nav {
        padding: 20px 15px;
    }

    .demo-stats {
        gap: 30px;
    }

    .category-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .demo-header {
        padding: 140px 20px 50px;
        padding-top: 140px;
        margin-top: 0;
    }

    .demo-stats {
        gap: 20px;
    }

    .category-nav {
        gap: 10px;
        flex-direction: row;
        justify-content: center;
    }

    .category-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .category-btn span {
        display: inline;
    }

    .category-btn i {
        font-size: 1rem;
    }

    .demo-grid {
        gap: 20px;
    }

    .demo-image {
        height: 200px;
    }

    .demo-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .btn-demo {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        height: 95%;
        margin: 2.5% auto;
    }

    .modal-header {
        padding: 15px 20px;
        flex-wrap: wrap;
    }

    #info-modal-body {
        padding: 20px;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .cta-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .demo-header {
        padding: 120px 15px 40px;
        padding-top: 120px;
        margin-top: 0;
    }

    .demo-nav {
        padding: 15px 10px;
    }

    .category-nav {
        gap: 8px;
    }

    .category-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 44px;
    }

    .category-btn span {
        font-size: 0.75rem;
    }

    .category-btn i {
        font-size: 0.9rem;
    }

    .demo-content {
        padding: 20px;
    }

    .btn-demo {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* ==========================================
   ACCESSIBILITY & UTILITIES
   ========================================== */
.category-btn:focus,
.btn-demo:focus,
.close-modal:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

html {
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Loading State */
.loading-demos {
    text-align: center;
    padding: 60px 20px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.loading-demos i {
    font-size: 2rem;
    margin-bottom: 15px;
    animation: spin 1s linear infinite;
}

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

.no-demos {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-demos i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.no-demos h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}
