/* Embed Decklist Styling */
.embed-decklist-container {
    margin: 20px 0;
    padding: 0;
}

.embed-decklist-container.loading {
    min-height: 50px;
}

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

.decklist-error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
}

.embed-decklist {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.decklist-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
}

.decklist-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #212529;
}

.decklist-description {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

.decklist-cards-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.decklist-cards {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    padding-left: 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .decklist-card-item[style*="background-image"] {
        background-size: 95% auto !important;
        background-position: center 59% !important;
    }
    
    .cost-curve-chart {
        padding: 80px 0 10px 0 !important;
        min-height: 200px;
    }
    
    .bar-value {
        top: -40px;
    }
}

@media (max-width: 480px) {
    .pie-charts-row {
        gap: 4px;
    }
    
    .pie-chart-section h4 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .pie-chart {
        width: 70px;
        height: 70px;
    }
    
    .pie-center {
        width: 30px;
        height: 30px;
    }
    
    .cost-curve-chart {
        height: 100px;
        padding: 80px 0 10px 0 !important;
        gap: 2px;
        overflow-y: visible;
        min-height: 180px;
    }
    
    .cost-curve-section {
        padding-top: 0;
        margin-top: 0;
    }
    
    .bar-value {
        top: -40px;
    }
}

@media (max-width: 600px) {
    .cost-curve-chart {
        padding: 85px 0 10px 0 !important;
        min-height: 185px;
    }
}

@media (max-width: 400px) {
    .cost-curve-section {
        padding-top: 0;
        margin-top: 0;
    }
    
    .cost-curve-chart {
        padding: 80px 0 10px 0 !important;
        min-height: 180px;
    }
    
    .bar-value {
        top: -40px;
    }
}

@media (max-width: 360px) {
    .cost-curve-section {
        padding-top: 0;
        margin-top: 0;
    }
    
    .cost-curve-chart {
        padding: 60px 0 10px 0;
        min-height: 160px;
    }
    
    .bar-value {
        top: -40px;
    }
    
    .cost-bar {
        min-width: 14px;
    }
    
    .cost-label {
        font-size: 10px;
    }
}

.decklist-card-item {
    padding: 4px 12px 4px 8px;
    margin-bottom: 4px;
    margin-left: 0;
    background-color: #ffffff;
    border-left: 3px solid #007bff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
    width: 100%;
    max-width: 100%;
    height: 24px;
    min-height: 24px;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}

.decklist-card-item:hover {
    background-color: #f0f8ff;
}

.decklist-card-item:last-child {
    margin-bottom: 0;
}

.decklist-card-item .card-quantity {
    font-weight: 600;
    color: #007bff;
    min-width: 32px;
    font-size: 14px;
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
    padding-right: 4px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}

.card-name {
    color: #212529;
    font-size: 15px;
    line-height: 1.4;
    flex: 1;
}

/* Deck Stats Section */
.decklist-stats {
    margin-top: 24px;
    margin-bottom: 24px;
    padding: 20px 20px 10px 20px;
    background-color: rgba(26, 26, 46, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

@media (max-width: 768px) {
    .decklist-stats {
        margin-top: 0.5rem;
        margin-bottom: 0;
        padding: 10px 16px 8px 16px;
    }
}

/* Cost Curve Chart */
.cost-curve-section {
    margin-bottom: 24px;
    margin-top: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    padding-top: 0;
}

.cost-curve-section h4 {
    display: none;
}

.cost-curve-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

.cost-curve-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

.cost-curve-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 140px;
    padding: 50px 0 10px 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: visible;
    min-height: 190px;
}

.cost-bar {
    flex: 1;
    min-width: 30px;
    max-width: 50px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.cost-bar:hover {
    opacity: 0.8;
}

.cost-bar-segment {
    width: 100%;
    transition: opacity 0.2s ease;
}

.bar-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.cost-labels {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 600px;
    margin-top: 8px;
}

.cost-label {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #cbd5e1;
    min-width: 30px;
    max-width: 50px;
}

/* Pie Charts Row */
.pie-charts-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 16px;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pie-chart-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pie-chart-section h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
    text-align: center;
}

.pie-chart-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pie-chart {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pie-chart:hover {
    transform: scale(1.05);
}

.pie-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(26, 26, 46, 0.95);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Card Count */
.decklist-card-count {
    width: 100%;
    text-align: center;
    margin: 0.5rem 0 0 0;
}

@media (max-width: 768px) {
    .decklist-card-count {
        margin: 0.5rem 0 0 0;
    }
}

.decklist-card-count span {
    font-weight: 700;
    color: #f8fafc;
    font-size: 1.1rem;
}

/* Tooltip */
.chart-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .embed-decklist {
        padding: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .decklist-title {
        font-size: 18px;
    }
    
    .card-name {
        font-size: 14px;
    }
    
    .decklist-stats {
        padding: 10px 16px 0 16px;
        margin-top: 0.5rem;
        margin-bottom: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .pie-charts-row {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .pie-chart-section {
        flex: 1;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .pie-chart-section h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .pie-chart {
        width: 80px;
        height: 80px;
    }
    
    .pie-center {
        width: 35px;
        height: 35px;
    }
    
    .cost-curve-section {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: visible;
    }
    
    .cost-curve-wrapper,
    .cost-curve-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: visible;
    }
    
    .cost-curve-chart {
        width: 100%;
        max-width: 100%;
        height: 120px;
        padding: 80px 0 10px 0 !important;
        gap: 3px;
        box-sizing: border-box;
        overflow-x: auto;
        overflow-y: visible;
        min-height: 200px;
    }
    
    .bar-value {
        top: -40px;
    }
    
    .cost-bar {
        min-width: 16px;
        max-width: 40px;
    }
    
    .cost-label {
        min-width: 16px;
        max-width: 40px;
        font-size: 10px;
    }
}
