/* Strategy Card Premium Design */

/* Container for 2-column grid layout */
.strategy-cards-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
    padding: 1rem 0;
    align-items: stretch !important;
}

@media (max-width: 991.98px) {
    .strategy-cards-container {
        grid-template-columns: 1fr !important;
    }
}

/* Wrapper ensures cards fill grid cell completely */
.strategy-card-wrapper {
    display: flex !important;
    min-height: 450px;
}

/* Compact mode for ticker-only display */
.strategy-card-wrapper.ticker-only-mode {
    min-height: auto !important;
}

.strategy-card-wrapper.ticker-only-mode .strategy-card {
    min-height: auto !important;
    height: auto !important;
}

.strategy-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1 !important;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.strategy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #8b5cf6, #ec4899);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.strategy-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.3);
}

.strategy-card:hover::before {
    opacity: 1;
}

/* Chart Config Switcher Icons */
.chart-config-icons {
    display: flex;
    gap: 0.25rem;
}

.chart-config-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
}

.chart-config-btn:hover {
    color: #4f46e5;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.chart-config-btn.active {
    color: #4f46e5;
    background: #e0e7ff;
    border-color: #c7d2fe;
}

.strategy-card-header {
    margin-bottom: 1.25rem;
}

.strategy-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.strategy-count-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
}

.strategy-card-meta {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.strategy-card-body {
    flex: 1;
    margin-bottom: 1.5rem;
}

.strategy-card-desc {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.strategy-ticker-chip {
    background: #f1f5f9;
    color: #334151;
    padding: 0.4rem 0.85rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
}

.strategy-ticker-chip:hover {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.strategy-card-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.btn-strategy-action {
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-strategy-action:hover {
    color: #1e293b;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.btn-ask-ai {
    background: linear-gradient(135deg, #fdf2f8 0%, #fff1f2 100%);
    color: #db2777;
    border: 1px solid #fce7f3;
}

.btn-ask-ai:hover {
    background: linear-gradient(135deg, #fce7f3 0%, #ffe4e6 100%);
    color: #be185d;
    border-color: #fbcfe8;
    box-shadow: 0 4px 6px -1px rgba(219, 39, 119, 0.1);
}

.btn-strategy-arrow {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: #4f46e5;
    transition: all 0.2s ease;
}

.btn-strategy-arrow:hover {
    background: #4f46e5;
    color: #ffffff;
    transform: rotate(-45deg);
}

.settings-btn {
    color: #94a3b8;
    transition: color 0.2s;
}

.settings-btn:hover {
    color: #475569;
}

/* Chart container - proper sizing for charts */
.strategy-card .chart-wrapper,
.chart-wrapper,
.strategy-card .chart-container,
.chart-container {
    position: relative;
    width: 100%;
    /* Remove fixed height to prevent distortion. Use min-height to ensure visibility. */
    min-height: 250px;
    height: auto;
    overflow: hidden;
    /* Prevent spillover */
}

/* Canvas styling */
.strategy-card .chart-wrapper canvas,
.chart-wrapper canvas,
.strategy-card .chart-container canvas,
.chart-container canvas {
    display: block;
    box-sizing: border-box;
    /* Allow Chart.js to manage width/height attributes for correct pixel ratio */
}

/* Footer action buttons */
.strategy-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    position: relative;
    z-index: 10;
    background-color: #fff;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.btn-action-text {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-action-text:hover {
    color: #1e293b;
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-action-text.active {
    background: #dcfce7;
    color: #16a34a;
    border-color: #86efac;
}

.btn-action-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.btn-action-icon:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-action-ai {
    background: linear-gradient(135deg, #fdf2f8 0%, #fff1f2 100%);
    color: #db2777;
    border: 1px solid #fce7f3;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-action-ai:hover {
    background: linear-gradient(135deg, #fce7f3 0%, #ffe4e6 100%);
    color: #be185d;
    border-color: #fbcfe8;
    box-shadow: 0 4px 6px -1px rgba(219, 39, 119, 0.1);
}