body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #1e1e1e;
    color: #f0f0f0;
    margin: 0;
    padding: 20px;
}

.container {
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    margin: auto;
}

header {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    position: relative;
}

#lang-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #444;
    color: #f0f0f0;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

#lang-toggle:hover {
    background-color: #555;
}

h1 {
    text-align: center;
    color: #ff8c00;
    margin: 0;
}

.wcl-url-container {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

#wcl-url {
    flex-grow: 1;
}

#wcl-history-select {
    flex-basis: 30%;
}

#wcl-url {
    width: 100%;
    padding: 10px;
    border-radius: 3px;
    border: 1px solid #444;
    background-color: #333;
    color: #f0f0f0;
    transition: box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

@keyframes highlight {
    0% {
        box-shadow: 0 0 10px rgba(255, 140, 0, 0.7);
        border-color: #ff8c00;
    }
    100% {
        box-shadow: none;
        border-color: #444;
    }
}

.highlight-animation {
    animation: highlight 1s ease-in-out;
}

main {
    display: flex;
    gap: 20px;
}

.sidebar {
    width: 20%;
    min-width: 300px; /* Ensure sidebar doesn't get too cramped */
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 5px;
}

.main-content {
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.config-section h2, .config-section h3 {
    color: #ff8c00;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.attr-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 10px;
}

.attr-group {
    display: flex;
    flex-direction: column;
    flex-basis: 48%;
}

.attributes input, .weapons input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border-radius: 3px;
    border: 1px solid #444;
    background-color: #333;
    color: #f0f0f0;
    box-sizing: border-box;
}

.weapon-names {
    margin-top: 10px;
    font-size: 12px;
    color: #aaa;
}

#analyze-btn {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #ff8c00;
    color: #1e1e1e;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

#analyze-btn:hover {
    background-color: #e07b00;
}

#analyze-btn.loading {
    background-color: #444;
    cursor: not-allowed;
}

#analyze-btn.loading::after {
    content: '...';
    animation: loading-dots 1s infinite;
}

@keyframes loading-dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60% {
        content: '...';
    }
}

#last-analyzed-container {
    margin-top: 10px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

#analyze-btn.loading {
    background-color: #444;
    cursor: not-allowed;
}

#analyze-btn.loading::after {
    content: '...';
    animation: loading-dots 1s infinite;
}

@keyframes loading-dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60% {
        content: '...';
    }
}

#last-analyzed-container {
    margin-top: 10px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.damage-table-container, .charts-container, .dps-gain-container, .dps-stack-container {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 5px;
}

h2 {
    color: #ff8c00;
}

#damage-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#damage-table th, #damage-table td {
    border: 1px solid #444;
    padding: 8px 15px; /* Reduced padding by ~30% */
    text-align: left;
    vertical-align: middle;
    white-space: nowrap; /* Prevent table headers from wrapping */
}

#damage-table th {
    background-color: #333;
    font-weight: bold;
    color: #ff8c00;
}

#damage-table tbody tr:nth-child(even) {
    background-color: #2c2c2c;
}

#damage-table tbody tr:hover {
    background-color: #383838;
}

#damage-table .total-row {
    font-weight: bold;
    color: #ff8c00;
    background-color: #333;
}

.damage-bar-cell {
    position: relative;
    padding: 0 !important;
}

.damage-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(255, 140, 0, 0.3);
    z-index: 1;
}

.damage-text {
    position: relative;
    z-index: 2;
    padding: 8px 15px; /* Reduced padding by ~30% */
    text-align: right;
}

#damage-table .col-damage {
    width: 20%;
    text-align: right;
}

#damage-table .col-dps {
    width: 5%;
    text-align: right;
}

#damage-table .col-ability {
    width: 15%;
}

#damage-table .col-percent,
#damage-table .col-casts,
#damage-table .col-hits,
#damage-table .col-crits,
#damage-table .col-crit-rate,
#damage-table .col-misses,
#damage-table .col-dodge,
#damage-table .col-parry,
#damage-table .col-miss-rate {
    width: 5%;
    text-align: right;
}

.chart-row {
    display: flex;
    gap: 20px;
}

#ap-chart-container {
    width: 27%;
}

#skill-chart-container {
    width: 43%;
}

#crit-hit-chart-container {
    width: 30%;
}

#ap-dps-chart, #skill-dps-chart, #crit-hit-dps-chart {
    width: 100% !important;
    height: 280px !important;
}

#dps-stack-chart {
    width: 100% !important;
    height: 300px !important;
}

#wcl-history-select {
    margin: 0; /* Override margin from shared rule */
}

.config-section select, #wcl-history-select {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 10px;
    border-radius: 3px;
    border: 1px solid #444;
    background-color: #333;
    color: #f0f0f0;
    -webkit-appearance: none; /* Remove default arrow */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23f0f0f0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px auto;
}

.clickable {
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: #2a2a2a;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 1200px;
    border-radius: 5px;
    position: relative;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
}

.modal-table-container {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #555;
}

#details-table {
    table-layout: fixed;
}

#details-table th:not(:first-child),
#details-table td:not(:first-child) {
    text-align: center;
}

#details-table {
    width: 100%;
    border-collapse: collapse;
}

#details-table th, #details-table td {
    border: 1px solid #444;
    padding: 6px 10px;
    text-align: right;
    font-size: 13px;
    white-space: nowrap;
}

#details-table th {
    background-color: #333;
    color: #ff8c00;
    position: sticky;
    top: 0;
}

#details-table th:first-child {
    text-align: left;
    width: 180px;
}

#details-table td:first-child {
    text-align: left;
    font-weight: bold;
    width: 180px;
}

#details-table .total-row td {
    color: #ff8c00;
}
