/* ====================================
   LIRIMO - Custom Styles
   Kid-Friendly Design
   ==================================== */

/* === VARIABLES === */
:root {
    --primary-color: #29a5bc;      /* Turquesa */
    --secondary-color: #ff6b9d;    /* Rosa */
    --accent-yellow: #ffec66;      /* Amarillo */
    --accent-green: #99f5ba;       /* Verde lima */
    --accent-purple: #a688fa;      /* Morado suave */
    --text-dark: #2d3748;
    --text-muted: #718096;
    --bg-light: #f7fafc;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* === TIPOGRAFÍA === */
body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

.fw-500 {
    font-weight: 500;
}

/* === NAVBAR === */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e8196 100%);
}

.navbar-toggler {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* === STORY CARDS === */
.story-card {
    border-radius: 25px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    box-shadow: var(--shadow-sm);
    background: white;
    height: 100%;
}

.story-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.story-card-image {
    height: 220px;
    object-fit: cover;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.story-card-body {
    padding: 1.5rem;
}

.story-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.story-card-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

/* === BADGES === */
.badge-category {
    background-color: var(--primary-color);
    color: white;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.badge-age {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.badge-tag {
    background-color: #f0f0f0;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    padding: 0.3rem 0.7rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 0.2rem;
    display: inline-block;
    transition: all 0.2s ease;
}

a.badge-tag:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(41, 165, 188, 0.3);
}

.badge-time {
    background-color: #fff;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    padding: 0.3rem 0.7rem;
    border-radius: 15px;
    font-size: 0.8rem;
    display: inline-block;
}

/* === BUTTONS === */
.btn-primary-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e8196 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(41, 165, 188, 0.2);
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(41, 165, 188, 0.3);
    color: white;
}

.btn-secondary-gradient {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff4d7d 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 157, 0.3);
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    padding: 0.6rem 1.3rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* === HERO SECTION === */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 5rem 0;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-illustration {
    max-width: 100%;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

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

/* === CATEGORY CARDS === */
.category-card {
    border-radius: 20px;
    padding: 2rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    background: white;
    box-shadow: var(--shadow-sm);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* === STORY OF THE DAY === */
.story-of-day-card {
    border-radius: 25px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: white;
}

/* === FILTERS === */
.filter-section {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.filter-btn {
    border: 2px solid #e2e8f0;
    background: white;
    color: var(--text-dark);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* === STORY READER === */
.story-reader {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.story-reader.night-mode {
    background: #1a202c;
    color: #f7fafc;
}

.story-reader h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.story-reader.night-mode h1 {
    color: #f7fafc;
}

.story-reader.night-mode .story-footer p,
.story-reader.night-mode .story-footer {
    color: #f7fafc !important;
}

.story-reader.night-mode .story-footer .badge-tag {
    background-color: #4a5568;
    color: #f7fafc;
    border-color: #4a5568;
}

.story-reader.night-mode .story-footer .badge-tag:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.story-reader.night-mode hr {
    border-color: rgba(255, 255, 255, 0.2);
}

.story-content {
    font-size: 1.1rem;
    line-height: 2;
}

.story-content p {
    margin-bottom: 1.5rem;
}

/* Font size controls - Applied to story content */
.story-reader.font-size-sm .story-content { font-size: 0.95rem !important; }
.story-reader.font-size-md .story-content { font-size: 1.1rem !important; }
.story-reader.font-size-lg .story-content { font-size: 1.3rem !important; }
.story-reader.font-size-xl .story-content { font-size: 1.5rem !important; }

/* === PAGINATION === */
.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
    color: var(--text-dark);
    font-weight: 600;
}

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

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* === UTILITIES === */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .story-card-image {
        height: 180px;
    }
    
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .story-reader {
        padding: 2rem 1.5rem;
    }
    
    .story-reader h1 {
        font-size: 2rem;
    }
    
    .category-icon {
        font-size: 2.5rem;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* === LOADING === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === PRINT STYLES === */
@media print {
    /* Hide unnecessary elements */
    .navbar,
    footer,
    .reader-controls,
    .breadcrumb,
    .btn,
    button,
    nav {
        display: none !important;
    }

    /* Reset backgrounds for print */
    body,
    .story-reader,
    .bg-gradient-primary {
        background: white !important;
        color: black !important;
    }

    /* Optimize story content for print */
    .story-reader {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .story-content {
        font-size: 12pt !important;
        line-height: 1.6 !important;
        color: black !important;
    }

    .story-reader h1 {
        font-size: 24pt !important;
        color: black !important;
        margin-bottom: 1rem !important;
    }

    /* Images */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    p {
        orphans: 3;
        widows: 3;
    }
}

/* === FAVORITE BUTTON ANIMATION === */
.control-btn.active {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* === SOCIAL SHARE BUTTONS COLORS === */
#shareWhatsApp:hover {
    background: #25D366 !important;
    color: white !important;
    border-color: #25D366 !important;
}

#shareFacebook:hover {
    background: #1877F2 !important;
    color: white !important;
    border-color: #1877F2 !important;
}

#shareTwitter:hover {
    background: #1DA1F2 !important;
    color: white !important;
    border-color: #1DA1F2 !important;
}

#copyLink.active {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

/* === READ ALOUD BUTTON === */
#readAloudBtn.active {
    background: var(--secondary-color) !important;
    color: white !important;
    border-color: var(--secondary-color) !important;
    animation: reading-pulse 1.5s ease-in-out infinite;
}

@keyframes reading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
