/* Reset y Variables CSS */
:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;

    --bg-primary: rgba(255, 255, 255, 0.08);
    --bg-secondary: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);

    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    color: var(--text-primary);
}

/* Fondo animado con degradado */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 25s ease infinite;
    z-index: -2;
    will-change: background-position;
}

.gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(252, 70, 107, 0.3), transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(99, 179, 237, 0.3), transparent 50%);
    animation: overlayShift 30s ease infinite;
    will-change: opacity;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes overlayShift {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Barra de menú superior */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 13px;
    z-index: 9999;
    user-select: none;
}

.menu-left {
    display: flex;
    gap: 20px;
    align-items: center;
}

.logo {
    font-weight: 600;
    font-size: 14px;
}

.menu-item {
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.8;
}

.menu-item:hover {
    opacity: 1;
}

.menu-right .time {
    font-size: 12px;
    opacity: 0.9;
}

/* Menu desplegable */
.menu-item-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 6px 0;
    z-index: 10000;
    margin-top: 4px;
}

.menu-item-dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 13px;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Escritorio */
.desktop {
    position: fixed;
    top: 32px;
    left: 0;
    right: 0;
    bottom: 80px;
    overflow: hidden;
}

/* Sistema de Ventanas - Estilo macOS */
.window {
    position: absolute;
    min-width: 400px;
    min-height: 300px;
    max-width: 90vw;
    max-height: calc(100vh - 150px);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
    animation: windowAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Optimización durante el drag - Mejor rendimiento */
.window.dragging {
    transition: none !important;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
    /* Desactivar backdrop-filter durante drag (muy costoso) */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Usar fondo más opaco para compensar */
    background: rgba(255, 255, 255, 0.15);
}

.window.dragging * {
    pointer-events: none;
}

.window.resizing * {
    pointer-events: none;
}

@keyframes windowAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 112px) !important;
    border-radius: 0;
}

.window.minimized {
    animation: windowMinimize 0.3s ease forwards;
}

@keyframes windowMinimize {
    to {
        opacity: 0;
        transform: scale(0.1) translateY(100%);
    }
}

.window-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.window-header:active {
    cursor: grabbing;
}

.window-controls {
    display: flex;
    gap: 8px;
    margin-right: 12px;
}

.window-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.window-btn:hover {
    transform: scale(1.15);
}

.window-btn.close {
    background: #FF5F57;
}

.window-btn.close:hover::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8B0000;
    font-size: 14px;
    font-weight: bold;
}

.window-btn.minimize {
    background: #FFBD2E;
}

.window-btn.minimize:hover::after {
    content: '−';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8B6914;
    font-size: 14px;
    font-weight: bold;
}

.window-btn.maximize {
    background: #28CA42;
}

.window-btn.maximize:hover::after {
    content: '⤢';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0D5E1F;
    font-size: 11px;
    font-weight: bold;
}

.window-title {
    font-weight: 600;
    font-size: 13px;
    flex: 1;
    text-align: center;
}

.window-spacer {
    width: 68px;
}

.window-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    cursor: grab;
}

.window-content:active {
    cursor: grabbing;
}

/* Restaurar cursor por defecto en elementos interactivos */
.window-content input,
.window-content textarea,
.window-content select,
.window-content button,
.window-content a,
.window-content iframe {
    cursor: auto;
}

.window-content button,
.window-content a {
    cursor: pointer;
}

.window-content input[type="text"],
.window-content input[type="email"],
.window-content textarea {
    cursor: text;
}

/* Handles de redimensionamiento */
.resize-handle {
    position: absolute;
    z-index: 10;
}

/* Esquinas */
.resize-nw {
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
}

.resize-ne {
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    cursor: nesw-resize;
}

.resize-sw {
    bottom: 0;
    left: 0;
    width: 12px;
    height: 12px;
    cursor: nesw-resize;
}

.resize-se {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
}

/* Bordes */
.resize-n {
    top: 0;
    left: 12px;
    right: 12px;
    height: 8px;
    cursor: ns-resize;
}

.resize-s {
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 8px;
    cursor: ns-resize;
}

.resize-w {
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 8px;
    cursor: ew-resize;
}

.resize-e {
    right: 0;
    top: 12px;
    bottom: 12px;
    width: 8px;
    cursor: ew-resize;
}

