/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.app {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: relative;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 20px 20px 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.categories-toggle {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.categories-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Panel de categorías */
.categories-panel {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 90;
}

.categories-panel.active {
    transform: translateY(0);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

.category-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.category-btn:hover,
.category-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.category-btn .emoji {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* Área del contenido principal */
.main-content {
    padding: 20px;
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Tarjeta de dato curioso */
.fact-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.fact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.fact-emoji {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.fact-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

.fact-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 20px;
}

.fact-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.fact-meta span {
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Footer de acciones */
.footer-actions {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 20px 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50px;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.3rem;
    color: #667eea;
}

.action-btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    width: 65px;
    height: 65px;
    font-size: 1.5rem;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.action-btn.primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Estados especiales */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

.no-facts {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.no-facts .emoji {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* Animaciones para transiciones de tarjetas */
.fact-card.swipe-out {
    animation: swipeOut 0.3s ease-in forwards;
}

.fact-card.swipe-in {
    animation: swipeIn 0.3s ease-out forwards;
}

@keyframes swipeOut {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(100px) scale(0.8);
        opacity: 0;
    }
}

@keyframes swipeIn {
    0% {
        transform: translateX(-100px) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Indicadores de guardado */
.saved-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    animation: showIndicator 2s ease;
}

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

/* Responsive para tablets */
@media (min-width: 768px) {
    .app {
        max-width: 500px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(8, 1fr);
        max-width: 450px;
    }
    
    .fact-card {
        padding: 40px 35px;
    }
    
    .fact-title {
        font-size: 1.6rem;
    }
    
    .fact-description {
        font-size: 1.1rem;
    }
}