.companies-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Уменьшили минимальную ширину */
    gap: 15px; /* Уменьшили отступы */
    margin-top: 20px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .companies-container {
        grid-template-columns: 1fr; /* На мобильных — одна карточка в строке */
        padding: 10px; /* Добавим отступы по краям */
        gap: 12px;
    }

    .company-card {
        padding: 15px; /* Уменьшили внутренние отступы */
    }
}

@media (max-width: 480px) {
    .companies-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .company-card {
        padding: 12px;
    }

    .company-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .company-name {
        font-size: 16px;
    }

    .company-ticker {
        font-size: 12px;
        padding: 3px 6px;
    }

    .company-price {
        font-size: 18px;
    }

    .company-change {
        font-size: 12px;
    }

    .actions {
        flex-direction: column;
        gap: 8px;
    }

    .action-btn {
        padding: 8px 0;
        font-size: 14px;
    }
}

.company-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.company-name {
    font-size: 18px;
    font-weight: 600;
    color: #0a2c47;
}

.company-ticker {
    background: #e9f7ef;
    color: #28a745;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.company-price {
    font-size: 20px;
    font-weight: bold;
    margin: 10px 0;
}

.company-change {
    font-size: 14px;
    margin-bottom: 15px;
}

.positive {
    color: #28a745;
}

.negative {
    color: #dc3545;
}

.rating-section {
    margin: 15px 0;
}

.rating-label {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #0a2c47;
}

.rating-stars {
    display: flex;
    gap: 2px;
    margin: 5px 0;
}

.rating-stars .star {
    font-size: 16px;
    color: #ffc107;
}

.rating-value {
    font-size: 16px;
    font-weight: bold;
    color: #0a2c47;
}

.honesty-scale {
    margin: 15px 0;
}

.honesty-label {
    font-weight: 600;
    margin-bottom: 5px;
}

.honesty-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.honesty-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545, #ffc107, #28a745);
    transition: width 0.5s ease;
}

.honesty-percent {
    position: absolute;
    top: 0;
    right: 10px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.vote-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.vote-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.vote-up {
    background: #e9f7ef;
    color: #28a745;
}

.vote-up:hover {
    background: #28a745;
    color: white;
}

.vote-down {
    background: #fdeaea;
    color: #dc3545;
}

.vote-down:hover {
    background: #dc3545;
    color: white;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.view-btn {
    background: #007bff;
    color: white;
}

.view-btn:hover {
    background: #0056b3;
}

.news-btn {
    background: #6f42c1;
    color: white;
}

.news-btn:hover {
    background: #5a32a3;
}

.reports-btn {
    background: #17a2b8;
    color: white;
}

.reports-btn:hover {
    background: #138496;
}

.company-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid #e0e0e0;
}

.company-info {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.personal-rating {
    margin: 15px 0;
}

.personal-rating label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #0a2c47;
}

.star-rating {
    display: flex;
    gap: 3px;
    margin-bottom: 5px;
}

.star-rating .star {
    font-size: 18px;
    color: #e0e0e0;
    cursor: pointer;
    transition: color 0.2s;
}

.star-rating .star.active {
    color: #ffc107;
}

.star-rating .star:hover {
    color: #ffc107;
    transform: scale(1.1);
}

.rating-average {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Стили для страницы деталей компании */
.company-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.company-detail-name {
    font-size: 28px;
    font-weight: bold;
    color: #0a2c47;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.company-detail-ticker {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    margin-top: 8px;
}

.company-sector {
    color: #6c757d;
    font-size: 13px;
    margin-left: 8px;
}

.company-detail-price {
    font-size: 32px;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: #0a2c47;
}

.company-detail-change {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.company-detail-description {
    margin: 20px 0;
    line-height: 1.6;
    font-size: 15px;
    color: #495057;
}

.company-financial-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.info-card {
    padding: 20px;
    background: white;
    border: 1px solid #e3e7ec;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.company-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #0a2c47;
}

.articles-section {
    margin-top: 30px;
}

.articles-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #0a2c47;
}

.article-list {
    list-style: none;
}

.article-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.article-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.article-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.article-excerpt {
    color: #555;
    line-height: 1.5;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Модальное окно для новостей и отчетов */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 30px 24px 24px 24px;
    max-width: 500px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.close-modal {
    position: absolute;
    top: 10px;
    right: 18px;
    font-size: 32px;
    color: #888;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
}
.close-modal:hover {
    color: #d32f2f;
}
#modal-title {
    margin-bottom: 18px;
    font-size: 22px;
    color: #0a2c47;
    font-weight: 600;
}
#modal-body ul {
    padding-left: 0;
    list-style: none;
}
#modal-body li {
    margin-bottom: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.vote-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.voted-animate {
    animation: votedPulse 0.4s;
}

@keyframes votedPulse {
    0% { transform: scale(1); background: inherit; }
    50% { transform: scale(1.12); background: #e9f7ef; }
    100% { transform: scale(1); background: inherit; }
}

.voted-up {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%) !important;
    color: #fff !important;
    box-shadow: 0 0 8px 2px #43e97b44;
    font-weight: bold;
    border: none !important;
    filter: none;
}
.voted-down {
    background: linear-gradient(90deg, #ff5858 0%, #f09819 100%) !important;
    color: #fff !important;
    box-shadow: 0 0 8px 2px #ff585844;
    font-weight: bold;
    border: none !important;
    filter: none;
}
.vote-status {
    margin-left: 10px;
    color: #007bff;
    font-weight: 600;
    font-size: 14px;
    vertical-align: middle;
}

/* Мобильная адаптация для страницы компании */
@media (max-width: 768px) {
    .company-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    
    .company-detail-name {
        font-size: 24px;
    }
    
    .company-detail-price {
        font-size: 28px;
    }
    
    .company-financial-info {
        grid-template-columns: 1fr !important;
    }

    .company-detail-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .info-card {
        padding: 15px;
    }
}