:root {
    --primary-color: #8B4513;
    --secondary-color: #DAA520;
    --background: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --border-color: #444;
    --success: #4CAF50;
    --danger: #f44336;
    --xp-color: #9C27B0;
    --balance-color: #FFD700;
    --damage-color: #FF5722;
    --healing-color: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    background: var(--card-bg);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 40px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--secondary-color);
    background: rgba(218, 165, 32, 0.1);
    transform: translateY(-5px);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    width: 80px;
    height: 80px;
    color: var(--secondary-color);
}

.drop-zone h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.drop-zone p {
    color: var(--text-secondary);
}

/* Dashboard */
.dashboard {
    animation: fadeIn 0.5s ease;
}

.dashboard.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Session Info */
.session-info {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.session-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.session-info h2 {
    color: var(--secondary-color);
    margin: 0;
}

.info-card {
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.info-label {
    color: var(--text-secondary);
    margin-right: 10px;
}

.info-value {
    color: var(--secondary-color);
    font-weight: bold;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-card.xp {
    border-color: var(--xp-color);
}

.stat-card.balance {
    border-color: var(--balance-color);
}

.stat-card.damage {
    border-color: var(--damage-color);
}

.stat-card.healing {
    border-color: var(--healing-color);
}

.stat-icon {
    font-size: 3rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-value.positive-balance {
    color: #4CAF50;
}

.stat-value.negative-balance {
    color: #f44336;
}

.stat-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.chart-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--border-color);
    max-height: 350px;
}

.chart-container h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1rem;
}

.chart-container canvas {
    max-height: 280px;
}

/* Monsters Section */
.monsters-section,
.loot-section {
    margin-bottom: 40px;
}

.monsters-section h2,
.loot-section h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.monsters-grid,
.loot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.monster-card,
.loot-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.monster-card:hover,
.loot-card:hover {
    transform: translateY(-3px);
    border-color: var(--secondary-color);
    box-shadow: 0 5px 20px rgba(218, 165, 32, 0.2);
}

.monster-image,
.loot-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 5px;
}

.monster-info,
.loot-info {
    flex: 1;
}

.monster-name,
.loot-name {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
    text-transform: capitalize;
}

.monster-count,
.loot-count {
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: bold;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .monsters-grid,
    .loot-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 15px 25px;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Save Button */
.save-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(218, 165, 32, 0.4);
}

.save-btn:active {
    transform: translateY(0);
}

.save-btn.saved {
    background: var(--success);
}

/* History Controls */
.history-controls {
    margin-bottom: 30px;
}

.history-controls h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--secondary-color);
    background: rgba(218, 165, 32, 0.1);
}

.filter-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--background);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--secondary-color);
    background: rgba(218, 165, 32, 0.1);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.danger-btn {
    background: rgba(244, 67, 54, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.danger-btn:hover:not(:disabled) {
    background: rgba(244, 67, 54, 0.2);
    border-color: var(--danger);
}

/* History List */
.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.history-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.history-card:hover {
    transform: translateY(-3px);
    border-color: var(--secondary-color);
    box-shadow: 0 5px 20px rgba(218, 165, 32, 0.2);
}

.history-card.selected {
    border-color: var(--secondary-color);
    background: rgba(218, 165, 32, 0.1);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.history-card-creatures {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    min-height: 56px;
    align-items: center;
}

.creature-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    cursor: help;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.creature-icon:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 4px 8px rgba(218, 165, 32, 0.5));
    z-index: 10;
}

.no-creatures {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.history-card-date {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

.history-card-actions {
    display: flex;
    gap: 8px;
}

.history-card-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.share-btn {
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid var(--success);
    color: var(--success);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: var(--success);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.share-history-btn {
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid var(--success);
    color: var(--success);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-history-btn:hover {
    background: var(--success);
    transform: scale(1.1);
}

.delete-btn {
    background: var(--danger);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.history-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.history-stat {
    display: flex;
    flex-direction: column;
}

.history-stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 3px;
}

.history-stat-value {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 1rem;
}

.history-stat-value.positive-balance {
    color: #4CAF50;
}

.history-stat-value.negative-balance {
    color: #f44336;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

/* Global Stats */
.global-stats h2 {
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.global-totals,
.global-averages,
.global-records,
.global-highlights,
.global-achievements {
    margin-bottom: 40px;
}

.global-section-title {
    color: var(--secondary-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.global-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.global-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.global-card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.global-card-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.global-card-value {
    color: var(--secondary-color);
    font-size: 1.8rem;
    font-weight: bold;
}

.global-card-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Creature highlights */
.creature-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.highlight-creature-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Top creatures */
.top-creatures {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.top-creature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.creature-rank {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.2rem;
    min-width: 30px;
}

.top-creature-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.top-creature-info {
    flex: 1;
}

.top-creature-name {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 0.95rem;
}

.top-creature-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.achievement-badge {
    background: var(--card-bg);
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-badge:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(218, 165, 32, 0.3);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.achievement-title {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 5px;
}

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

/* Comparison Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--secondary-color);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--card-bg);
    color: var(--danger);
}

.comparison-content {
    padding: 25px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.comparison-session {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.comparison-session h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    text-align: center;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    padding: 15px 25px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Updates */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        flex: 1;
        min-width: 120px;
    }

    .history-list {
        grid-template-columns: 1fr;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}
