/* Styles for UI Customization, Bookmarks and Battle Log */

/* UI Customization Panel */
.ui-customization-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    background: var(--dark);
    border-radius: 15px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ui-customization-panel.visible {
    opacity: 1;
    visibility: visible;
}

.ui-customization-panel h3 {
    color: var(--secondary);
    margin: 0 0 15px 0;
    text-align: center;
}

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

.settings-group h4 {
    color: var(--light);
    margin: 0 0 10px 0;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 5px;
}

.theme-options, .layout-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.theme-option, .layout-option {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 100px;
}

.theme-option:hover, .layout-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.theme-option.selected, .layout-option.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.theme-preview, .layout-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.default-theme {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

.dark-theme {
    background: linear-gradient(135deg, #121212, #1e1e30, #121220);
}

.high-contrast-theme {
    background: linear-gradient(135deg, #000000, #222222);
}

.cosmic-theme {
    background: linear-gradient(135deg, #20024a, #090979, #00d4ff);
}

.default-layout {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Crect x='5' y='5' width='50' height='10' rx='2' fill='white' fill-opacity='0.7'/%3E%3Crect x='5' y='20' width='50' height='35' rx='2' fill='white' fill-opacity='0.7'/%3E%3C/svg%3E");
}

.compact-layout {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Crect x='5' y='5' width='50' height='8' rx='2' fill='white' fill-opacity='0.7'/%3E%3Crect x='5' y='18' width='23' height='37' rx='2' fill='white' fill-opacity='0.7'/%3E%3Crect x='32' y='18' width='23' height='37' rx='2' fill='white' fill-opacity='0.7'/%3E%3C/svg%3E");
}

.expanded-layout {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Crect x='5' y='5' width='50' height='10' rx='2' fill='white' fill-opacity='0.7'/%3E%3Crect x='5' y='20' width='50' height='15' rx='2' fill='white' fill-opacity='0.7'/%3E%3Crect x='5' y='40' width='50' height='15' rx='2' fill='white' fill-opacity='0.7'/%3E%3C/svg%3E");
}

.close-settings-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    align-self: center;
}

.close-settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Bookmarks Panel */
.bookmarks-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    background: var(--dark);
    border-radius: 15px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.bookmarks-panel.visible {
    transform: translateX(0);
}

.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-dark);
    border-bottom: 1px solid var(--card-border);
}

.bookmarks-header h3 {
    margin: 0;
    color: white;
}

.close-bookmarks-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.bookmarks-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: var(--light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: rgba(123, 44, 191, 0.3);
    color: var(--secondary);
    font-weight: bold;
}

.bookmarks-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.tab-content {
    display: none;
}

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

.no-bookmarks {
    text-align: center;
    padding: 20px;
    color: var(--light);
    font-style: italic;
}

.bookmarks-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.bookmark-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bookmark-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.bookmark-preview {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.bookmark-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.battle-icon, .story-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(36, 0, 70, 0.5);
}

.bookmark-info {
    flex: 1;
}

.bookmark-info h4 {
    margin: 0 0 5px 0;
    color: var(--light);
    font-size: 1rem;
}

.bookmark-info p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.bookmark-elements {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.bookmark-date {
    font-size: 0.8rem;
    margin-top: 5px;
}

.story-snippet {
    font-style: italic;
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.8;
}

.delete-bookmark {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 62, 62, 0.8);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bookmark-item:hover .delete-bookmark {
    opacity: 1;
}

/* Battle Log Panel */
.battle-log-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    height: 80vh;
    background: var(--dark);
    border-radius: 15px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.battle-log-panel.visible {
    opacity: 1;
    visibility: visible;
}

.battle-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-dark);
    border-bottom: 1px solid var(--card-border);
}

.battle-log-header h3 {
    margin: 0;
    color: white;
}

.battle-log-controls {
    display: flex;
    gap: 10px;
}

.stats-view-btn, .history-view-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 5px 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stats-view-btn:hover, .history-view-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stats-view-btn.active, .history-view-btn.active {
    background: var(--secondary);
}

.close-battle-log-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    margin-left: 10px;
}

.battle-log-filters {
    display: flex;
    padding: 10px 15px;
    background: rgba(15, 12, 41, 0.6);
    gap: 10px;
    flex-wrap: wrap;
}

.character-filter, .winner-filter {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: rgba(36, 0, 70, 0.5);
    color: var(--light);
}

.clear-filters-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 5px 15px;
    color: white;
    cursor: pointer;
}

.battle-log-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: none;
}

.battle-log-content.active {
    display: block;
}

.no-logs, .no-stats {
    text-align: center;
    padding: 20px;
    color: var(--light);
    font-style: italic;
}

.battle-logs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.battle-log-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
}

.battle-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(36, 0, 70, 0.5);
}

.battle-opponents {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fighter {
    display: flex;
    align-items: center;
    gap: 5px;
}

.fighter-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.fighter-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fighter-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(123, 44, 191, 0.4);
    color: white;
}

.fighter-name {
    font-size: 0.9rem;
    color: var(--light);
}

.versus {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary);
}

.battle-log-summary {
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
}

.battle-title {
    font-weight: bold;
    color: var(--light);
}

.battle-result {
    color: rgba(255, 255, 255, 0.7);
}

