body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
}

.top-nav {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-nav a {
    flex: 1;
    padding: 12px 20px;
    background: white;
    color: #4a5568;
    text-decoration: none;
    text-align: center;
    font-weight: 500;
    border: none;
    transition: all 0.2s;
}

.top-nav a:hover {
    background: #edf2f7;
}

.top-nav a.active {
    background: #4a5568;
    color: white;
}

h1 {
    color: #333;
    text-align: center;
}

.toolbar {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    align-items: center;
}

#character-name {
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 180px;
}

.toolbar-select {
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
    background: white;
    cursor: pointer;
}

#export-btn, #import-btn {
    background-color: #2196F3;
    color: white;
}

#export-btn:hover, #import-btn:hover {
    background-color: #0b7dda;
}

.equipment-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
    flex: 1;
}

.main-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.stats-panel {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 280px;
    position: sticky;
    top: 20px;
}

.stats-panel h2 {
    margin-top: 0;
    color: #555;
    font-size: 1.2em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.stats-group {
    margin-bottom: 20px;
}

.stats-group:last-child {
    margin-bottom: 0;
}

.stats-group-title {
    font-size: 0.85em;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9em;
}

.stat-name {
    color: #555;
}

.stat-value {
    font-weight: bold;
    color: #333;
}

.stat-value.positive {
    color: #2e7d32;
}

.stat-value-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-value.at-cap {
    color: #ff9800;
}

.stat-value.over-cap {
    color: #f44336;
}

.stat-indicator {
    font-size: 0.9em;
}

.stat-wasted {
    font-size: 0.7em;
    color: #f44336;
    font-weight: normal;
}

.equipment-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.equipment-section h2 {
    margin-top: 0;
    color: #555;
    font-size: 1.2em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.slot-grid {
    display: grid;
    gap: 15px;
}

.armor-slots {
    grid-template-columns: repeat(3, 1fr);
}

.weapon-slots {
    grid-template-columns: repeat(4, 1fr);
}

.jewelry-slots {
    grid-template-columns: repeat(4, 1fr);
}

.slot {
    background: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 15px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.slot:hover {
    border-color: #4CAF50;
    background: #f0f7f0;
}

.slot.equipped {
    border-style: solid;
    border-color: #4CAF50;
    background: #e8f5e9;
}

.slot-label {
    font-size: 0.75em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.slot-content {
    font-size: 0.9em;
    color: #333;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.slot.equipped .slot-content {
    font-weight: bold;
    color: #2e7d32;
}

.slot-item-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.85em;
}

.slot-stat {
    font-size: 0.75em;
    color: #555;
    line-height: 1.3;
}

.slot.has-item .slot-label {
    display: none;
}

.slot.has-item {
    padding: 10px;
}

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

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 25px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

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

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.input-section, .preview-section {
    display: flex;
    flex-direction: column;
}

.input-section label, .preview-section label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
}

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 4px;
}

.filter-group select {
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.filter-group select:focus {
    outline: none;
    border-color: #4CAF50;
}

.search-group {
    flex: 1;
}

.search-group input {
    margin-bottom: 0;
}

textarea {
    width: 100%;
    height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

#item-search {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

#item-search:focus {
    outline: none;
    border-color: #4CAF50;
}

.item-list {
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 250px;
    overflow-y: auto;
    background: #fafafa;
}

.item-list .placeholder {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.item-row {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.item-row:hover {
    background-color: #f0f7f0;
}

.item-row.selected {
    background-color: #e8f5e9;
    border-left: 3px solid #4CAF50;
}

.item-row .item-name {
    font-weight: bold;
    font-size: 0.9em;
    color: #333;
    margin-bottom: 4px;
}

.item-row .item-stats-preview {
    font-size: 0.75em;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-row.show-more {
    color: #888;
    font-size: 0.8em;
    text-align: center;
    cursor: default;
}

.buttons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

button {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.convert-btn {
    background-color: #4CAF50;
    color: white;
}

.convert-btn:hover {
    background-color: #45a049;
}

.equip-btn {
    background-color: #2196F3;
    color: white;
}

.equip-btn:hover {
    background-color: #0b7dda;
}

.equip-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.clear-btn {
    background-color: #f44336;
    color: white;
}

.clear-btn:hover {
    background-color: #da190b;
}

.clear-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.preview-content {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    min-height: 200px;
    font-size: 0.9em;
}

.preview-content .placeholder {
    color: #999;
    font-style: italic;
}

.preview-content .item-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #2e7d32;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.preview-content .item-location {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 4px;
}

.preview-content .item-offhand {
    font-size: 0.8em;
    color: #1976d2;
    font-style: italic;
    margin-bottom: 8px;
}

.preview-content .item-armor-type {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-content .item-class-restriction {
    font-size: 0.85em;
    color: #c62828;
    margin-bottom: 8px;
    font-style: italic;
}

.preview-content .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.preview-content .stat-effect {
    color: #555;
}

.preview-content .stat-value {
    font-weight: bold;
    color: #333;
}

.error {
    color: #f44336;
    margin-top: 10px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
    display: none;
}

.error.show {
    display: block;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .stats-panel {
        width: 100%;
        position: static;
    }

    .armor-slots, .weapon-slots, .jewelry-slots {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-body {
        grid-template-columns: 1fr;
    }
}