/* Indicador visual para la esquina inferior derecha */
.resize-se::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 6px 6px;
    border-color: transparent transparent rgba(255, 255, 255, 0.2) transparent;
}

.window:hover .resize-se::after {
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

/* Evitar conflicto entre cursor de drag y resize */
.window-content:hover {
    cursor: grab;
}

.resize-handle:hover ~ .window-content,
.resize-handle:hover {
    cursor: inherit !important;
}

/* Scrollbar personalizado - Estilo moderno */
.window-content::-webkit-scrollbar {
    width: 10px;
}

.window-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.window-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all 0.3s ease;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}

.window-content::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.45);
}

/* Dock/Barra de aplicaciones */
.dock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
}

.dock-container {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    box-shadow: var(--shadow-lg);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    will-change: transform;
}

.dock-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dock-item:hover .dock-icon {
    transform: translateY(-8px) scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.dock-item:active .dock-icon {
    transform: translateY(-4px) scale(1.05);
}

.dock-label {
    font-size: 11px;
    opacity: 0;
    transition: var(--transition);
    position: absolute;
    bottom: -18px;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 8px;
    border-radius: 6px;
    pointer-events: none;
}

.dock-item:hover .dock-label {
    opacity: 1;
}

.dock-separator {
    width: 1px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Indicador de aplicación activa */
.dock-item.active::before {
    content: '';
    position: absolute;
    bottom: -4px;
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
}

/* Estilos de contenido de ventanas */
.window-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.window-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 24px;
}

.window-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 16px;
}

.window-content p {
    line-height: 1.6;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.window-content ul, .window-content ol {
    margin-left: 24px;
    margin-bottom: 16px;
    line-height: 1.8;
}

/* Cards para aplicaciones */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.app-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.app-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.app-card-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.app-card-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 16px;
    object-fit: contain;
    transition: var(--transition);
}

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

.app-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.app-card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.app-card-links {
    display: flex;
    gap: 10px;
}

/* Coming Soon Box */
.coming-soon-box {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    margin-top: 24px;
}

.coming-soon-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
    letter-spacing: 8px;
}

.coming-soon-box h2 {
    margin: 0 0 12px 0;
    font-weight: 600;
}

.coming-soon-box p {
    margin: 0;
    opacity: 0.8;
}

/* Cards horizontales para juegos */
.games-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.game-card-horizontal {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px;
    transition: var(--transition);
}

.game-card-horizontal:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(4px);
}

.game-card-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.game-card-info {
    flex: 1;
    min-width: 0;
}

.game-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.game-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .game-card-horizontal {
        flex-direction: column;
        text-align: center;
    }

    .game-card-img {
        width: 60px;
        height: 60px;
    }
}

.app-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.app-btn-primary {
    background: var(--primary-color);
    color: white;
}

.app-btn-primary:hover {
    background: #0051D5;
    transform: scale(1.05);
}

.app-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.app-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Hero section para ventana de inicio */
.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 16px;
}

.hero p {
    font-size: 20px;
    margin-bottom: 32px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 14px 32px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.hero-btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.hero-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hero-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Features grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.feature-item {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.feature-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Formulario de contacto */
.contact-form {
    max-width: 500px;
    margin: 24px auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-color);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.form-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Responsive Design */
@media (max-width: 768px) {
    .menu-bar {
        font-size: 11px;
        padding: 0 12px;
    }

    .menu-item {
        display: none;
    }

    .window {
        min-width: 90vw !important;
        max-width: 95vw !important;
        left: 2.5vw !important;
        right: 2.5vw !important;
    }

    .window-content {
        padding: 16px;
    }

    .window-content h1 {
        font-size: 24px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero p {
        font-size: 16px;
    }

    .dock {
        bottom: 10px;
        left: 0;
        right: 0;
        transform: none;
        padding: 0 8px;
    }

    .dock-container {
        width: 100%;
        justify-content: space-around;
        padding: 8px;
        gap: 4px;
        border-radius: 16px;
    }

    .dock-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .dock-label {
        font-size: 9px;
        bottom: -16px;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .desktop {
        bottom: 70px;
    }
}

@media (max-width: 480px) {
    .dock-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .window-btn {
        width: 14px;
        height: 14px;
    }
}

/* Animaciones adicionales */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* Estados hover mejorados */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

/* Utilidades */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* Animaciones para notificaciones */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
