/* tierlist.css - Additions for the Tier List View */
:root {
    --bg-secondary: var(--card-bg);
    --bg-tertiary: var(--table-header-bg);
    --border-color: var(--border);
    --primary-color: var(--accent);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}
.tier-list-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.tier-row {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-height: 100px;
}

.tier-label {
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    text-align: center;
}

.tier-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
    flex-grow: 1;
}

.char-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 0;
    width: 140px;
    height: 190px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    isolation: isolate;
}

.char-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.char-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-radius: var(--radius-md);
}

.char-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    padding-top: 6px;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.char-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 2px 4px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
    text-align: center;
}

.char-card-score {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1c40f;
    text-align: center;
    margin-bottom: 4px;
}

.char-card-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.char-tab-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.char-elements-container {
    display: flex;
    gap: 3px;
}

.char-element-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.popup-class-icon, .popup-element-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.char-icon-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    opacity: 0.5;
}

/* Rarity Border Colors */
.char-card.rarity-yukkuri { border-top: 4px solid #a4b0be; }
.char-card.rarity-gen { border-top: 4px solid #b2bec3; }
.char-card.rarity-fes { border-top: 4px solid #f1c40f; }
.char-card.rarity-sfes { border-top: 4px solid #ff69b4; }
.char-card.rarity-bp { border-top: 4px solid #3498db; }
.char-card.rarity-ex { border-top: 4px solid #e74c3c; }
.char-card.rarity-relic { border-top: 4px solid #00ffff; }
.char-card.rarity-genic { border-top: 4px solid #32cd32; }
.char-card.rarity-efes { border-top: 4px solid #9b59b6; }
.char-card.rarity-pure { border-top: 4px solid #ffffff; }
/* Aliases for existing data if any */
.char-card.rarity-l1 { border-top: 4px solid #b2bec3; }
.char-card.rarity-epic { border-top: 4px solid #9b59b6; }

/* Modal Header Backgrounds */
/* Colors for Tiers */
.tier-EX {
    background: linear-gradient(135deg, #ff4b4b, #b30000);
}

.tier-SS {
    background: linear-gradient(135deg, #ff8c00, #d35400);
}

.tier-Splus {
    background: linear-gradient(135deg, #f1c40f, #d4ac0d);
}

.tier-S {
    background: linear-gradient(135deg, #f39c12, #ca6f1e);
}

.tier-Sminus {
    background: linear-gradient(135deg, #e67e22, #ba4a00);
}

.tier-Aplus {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.tier-A {
    background: linear-gradient(135deg, #28b463, #1e8449);
}

.tier-Aminus {
    background: linear-gradient(135deg, #239b56, #186a3b);
}

.tier-Bplus {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.tier-B {
    background: linear-gradient(135deg, #2e86c1, #21618c);
}

.tier-Bminus {
    background: linear-gradient(135deg, #2874a6, #1b4f72);
}

.tier-C {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.tier-D {
    background: linear-gradient(135deg, #7f8c8d, #2c3e50);
}

.tier-E {
    background: linear-gradient(135deg, #5a6a6a, #1a252f);
}

.tier-F {
    background: linear-gradient(135deg, #343434, #111111);
}

/* Modal specific styles */
.char-modal-content {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#char-modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 90%;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.score-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.score-breakdown-table th,
.score-breakdown-table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.score-breakdown-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.score-breakdown-table tr:hover {
    background: var(--bg-tertiary);
}

.modal-scores {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    min-width: 120px;
}

.score-badge.overall { border-color: #f1c40f; }
.score-badge.damage { border-color: #e74c3c; }
.score-badge.support { border-color: #2ecc71; }

.score-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.score-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
}

.modal-divider {
    display: block;
    height: 2px;
    min-height: 2px;
    background-color: #ffffff;
    margin: 1.5rem 0;
    width: 100%;
    border-radius: 2px;
}

.subset-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.subset-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
}

.subset-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.buff-list {
    margin-top: 0.5rem;
    padding-left: 1rem;
}

/* Bar Charts */
.bar-chart-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bar-label {
    width: 220px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    white-space: normal;
    overflow: visible;
    flex-shrink: 0;
}

.bar-track {
    flex-grow: 1;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2980b9);
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    transition: width 0.3s ease;
}

.bar-fill.supp-fill {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

/* Subset Bars */
.subset-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.subset-bar-label {
    width: 30px;
    font-size: 0.75rem;
    font-weight: bold;
}
.subset-bar-track {
    flex-grow: 1;
    height: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.subset-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    display: flex;
    align-items: center;
    padding-left: 0.25rem;
    font-size: 0.65rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    transition: width 0.3s ease;
}
.buff-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 8px;
    padding-left: 38px;
}
.buff-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Modal Header Tile Styling */
.modal-header.rarity-yukkuri { border-top: 4px solid #a4b0be; }
.modal-header.rarity-gen { border-top: 4px solid #b2bec3; }
.modal-header.rarity-fes { border-top: 4px solid #f1c40f; }
.modal-header.rarity-sfes { border-top: 4px solid #ff69b4; }
.modal-header.rarity-bp { border-top: 4px solid #3498db; }
.modal-header.rarity-ex { border-top: 4px solid #e74c3c; }
.modal-header.rarity-relic { border-top: 4px solid #00ffff; }
.modal-header.rarity-genic { border-top: 4px solid #32cd32; }
.modal-header.rarity-efes { border-top: 4px solid #9b59b6; }
.modal-header.rarity-pure { border-top: 4px solid #ffffff; }
.modal-header.rarity-l1 { border-top: 4px solid #b2bec3; }
.modal-header.rarity-epic { border-top: 4px solid #9b59b6; }

.modal-header.yin-bg::before {
    content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.3); z-index: 0; pointer-events: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header.yang-bg::before {
    content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.1); z-index: 0; pointer-events: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header {
    position: relative;
    overflow: hidden;
}
.modal-header > * {
    z-index: 1;
    position: relative;
}

/* Weights Modal Styles */
.weights-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.weights-table th, .weights-table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: center;
}

.weights-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.weights-table td.scenario-name {
    text-align: left;
    font-weight: 500;
    color: var(--primary-color);
}

.weights-table input[type="number"] {
    width: 80px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.weights-table input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.weights-table input[type="number"].invalid {
    border-color: #ff4d4d;
    background-color: rgba(255, 77, 77, 0.1);
}