/* ============================================
   ATOMIC FACTS MODULE
   ============================================ */

.atomic-facts {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.atomic-facts::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #294ea1, #ffad2b, #ff6b6b);
}

.atomic-facts__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.atomic-facts__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.atomic-facts__title::before {
    content: '💡';
    font-size: 1.2em;
}

.atomic-facts__controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.atomic-facts__button {
    background: #294ea1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.atomic-facts__button:hover {
    background: #1e3a73;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(41, 78, 161, 0.3);
}

.atomic-facts__button:active {
    transform: translateY(0);
}

.atomic-facts__button--secondary {
    background: #6c757d;
}

.atomic-facts__button--secondary:hover {
    background: #5a6268;
}

.atomic-facts__button--small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.atomic-facts__container {
    position: relative;
    min-height: 120px;
}

.atomic-facts__fact {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #294ea1;
}

.atomic-facts__fact.active {
    opacity: 1;
    transform: translateY(0);
    position: relative;
}

.atomic-facts__fact-content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.atomic-facts__fact-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: #f8f9fa;
}

.atomic-facts__fact-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.6;
    color: #2c3e50;
    margin: 0;
}

.atomic-facts__fact-category {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.atomic-facts__fact-category--physics {
    background: #f3e5f5;
    color: #7b1fa2;
}

.atomic-facts__fact-category--chemistry {
    background: #e8f5e8;
    color: #388e3c;
}

.atomic-facts__fact-category--history {
    background: #fff3e0;
    color: #f57c00;
}

.atomic-facts__fact-category--technology {
    background: #e0f2f1;
    color: #00695c;
}

.atomic-facts__fact-category--fun {
    background: #fce4ec;
    color: #c2185b;
}

.atomic-facts__navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.atomic-facts__nav-button {
    background: none;
    border: 2px solid #dee2e6;
    color: #6c757d;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.atomic-facts__nav-button:hover {
    border-color: #294ea1;
    color: #294ea1;
    transform: scale(1.1);
}

.atomic-facts__nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.atomic-facts__counter {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.atomic-facts__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: #6c757d;
    font-style: italic;
}

.atomic-facts__loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-top: 2px solid #294ea1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

.atomic-facts__error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: #dc3545;
    font-style: italic;
}

.atomic-facts__error::before {
    content: '⚠️';
    margin-right: 0.5rem;
    font-size: 1.2em;
}

/* Анимации */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes flipIn {
    from {
        opacity: 0;
        transform: rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: rotateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Типы анимаций */
.atomic-facts--fade .atomic-facts__fact {
    animation: fadeIn 0.6s ease;
}

.atomic-facts--slide .atomic-facts__fact {
    animation: slideIn 0.6s ease;
}

.atomic-facts--flip .atomic-facts__fact {
    animation: flipIn 0.6s ease;
}

.atomic-facts--zoom .atomic-facts__fact {
    animation: zoomIn 0.6s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .atomic-facts {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .atomic-facts__header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .atomic-facts__title {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .atomic-facts__controls {
        justify-content: center;
    }
    
    .atomic-facts__fact-content {
        flex-direction: column;
        text-align: center;
    }
    
    .atomic-facts__fact-image {
        width: 100%;
        height: 120px;
        align-self: center;
    }
    
    .atomic-facts__fact-text {
        font-size: 0.95rem;
    }
    
    .atomic-facts__navigation {
        gap: 0.5rem;
    }
    
    .atomic-facts__nav-button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .atomic-facts {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .atomic-facts__title {
        font-size: 1.2rem;
    }
    
    .atomic-facts__button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .atomic-facts__fact {
        padding: 1rem;
    }
    
    .atomic-facts__fact-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Стили для встроенного отображения в прелоадере */
.atomic-preloader .atomic-facts {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

.atomic-preloader .atomic-facts::before {
    display: none;
}

.atomic-preloader .atomic-facts__header {
    display: none;
}

.atomic-preloader .atomic-facts__container {
    min-height: auto;
}

.atomic-preloader .atomic-facts__fact {
    position: static;
    opacity: 1;
    transform: none;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
}

.atomic-preloader .atomic-facts__fact-content {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
}

.atomic-preloader .atomic-facts__fact-image {
    display: none;
}

.atomic-preloader .atomic-facts__fact-text {
    font-size: 1rem;
    color: rgba(17, 24, 38, 0.8);
    margin: 0;
}

.atomic-preloader .atomic-facts__fact-category {
    display: none;
}

.atomic-preloader .atomic-facts__navigation {
    display: none;
}

/* Стили для скрытого состояния */
.atomic-facts.hidden {
    display: none;
}

/* Стили для анимации появления */
.atomic-facts.animate-in {
    animation: fadeIn 0.6s ease;
}
