/* Улучшенные стили для карточек акций */
body {
    padding-top: 100px !important;
}

/* Основная карточка */
.stock-card {
    background-color: #fff;
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color, #D1E0D5);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(46, 139, 87, 0.15);
    border-color: rgba(46, 139, 87, 0.3);
}

.stock-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color, #2E8B57), var(--secondary-color, #3CB371));
    border-radius: 2px 0 0 2px;
}

.stock-card h5 {
    font-weight: 700;
    color: var(--text-dark, #1a2c38);
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.stock-card small.text-muted {
    color: var(--secondary-text-color, #646464);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

/* Улучшенные индикаторы прибыли/убытков */
.stock-positive {
    color: var(--profit, #00C851);
    font-weight: 600;
    background-color: rgba(0, 200, 81, 0.1);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 200, 81, 0.15);
}

.stock-positive::before {
    content: '▲';
    margin-right: 6px;
    font-size: 11px;
}

.stock-negative {
    color: var(--loss, #ff4444);
    font-weight: 600;
    background-color: rgba(255, 68, 68, 0.1);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.15);
}

.stock-negative::before {
    content: '▼';
    margin-right: 6px;
    font-size: 11px;
}

/* Улучшенный блок с графиком */
.stock-chart-box {
    width: 100%;
    height: 90px;
    margin: 1.75rem 0;
    position: relative;
    background-color: var(--bg-light, #F8F9FD);
    border-radius: 10px;
    padding: 10px 5px 5px;
    border: 1px solid rgba(46, 139, 87, 0.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.stock-chart-box::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(to top, rgba(248, 249, 253, 0.7), transparent);
    pointer-events: none;
}

.stock-chart-box canvas {
    width: 100% !important;
    height: 80px !important;
    display: block;
    transition: opacity 0.2s ease;
}

/* Заглушка для графика */
.stock-chart-placeholder {
    height: 90px;
    background: linear-gradient(135deg, #f5f7fa 0%, #eef2f7 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    margin: 1.5rem 0;
    border: 1px dashed var(--border-color, #D1E0D5);
}

/* Улучшенные статистические данные */
.stock-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 1.75rem 0 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color, #D1E0D5);
    position: relative;
}

.stock-stats::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    width: 35px;
    height: 2px;
    background-color: var(--primary-color, #2E8B57);
    border-radius: 2px;
}

.stock-stats small.text-muted {
    font-size: 0.75rem;
    color: var(--secondary-text-color, #646464);
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.75;
}

.stock-stats div div {
    font-weight: 700;
    color: var(--text-dark, #1a2c38);
    font-size: 1rem;
}

/* Улучшенная кнопка покупки */
.stock-buy-button {
    width: 100%;
    padding: 0.9rem;
    background-color: var(--primary-color, #2E8B57);
    background: linear-gradient(135deg, var(--primary-color, #2E8B57) 0%, var(--secondary-color, #3CB371) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(46, 139, 87, 0.2);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.stock-buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(46, 139, 87, 0.3);
}

.stock-buy-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(46, 139, 87, 0.2);
}

/* Эффект свечения для кнопки */
.stock-buy-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s ease;
}

.stock-buy-button:hover::after {
    left: 100%;
}

/* Модальное окно покупки */
.stock-buy-container {
    position: fixed;
    align-self: center;
    justify-self: center;
    width: 100vw;
    height: calc(100dvh - 70px);
    top: 70px;
    left: 0;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
}

.stock-buy-container.active {
    display: flex;
}

.form-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    padding: 4.5rem 2rem;
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    max-height: 500px;
    border: 1px solid rgba(46, 139, 87, 0.1);
}

.form-balance {
    position: absolute;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--primary-color, #2E8B57) 0%, var(--secondary-color, #3CB371) 100%);
    color: white;
    left: 1.5rem;
    top: 1.5rem;
    box-shadow: 0 2px 8px rgba(46, 139, 87, 0.2);
}

.form-info {
    width: 100%;
}

.form-info .info-li {
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 8px;
    background-color: rgba(0, 155, 67, 0.08);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 155, 67, 0.1);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.form-info .info-li:hover {
    background-color: rgba(0, 155, 67, 0.12);
    transform: translateX(3px);
}

/* Дополнительные настройки */
.stock-filters {
    margin-bottom: 2rem;
    padding: 1rem;
    border-radius: 10px;
    background-color: rgba(248, 249, 253, 0.7);
    border: 1px solid var(--border-color, #D1E0D5);
}

.stock-chart {
    width: 100%;
    border-radius: 10px;
}

/* Улучшенная адаптивность */
@media (min-width: 1400px) {
    .stock-card {
        padding: 2rem;
    }
    
    .stock-chart-box {
        height: 100px;
    }
    
    .stock-chart-box canvas {
        height: 90px !important;
    }
    
    .stock-buy-button {
        padding: 1rem;
    }
}

@media (max-width: 1200px) {
    .stock-card {
        padding: 1.5rem;
    }
    
    .stock-chart-box {
        margin: 1.5rem 0;
    }
    
    .stock-stats {
        gap: 12px;
    }
}

@media (max-width: 992px) {
    .stock-stats {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 15px;
    }
    
    .stock-card h5 {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    .stock-card {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    .stock-chart-box {
        height: 80px;
        margin: 1.25rem 0;
    }
    
    .stock-chart-box canvas {
        height: 70px !important;
    }
    
    .stock-positive, .stock-negative {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .form-container {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
}

@media (max-width: 576px) {
    .stock-card {
        padding: 1.1rem;
        border-radius: 10px;
    }
    
    .stock-card h5 {
        font-size: 1.2rem;
    }
    
    .stock-chart-box {
        height: 70px;
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    .stock-chart-box canvas {
        height: 60px !important;
    }
    
    .stock-stats {
        margin: 1.2rem 0 1rem;
        padding-top: 1rem;
        gap: 10px;
    }
    
    .stock-stats div div {
        font-size: 0.95rem;
    }
    
    .stock-buy-button {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .form-container {
        padding: 1.75rem 1.25rem;
    }
    
    .form-balance {
        padding: 5px 10px;
        font-size: 0.75rem;
        left: 1rem;
        top: 1rem;
    }
    
    .form-info .info-li {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .stock-card {
        padding: 1rem;
    }
    
    .stock-chart-box {
        height: 60px;
    }
    
    .stock-chart-box canvas {
        height: 50px !important;
    }
    
    .stock-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stock-positive, .stock-negative {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
}

/* Стили для контейнеров карточек */
.stock-row {
    margin-bottom: 1.5rem;
}

/* Стили для высоких экранов */
@media (min-height: 900px) {
    .stock-card {
        margin-bottom: 1.5rem;
    }
    
    .stock-chart-box {
        height: 100px;
    }
    
    .stock-chart-box canvas {
        height: 90px !important;
    }
}

#stocksContainer {
    padding-bottom: 12px;
}