/* ==========================================
   МОДАЛЬНЫЕ ОКНА
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-color);
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ
   ========================================== */
.auth-modal {
    padding: 32px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab:hover {
    color: var(--primary-color);
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-form {
    animation: fadeIn 0.3s ease;
}

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

.auth-form .submit-btn {
    width: 100%;
    margin-top: 8px;
}

.forgot-link,
.back-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.forgot-link:hover,
.back-link:hover {
    text-decoration: underline;
}

/* Поле пароля с глазиком */
.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrap input {
    width: 100%;
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    opacity: 1;
}

.password-toggle.active {
    opacity: 1;
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО КОРЗИНЫ
   ========================================== */
.cart-modal {
    padding: 32px;
    max-width: 700px;
}

.cart-modal h2 {
    margin-bottom: 24px;
    color: var(--primary-color);
}

.cart-empty {
    text-align: center;
    padding: 32px;
}

.cart-empty p {
    font-size: 18px;
    margin-bottom: 16px;
    color: #666;
}

.cart-items {
    margin-bottom: 24px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 12px;
}

.cart-item-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.cart-item-price {
    font-weight: 600;
    color: var(--secondary-color);
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 16px 0;
    border-top: 2px solid var(--border-color);
    font-size: 18px;
    font-weight: 600;
}

.cart-total-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary-color);
}

.cart-checkout-btn {
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    font-size: 18px;
}

.cart-auth-notice {
    text-align: center;
    padding: 24px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-top: 16px;
}

.cart-auth-notice p {
    margin-bottom: 12px;
}

.cart-error {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-color);
}

.cart-error .error-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.cart-error h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.cart-error p {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО ЮРИДИЧЕСКИХ ДОКУМЕНТОВ
   ========================================== */
.legal-modal {
    padding: 32px;
    max-width: 800px;
}

.legal-modal h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.legal-modal h3 {
    color: var(--primary-color);
    margin: 24px 0 12px 0;
    font-size: 18px;
}

.legal-modal p {
    margin-bottom: 12px;
    line-height: 1.7;
}

.legal-modal ul {
    margin: 12px 0;
    padding-left: 24px;
}

.legal-modal li {
    margin-bottom: 8px;
}

/* ==========================================
   СТАТЬИ
   ========================================== */
.articles-container {
    background: var(--bg-white);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.articles-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.article-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.article-title {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 8px;
}

.article-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.article-category {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.article-preview {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
}

.article-full {
    animation: fadeIn 0.3s ease;
}

.article-full h1 {
    color: var(--primary-color);
    font-size: 32px;
    margin-bottom: 16px;
}

.article-content {
    line-height: 1.8;
    font-size: 16px;
}

.article-content h2 {
    color: var(--primary-color);
    margin: 32px 0 16px 0;
}

.article-content h3 {
    color: var(--primary-color);
    margin: 24px 0 12px 0;
}

.no-articles {
    text-align: center;
    padding: 48px;
    color: #666;
    grid-column: 1 / -1;
}

/* ==========================================
   АДАПТИВНОСТЬ
   ========================================== */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .auth-modal,
    .cart-modal,
    .legal-modal {
        padding: 24px;
    }
    
    .articles-filters {
        flex-direction: column;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-full h1 {
        font-size: 24px;
    }
}

