.stack-container {
    max-width: 1200px;
    margin: 90px auto 30px;
    padding: 20px;
}

.stack-header {
    margin-bottom: 40px;
    text-align: center;
    position: relative;
}

.stack-header h1 {
    color: var(--primary-color);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    position: relative;
}

.stack-header h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--gradient-1);
    border-radius: 3px;
}

.stack-header p {
    color: var(--secondary-text-color);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    max-width: 700px;
    margin: 15px auto 0;
}

.stack-info-icon {
    cursor: pointer;
    color: var(--secondary-color);
    margin-left: 10px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--profile-badge-bg);
}

.stack-info-icon:hover {
    transform: scale(1.2);
    background-color: var(--primary-color);
    color: white;
}

.stack-tooltip {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: white;
    color: var(--text-dark);
    padding: 25px;
    border-radius: 15px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.stack-tooltip.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.stack-tooltip-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--profile-badge-bg);
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stack-tooltip-close:hover {
    background-color: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.stack-tooltip h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--profile-badge-bg);
}

.stack-tooltip-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stack-tooltip-overlay.active {
    display: block;
    opacity: 1;
}

.stack-content {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
}

.stack-selection-card, .stack-positions-card {
    background-color: #fff;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    padding: 25px;
    transition: all 0.3s ease;
    border: 1px solid rgba(230, 240, 235, 0.8);
}

.stack-selection-card:hover, .stack-positions-card:hover {
    box-shadow: 0 15px 40px rgba(46, 139, 87, 0.1);
    transform: translateY(-5px);
}

.stack-selection-card {
    flex: 1;
    min-width: 300px;
}

.stack-positions-card {
    flex: 2;
    min-width: 300px;
}

.stack-card-title {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 25px;
    font-size: clamp(1.3rem, 4vw, 1.5rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding-bottom: 12px;
}

.stack-card-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--gradient-1);
    border-radius: 3px;
}

.stack-form-group {
    margin-bottom: 25px;
}

.stack-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.stack-form-select, .stack-form-input {
    width: 100%;
    padding: 12px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    max-width: 344px;
    font-size: 1rem;
    background-color: #f8f9fa;
    transition: all 0.3sease;
}

.stack-form-select:focus, .stack-form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--profile-input-focus);
    background-color: white;
}

.stack-form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 7px;
    display: none;
    padding-left: 5px;
    font-weight: 500;
}

.stack-form-error.active {
    display: block;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.stack-submit-btn {
    display: inline-block;
    background: var(--gradient-1);
    color: var(--text-light);
    border: none;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.stack-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3CB371 0%, #2E8B57 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.stack-submit-btn:hover::before {
    opacity: 1;
}

.stack-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(46, 139, 87, 0.25);
}

.stack-submit-btn:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(46, 139, 87, 0.2);
}

.stack-btn-loading {
    position: relative;
    color: transparent !important;
}

.stack-btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    animation: spin 0.8s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stack-positions-empty {
    text-align: center;
    padding: 35px 0;
    color: var(--secondary-text-color);
    transition: all 0.3s ease;
}

.stack-positions-empty i {
    font-size: 3.5rem;
    color: #e2e8f0;
    margin-bottom: 20px;
    display: block;
}

.stack-positions-empty p {
    font-size: 1.1rem;
    margin: 10px 0 0;
}

.stack-positions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stack-position-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 18px;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
    background-color: white;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stack-position-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    border-color: #d1e0d5;
}

.stack-position-info {
    flex: 1;
    min-width: 250px;
}

.stack-position-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.15rem;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
}

.stack-position-name i {
    margin-right: 8px;
    color: var(--primary-color);
}

.stack-position-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.position-card-view {
    background-color: #f0f7f46b;
    border-radius: 16px;
}

.balance-user {
    font-size: 12px !important;
    padding: 4px;
    background-color: #f0f7f4;
    border-radius: 6px;
}

.stack-position-detail {
    background-color: #f0f7f4;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.stack-position-detail:hover {
    background-color: var(--profile-badge-bg);
    transform: translateY(-2px);
}

.stack-position-detail i {
    margin-right: 6px;
    color: var(--primary-color);
}

.stack-position-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stack-position-close-btn {
    background-color: #f8f9fa;
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
}

.stack-position-close-btn.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    animation: fadeIn 0.5s forwards;
}

.stack-position-close-btn:hover {
    background-color: var(--error);
    color: white;
    border-color: var(--error);
    transform: scale(1.05);
}

.stack-position-revenue {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: rgba(0, 200, 81, 0.1);
    border-radius: 8px;
}

.stack-position-revenue i {
    font-size: 1rem;
}

.stack-company-logo {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    background-color: #f0f7f4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Адаптивность */
@media screen and (max-width: 1024px) {
    .stack-container {
        padding: 15px;
    }
    
    .stack-content {
        flex-direction: column;
    }
    
    .stack-selection-card, .stack-positions-card {
        width: 100%;
        min-width: unset;
    }
    
    .stack-position-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stack-position-actions {
        margin-top: 15px;
        width: 100%;
        justify-content: space-between;
    }
}

@media screen and (max-width: 768px) {
    .stack-header h1 {
        font-size: 1.8rem;
    }
    
    .stack-card-title {
        font-size: 1.3rem;
    }
    
    .stack-position-details {
        flex-direction: column;
        gap: 8px;
    }
    
    .stack-position-detail {
        width: fit-content;
    }
}