.winner-name {
    color: var(--secondary);
    font-weight: bold;
}

.battle-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.expand-log, .delete-log {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.battle-log-details {
    padding: 15px;
    border-top: 1px solid var(--card-border);
    display: none;
}

.battle-log-details.visible {
    display: block;
}

.detail-section {
    margin-bottom: 10px;
}

.detail-section h4 {
    margin: 0 0 5px 0;
    color: var(--primary);
    font-size: 0.9rem;
}

.detail-section p {
    margin: 0;
    color: var(--light);
    font-size: 0.9rem;
}

.replay-battle-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.replay-battle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.battle-log-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(15, 12, 41, 0.6);
    border-top: 1px solid var(--card-border);
}

.clear-history-btn {
    background: rgba(255, 62, 62, 0.8);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
}

.battle-log-count {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Battle Stats View */
.battle-stats-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-overview {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-card {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--light);
}

.stats-detail-section {
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 15px;
}

.stats-detail-section h4 {
    margin: 0 0 10px 0;
    color: var(--secondary);
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 5px;
}

.top-fighters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-fighter {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 12, 41, 0.4);
    border-radius: 10px;
    padding: 10px;
}

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

.fighter-stats {
    flex: 1;
}

.fighter-record {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.top-environments {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.environment-stat {
    display: flex;
    align-items: center;
    gap: 10px;
}

.environment-name {
    width: 120px;
    font-size: 0.9rem;
    color: var(--light);
}

.environment-bar {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.environment-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    border-radius: 5px;
}

.environment-count {
    width: 80px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.all-fighters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.fighter-stat-card {
    background: rgba(15, 12, 41, 0.4);
    border-radius: 10px;
    padding: 10px;
}

.fighter-stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.fighter-image.small {
    width: 30px;
    height: 30px;
}

.fighter-stat-name {
    font-weight: bold;
    color: var(--light);
    font-size: 0.9rem;
}

.fighter-stat-type {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
}

.fighter-stat-record {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.wins {
    color: #4CAF50;
}

.losses {
    color: #ff3e3e;
}

.fighter-win-rate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.win-rate-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.win-rate-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.win-rate-fill {
    height: 100%;
    background: linear-gradient(to right, #4CAF50, #8BC34A);
    border-radius: 3px;
}

.win-rate-value {
    font-size: 0.8rem;
    color: #4CAF50;
    width: 40px;
    text-align: right;
}

/* Custom Theme Classes */
.high-contrast-theme {
    --primary: #ffffff;
    --primary-dark: #dddddd;
    --secondary: #ffcc00;
    --dark: #000000;
    --light: #ffffff;
    --card-bg: rgba(40, 40, 40, 0.9);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #dddddd;
    --bg-gradient: linear-gradient(135deg, #000000, #111111);
}

.high-contrast-theme body {
    background: var(--bg-gradient);
    color: var(--text-primary);
}

.cosmic-theme {
    --primary: #9d4edd;
    --primary-dark: #6a00ff;
    --secondary: #00d4ff;
    --dark: #090979;
    --light: #f0f8ff;
    --card-bg: rgba(9, 9, 121, 0.6);
    --card-border: rgba(0, 212, 255, 0.4);
    --text-primary: #f0f8ff;
    --text-secondary: #bbd8ff;
    --bg-gradient: linear-gradient(135deg, #20024a, #090979, #00d4ff);
}

.cosmic-theme body {
    background: var(--bg-gradient);
    color: var(--text-primary);
}

/* Layout Classes */
.compact-layout .elements-grid,
.compact-layout .canon-characters-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.compact-layout .element-card,
.compact-layout .gender-card,
.compact-layout .battle-setting-card,
.compact-layout .story-setting-card,
.compact-layout .battle-type-card {
    padding: 10px 8px;
}

.compact-layout .element-icon {
    font-size: 1.5rem;
}

.compact-layout .character-section {
    margin-bottom: 15px;
}

.expanded-layout .element-card,
.expanded-layout .gender-card,
.expanded-layout .battle-setting-card,
.expanded-layout .story-setting-card,
.expanded-layout .battle-type-card {
    padding: 20px 15px;
}

.expanded-layout .element-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.expanded-layout .character-section {
    margin-bottom: 35px;
}

.expanded-layout h2 {
    font-size: 3rem;
}

/* Feature Buttons */
.feature-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 900;
}

.feature-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.feature-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.customize-btn {
    background: linear-gradient(to right, #9d4edd, #6a00ff);
}

.bookmarks-btn {
    background: linear-gradient(to right, #ff9e00, #ff5e62);
}

.battle-log-btn {
    background: linear-gradient(to right, #0077b6, #00b4d8);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ui-customization-panel {
        width: 90%;
    }
    
    .bookmarks-panel {
        width: 90%;
        right: 5%;
        top: 10%;
        max-height: 80%;
    }
    
    .battle-log-panel {
        width: 95%;
        height: 90vh;
    }
    
    .feature-buttons {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
    
    .theme-option, .layout-option {
        width: 80px;
    }
    
    .battle-opponents {
        flex-direction: column;
    }
    
    .stats-overview {
        flex-direction: column;
    }
    
    .all-fighters-grid {
        grid-template-columns: 1fr;
    }
}