/* ========================================
   GAUGE - EDH Deck Analyzer Styles
   ======================================== */

/* ========================================
   CSS Variables & Theme Support
   ======================================== */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --card-bg: #ecf0f1;
    --table-header-bg: #34495e;
    --table-header-text: #ffffff;
    --hover-bg: #f8f9fa;
}

.dark {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #444;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --card-bg: #3a3a3a;
    --table-header-bg: #1a1a1a;
    --table-header-text: #ffffff;
    --hover-bg: #404040;
}

/* ========================================
   Base Layout & Typography
   ======================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

h1 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 30px;
}

/* ========================================
   Input Section
   ======================================== */
.input-section {
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-family: monospace;
    font-size: 14px;
    resize: vertical;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* ========================================
   Buttons & Controls
   ======================================== */
.button-group {
    text-align: center;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Spinning animation for analyze button */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
    pointer-events: none;
}

.spinning::before {
    content: "⟳ ";
    margin-right: 5px;
}

/* ========================================
   Results Section
   ======================================== */
.results-section {
    margin-top: 30px;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.power-level-section h3 {
    color: #e74c3c;
    font-size: 20px;
    font-weight: bold;
}

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

.power-level-section .stats {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ========================================
   Stat Cards
   ======================================== */
.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    transition: background-color 0.3s;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ========================================
   Power Level Cards
   ======================================== */
.power-level-card {
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid;
    transition: all 0.3s ease;
}

.power-level-card.cold {
    background: linear-gradient(135deg, #006064, #00838f);
    border-color: #006064;
}

.power-level-card.cool {
    background: linear-gradient(135deg, #00838f, #26a69a);
    border-color: #00838f;
}

.power-level-card.mild {
    background: linear-gradient(135deg, #26a69a, #4caf50);
    border-color: #26a69a;
}

.power-level-card.warm {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    border-color: #4caf50;
}

.power-level-card.hot {
    background: linear-gradient(135deg, #8bc34a, #ff9800);
    border-color: #8bc34a;
}

.power-level-card.very-hot {
    background: linear-gradient(135deg, #ff9800, #ff5722);
    border-color: #ff9800;
}

.power-level-card.extreme {
    background: linear-gradient(135deg, #ff5722, #e74c3c);
    border-color: #ff5722;
}

.power-level-card.maximum {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: #e74c3c;
}

.power-level-card .stat-value {
    font-size: 36px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.power-level-card .stat-label {
    color: #f8f9fa;
    font-size: 16px;
    font-weight: bold;
}

.power-level-card .feature-contribution,
.power-level-card .gamma-info {
    color: #f8f9fa;
}

.gamma-info {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.feature-contribution {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   Normalized Indices Row
   ======================================== */
.normalized-indices-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.index-card {
    flex: 1;
    max-width: 200px;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #ccc;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

/* Dynamic color classes for indices based on 0-10 scale */
.index-blue-0 { background: linear-gradient(135deg, #42a5f5, #1e88e5); border-color: #1565c0; color: white; }
.index-blue-1 { background: linear-gradient(135deg, #1e88e5, #1976d2); border-color: #0d47a1; color: white; }
.index-blue-2 { background: linear-gradient(135deg, #1976d2, #1565c0); border-color: #0d47a1; color: white; }
.index-blue-3 { background: linear-gradient(135deg, #1565c0, #0d47a1); border-color: #0b3c91; color: white; }

.index-green-4 { background: linear-gradient(135deg, #66bb6a, #43a047); border-color: #2e7d32; color: white; }
.index-green-5 { background: linear-gradient(135deg, #43a047, #388e3c); border-color: #2e7d32; color: white; }
.index-green-6 { background: linear-gradient(135deg, #2e7d32, #1b5e20); border-color: #1b5e20; color: white; }

.index-red-7 { background: linear-gradient(135deg, #ef5350, #e53935); border-color: #b71c1c; color: white; }
.index-red-8 { background: linear-gradient(135deg, #e53935, #d32f2f); border-color: #b71c1c; color: white; }
.index-red-9 { background: linear-gradient(135deg, #d32f2f, #c62828); border-color: #b71c1c; color: white; }
.index-red-10 { background: linear-gradient(135deg, #c62828, #b71c1c); border-color: #b71c1c; color: white; }

/* Original styling classes - these will be overridden by dynamic colors */
.popularity-index {
    /* Will be overridden by dynamic color classes */
}

.salt-index {
    /* Will be overridden by dynamic color classes */
}

.speed-index {
    /* Will be overridden by dynamic color classes */
}

.index-value {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.index-label {
    font-size: 14px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ========================================
   Raw Metrics Row
   ======================================== */
.raw-metrics-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.metric-card {
    flex: 1;
    max-width: 200px;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid;
    transition: all 0.3s ease;
}

.rank-metric {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    border-color: #7b1fa2;
}

.salt-metric {
    background: linear-gradient(135deg, #ff5722, #d84315);
    border-color: #d84315;
}

.cmc-metric {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    border-color: #388e3c;
}

.metric-value {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.metric-label {
    font-size: 14px;
    font-weight: bold;
    color: #f8f9fa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Deck Status Messages
   ======================================== */
.deck-status-message {
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: bold;
    text-align: center;
}

.deck-status-message.error {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left: 4px solid #c62828;
}

.deck-status-message.warning {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left: 4px solid #ff9800;
}

.dark .deck-status-message.error {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left-color: #ff6b6b;
}

.dark .deck-status-message.warning {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left-color: #ffb366;
}

/* ========================================
   Vote Buttons
   ======================================== */
.vote-buttons {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.vote-btn {
    position: relative;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    justify-content: center;
    overflow: hidden;
}

.vote-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.vote-btn:hover::before {
    left: 100%;
}

.vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.vote-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vote-btn.too-low {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.vote-btn.too-low:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
}

.vote-btn.ok {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.vote-btn.ok:hover {
    background: linear-gradient(135deg, #43a047 0%, #388e3c 100%);
}

.vote-btn.too-high {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.vote-btn.too-high:hover {
    background: linear-gradient(135deg, #ff8f00 0%, #ef6c00 100%);
}

.vote-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.vote-btn-icon {
    font-size: 14px;
    line-height: 1;
}

.vote-btn-text {
    font-weight: 600;
}

.vote-feedback {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 8px 12px;
    border-radius: 4px;
    background-color: var(--bg-secondary);
}

.vote-feedback.show {
    opacity: 1;
}

.vote-feedback.success {
    color: #ffffff;
    background-color: #4caf50;
}

.vote-feedback.info {
    color: #ffffff;
    background-color: #2196f3;
}

/* ========================================
   Debug Toggle
   ======================================== */
.debug-toggle {
    margin: 20px 0;
    text-align: center;
}

.debug-toggle button {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.debug-toggle button:hover {
    background-color: #7f8c8d;
}

/* ========================================
   Cards Table
   ======================================== */
.cards-table-container {
    max-height: 500px;
    overflow: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 20px;
    background: var(--bg-secondary);
    position: relative;
}

.cards-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    transition: background-color 0.3s;
}

.cards-table thead {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cards-table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 15px;
    text-align: left;
    font-weight: bold;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.cards-table th:hover {
    background-color: #2c3e50;
}

.cards-table th:first-child {
    left: 0;
    z-index: 20;
    background-color: var(--table-header-bg);
    position: -webkit-sticky;
    position: sticky;
}

.cards-table th.sortable::after {
    content: ' ↕';
    opacity: 0.5;
    font-size: 12px;
}

.cards-table th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
    color: #27ae60;
}

.cards-table th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
    color: #e74c3c;
}

.cards-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.cards-table td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    background-color: var(--bg-secondary);
    z-index: 5;
}

.cards-table tr:hover {
    background-color: var(--hover-bg);
}

.cards-table tr:hover td:first-child {
    background-color: var(--hover-bg);
}

.error-row {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

/* ========================================
   Status Messages
   ======================================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #c62828;
}

.success-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #2e7d32;
}

.warning-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #ff9800;
}

.dark .error-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left-color: #ff6b6b;
}

.dark .success-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left-color: #6bff6b;
}

.dark .warning-message {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-left-color: #ffb366;
}

.warning-message div {
    margin-bottom: 8px;
}

.warning-message div:last-child {
    margin-bottom: 0;
}

/* ========================================
   Badges & Indicators
   ======================================== */
.rank-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.rank-excellent { background-color: #27ae60; }
.rank-good { background-color: #3498db; }
.rank-average { background-color: #f39c12; }
.rank-poor { background-color: #e74c3c; }
.rank-unknown { background-color: #95a5a6; }

.saltiness-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.saltiness-high { background-color: #e74c3c; }
.saltiness-medium { background-color: #f39c12; }
.saltiness-low { background-color: #27ae60; }
.saltiness-none { background-color: #95a5a6; }

.percentile-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    background-color: #34495e;
    cursor: help;
    transition: background-color 0.2s;
}

.percentile-badge:hover {
    background-color: #2c3e50;
}

/* ========================================
   Header Controls
   ======================================== */
.header-bar {
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.12);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

/* ========================================
   Deck Browser Table
   ======================================== */
#deck-table { font-size: 14px; }
#deck-table th, #deck-table td { font-size: 14px; }

.header-controls { display: flex; justify-content: center; align-items: center; gap: 15px; }

.logo-section { display: flex; align-items: center; gap: 12px; }

.logo-ascii {
    font-family: monospace;
    font-size: 8px;
    color: #84cc16;
    text-shadow: 0 0 4px rgba(132, 204, 22, 0.35);
    margin: 0;
    line-height: 1;
    letter-spacing: -1px;
}

/* Toolbar refinements */
.header-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.15);
}

.toolbar-btn, .icon-btn, .view-toggle {
    height: 34px;
    line-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 120ms ease, transform 80ms ease, border-color 120ms ease;
}

.toolbar-btn:hover, .icon-btn:hover, .view-toggle:hover { background: rgba(255,255,255,0.08); }

/* Utility */
.hidden { display: none !important; }

.toolbar-btn:active, .icon-btn:active, .view-toggle:active { transform: translateY(1px); }
.icon-btn { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }

/* Logout Button */
.logout-btn {
    background: rgba(231, 76, 60, 0.1) !important;
    border-color: rgba(231, 76, 60, 0.3) !important;
    color: #e74c3c !important;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    border-color: rgba(231, 76, 60, 0.5) !important;
}

#view-analyzer, #view-deck-browser { width: 100%; }
#view-deck-browser[hidden] { display: none !important; }

/* ========================================
   Theme Toggle
   ======================================== */
.theme-toggle-btn {
    padding: 12px;
    border-radius: 8px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.theme-toggle-btn:hover {
    background-color: var(--hover-bg);
    border-color: #3498db;
    transform: scale(1.05);
}

.theme-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* ========================================
   Load Deck Controls
   ======================================== */
.load-deck-inline select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

.load-deck-inline select:focus {
    outline: none;
    border-color: #3498db;
}

/* ========================================
   Deck Manager
   ======================================== */
#deck-manager {
    margin: 15px 0;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: none; /* Hidden by default */
    transition: background-color 0.3s, border-color 0.3s;
}

#deck-manager input[type="text"] {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    margin-right: 10px;
    width: 200px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

#deck-manager input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

#deck-manager button {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    transition: background-color 0.3s;
}

#deck-manager button:hover {
    background-color: #229954;
}

#deck-manager select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    margin-right: 10px;
    min-width: 200px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

#deck-manager select:focus {
    outline: none;
    border-color: #3498db;
}

#deckWarning {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

#deckWarning.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* ========================================
   Bracket Cards
   ======================================== */
.bracket-card {
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    text-align: center;
}

.bracket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.bracket-card.bracket-1 {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-color: #4caf50;
    color: white;
}

.bracket-card.bracket-2 {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-color: #4caf50;
    color: white;
}

.bracket-card.bracket-3 {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #ff9800;
    color: white;
}

.bracket-card.bracket-4 {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-color: #f44336;
    color: white;
}

.bracket-card.bracket-5 {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-color: #f44336;
    color: white;
}

.bracket-info {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
    text-align: left;
    padding: 0 5px;
}

.bracket-info br {
    margin-bottom: 2px;
}

.bracket-info .separator {
    height: 8px;
    display: block;
}

.bracket-card .stat-value {
    font-size: 36px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.bracket-card .stat-label {
    color: #f8f9fa;
    font-size: 16px;
    font-weight: bold;
}

/* ========================================
   Explanation Button
   ======================================== */
.explanation-btn {
    background-color: #9b59b6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.explanation-btn:hover {
    background-color: #8e44ad;
}

/* ========================================
   Modal Styles
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.75);
    /* Center content and provide safe padding around the modal */
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 0; /* Centering handled by flex container */
    padding: 0;
    border-radius: 8px;
    width: 100%;
    max-width: 640px; /* Comfortable width on desktop while mobile uses overlay padding */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

.modal-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #ecf0f1;
}

.modal-body {
    padding: 30px;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 14px;
}

/* ----------------------------------------
   Save Deck Modal – Visual refinements
   ---------------------------------------- */
#saveDeckModal .modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 14px 34px rgba(0,0,0,0.35);
    overflow: hidden;
}

#saveDeckModal .modal-header {
    background: linear-gradient(135deg, #2196f3, #1565c0);
    padding: 16px 20px;
}

#saveDeckModal .modal-body {
    background: var(--bg-secondary);
    padding: 20px;
}

#saveDeckModal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

#saveDeckModal .form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    font-size: 14px;
}

#saveDeckModal .form-group input:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30,136,229,0.2);
    background: var(--bg-secondary);
}

#saveDeckModal .modal-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

#saveDeckModal .btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #1e88e5, #1565c0);
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 6px 14px rgba(21, 101, 192, 0.35);
}

#saveDeckModal .btn-primary:hover {
    background: linear-gradient(135deg, #2196f3, #1565c0);
    transform: translateY(-1px);
}

#saveDeckModal .btn-primary:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    #saveDeckModal .modal-content { border-radius: 10px; }
    #saveDeckModal .btn-primary { padding: 14px; font-size: 16px; }
}

.modal-body p {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-body h3 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 15px;
}

.modal-body h4 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body ul, .modal-body ol {
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body strong {
    color: var(--text-primary);
}

/* ========================================
   Modal Content Sections
   ======================================== */
.tl-dr-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #27ae60;
    color: var(--text-primary);
}

.technical-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #3498db;
    color: var(--text-primary);
}

.usage-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    color: var(--text-primary);
}

.pro-tips {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    color: var(--text-primary);
}

.pro-tips h4 {
    color: var(--text-primary);
    margin-top: 0;
}

/* ========================================
   Deck Types
   ======================================== */
.deck-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.deck-type {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: background-color 0.3s, border-color 0.3s;
}

.deck-type h5 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.deck-type p {
    margin: 5px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.deck-type strong {
    color: var(--text-primary);
}

/* ========================================
   Power Level Visual
   ======================================== */
.power-level-visual {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 8px;
    border-left: 4px solid #9b59b6;
    color: var(--text-primary);
}

.color-scale {
    display: flex;
    gap: 2px;
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.color-item {
    flex: 1;
    padding: 8px 4px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.color-item.cold { background: linear-gradient(135deg, #006064, #00838f); }
.color-item.cool { background: linear-gradient(135deg, #00838f, #26a69a); }
.color-item.mild { background: linear-gradient(135deg, #26a69a, #4caf50); }
.color-item.warm { background: linear-gradient(135deg, #4caf50, #8bc34a); }
.color-item.hot { background: linear-gradient(135deg, #8bc34a, #ff9800); }
.color-item.very-hot { background: linear-gradient(135deg, #ff9800, #ff5722); }
.color-item.extreme { background: linear-gradient(135deg, #ff5722, #e74c3c); }
.color-item.maximum { background: linear-gradient(135deg, #e74c3c, #c0392b); }

/* ========================================
   Help Icon
   ======================================== */
.help-icon {
    color: #3498db;
    cursor: pointer;
    font-weight: bold;
    margin-left: 5px;
    transition: color 0.2s;
}

.help-icon:hover {
    color: #2980b9;
}

/* ========================================
   Weight Display
   ======================================== */
.weight-item {
    cursor: help;
    transition: all 0.2s;
    padding: 2px 4px;
    border-radius: 3px;
}

.weight-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.weight-item.weight-active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.weight-value {
    font-weight: bold;
}

/* ========================================
   Legacy Classes (Unused but kept for compatibility)
   ======================================== */
.deck-save-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.deck-save-row input {
    flex: 1;
}

.deck-save-row button {
    white-space: nowrap;
}

.deck-overview-combined {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.deck-overview-combined .stat-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
}

.deck-size-warning {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.deck-size-warning.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.deck-size-warning.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   Header Profile Container
   ======================================== */
.header-profile-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.header-profile-container:hover {
    background-color: var(--hover-bg);
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.header-profile-container:hover .header-avatar {
    transform: scale(1.05);
}

.header-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

/* ========================================
   Profile Management
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px;
    margin-top: 15px;
    font-size: 14px;
}

.profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1000;
    margin-top: 4px;
}

.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.profile-menu-item:hover {
    background: var(--hover-bg);
}

.profile-menu-item.logout {
    color: #e74c3c;
}

.profile-menu-item.logout:hover {
    background: rgba(231, 76, 60, 0.1);
}

.profile-menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.profile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   Mobile Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 20px; }
    .header-controls { flex-direction: row; align-items: center; gap: 8px; }
    .header-left { justify-content: flex-start; flex: 1; min-width: 0; }
    .logo-section { justify-content: flex-start; gap: 8px; }
    .logo-ascii { font-size: 7px; }
    
    .load-deck-inline select {
        width: 100%;
        min-width: auto;
        max-width: 250px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cards-table {
        font-size: 12px;
    }
    
    .cards-table th,
    .cards-table td {
        padding: 8px 6px;
    }
    
    .button-group {
        flex-direction: row;
        gap: 10px;
        justify-content: center;
    }
    
    .button-group button {
        flex: 1;
        max-width: 200px;
        margin: 0;
    }
    
    .vote-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .vote-btn {
        width: 100%;
        margin: 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .deck-types {
        grid-template-columns: 1fr;
    }
    
    .color-scale {
        flex-direction: column;
        gap: 2px;
    }
    
    .color-item {
        padding: 4px;
        font-size: 10px;
    }
    
    .normalized-indices-row {
        flex-direction: row;
        gap: 8px;
    }
    
    .index-card {
        max-width: none;
        padding: 12px 8px;
        flex: 1;
    }
    
    .index-value {
        font-size: 18px;
    }
    
    .index-label {
        font-size: 11px;
    }
    
    .raw-metrics-row {
        flex-direction: row;
        gap: 8px;
    }
    
    .metric-card {
        max-width: none;
        padding: 12px 8px;
        flex: 1;
    }
    
    .metric-value {
        font-size: 18px;
    }
    
    .metric-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .load-deck-inline select { max-width: 200px; font-size: 12px; padding: 6px 8px; }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .container { padding: 15px; }
    
    textarea {
        height: 150px;
        font-size: 12px;
        padding: 10px;
        width: calc(100% - 4px); /* Account for border */
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .power-level-card .stat-value {
        font-size: 28px;
    }
    
    .theme-toggle-btn { min-width: 40px; min-height: 40px; padding: 8px; }
    
    .theme-icon { width: 18px; height: 18px; }
    .logo-ascii { font-size: 6px; }
} 