/* ValueStreet Main Styles */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* App Layout */
#app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

/* Header */
.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-light);
    letter-spacing: -0.5px;
}

.logo:hover {
    color: var(--color-accent);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--color-bg-sunken);
    color: var(--color-text);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-sm);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: all var(--transition-fast);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--color-bg-elevated);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: var(--space-lg) 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.nav-section {
    padding: 0 var(--space-lg);
}

.nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.nav-link {
    display: block;
    padding: var(--space-sm) 0;
    color: var(--color-text);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-primary-light);
}

.nav-link.active {
    color: var(--color-primary-light);
    font-weight: 500;
}

.nav-footer {
    margin-top: auto;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* Main Content */
.main {
    grid-area: main;
    padding: var(--space-xl);
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.card-compact {
    padding: var(--space-sm) var(--space-md);
}

.card-compact .action-legend {
    margin-bottom: 0;
}

/* Page Titles */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    color: var(--color-text);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-light);
    color: white;
}

.btn-secondary {
    background: var(--color-bg-sunken);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

/* Range Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
    max-width: 780px;
    min-width: 650px;
    user-select: none;
}

.chart-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.chart-cell:hover {
    border-color: var(--color-text);
    transform: scale(1.05);
    z-index: 1;
}

.chart-cell.fold { background: var(--color-fold); }
.chart-cell.call { background: var(--color-call); color: white; }
.chart-cell.raise { background: var(--color-raise); color: white; }
.chart-cell.allin { background: var(--color-allin); color: white; }
.chart-cell.unheld { background: var(--color-unheld); }
.chart-cell.selected { background: var(--color-selected); }

/* Chart Preview (smaller, non-interactive) */
.chart-preview {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 1px;
    width: 130px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.chart-preview:hover {
    transform: scale(1.02);
}

.chart-preview-cell {
    aspect-ratio: 1;
    border-radius: 1px;
}

/* Chart Grid Container */
.charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.chart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.chart-card-title {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    color: var(--color-text);
}

/* Action Legend */
.action-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.action-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.action-item.active {
    border-color: var(--color-text);
}

.action-swatch {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
}

/* Chart Editor Layout */
.chart-editor-layout {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    align-items: flex-start;
}

.chart-editor-grid {
    flex: 0 0 auto;
    background: var(--color-bg-elevated);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.chart-editor-panel {
    flex: 0 0 auto;
    background: var(--color-bg-elevated);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    min-width: 200px;
}

.action-legend-vertical {
    flex-direction: column;
    margin-bottom: 0;
}

.action-legend-vertical .action-item {
    width: 100%;
    justify-content: flex-start;
}

.action-stats {
    margin-left: auto;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

@media (max-width: 768px) {
    .chart-editor-layout {
        flex-direction: column;
    }
    
    .chart-editor-panel {
        width: 100%;
    }
    
    .action-legend-vertical {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .action-legend-vertical .action-item {
        width: auto;
    }
}

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 99;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .main {
        padding: var(--space-lg);
    }
    
    .chart-grid {
        max-width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn var(--transition-normal);
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Feature Grid (Home Page) */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card .feature-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.feature-card h3 {
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.feature-card p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Page Header with Actions */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

/* Section Header with Actions */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    margin-top: var(--space-xl);
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

/* Chart Card Wrapper with Reset Button */
.chart-card-wrapper {
    position: relative;
}

.chart-reset-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 10;
}

.chart-card-wrapper:hover .chart-reset-btn {
    opacity: 1;
}

.chart-reset-btn:hover {
    background: var(--color-allin);
    border-color: var(--color-allin);
    color: white;
}

/* Chart Badge */
.chart-badge {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: white;
    text-transform: uppercase;
    font-weight: 600;
}

/* Small Button Variant */
.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
}

/* Danger Button */
.btn-danger {
    background: var(--color-allin);
    color: white;
    border: 1px solid var(--color-allin);
}

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: white;
}

/* ===== EQUITY CALCULATOR ===== */

.eq-players {
    display: flex;
    gap: var(--space-xl);
    align-items: flex-start;
    justify-content: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.eq-player {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    min-width: 280px;
    flex: 1;
    max-width: 350px;
}

.eq-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.eq-player-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.eq-mode-toggle {
    display: flex;
    gap: 2px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 2px;
}

.eq-mode-btn {
    background: transparent;
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.eq-mode-btn.active {
    background: var(--color-primary);
    color: white;
}

.eq-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-muted);
    align-self: center;
    padding: var(--space-lg);
}

.eq-hand {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.eq-card {
    width: 70px;
    height: 100px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 700;
}

.eq-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.eq-card-empty {
    background: var(--color-bg);
    border-style: dashed;
}

.eq-card-placeholder {
    font-size: 2rem;
    color: var(--color-text-muted);
}

.eq-card-rank {
    font-size: 1.5rem;
}

.eq-card-suit {
    font-size: 1.75rem;
}

.eq-result {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    text-align: center;
}

.eq-result-error {
    color: var(--color-allin);
}

.eq-result-win {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-call);
}

.eq-result-tie {
    font-size: 1rem;
    color: var(--color-text-muted);
}

/* Board Cards */
.eq-board {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.eq-board h3 {
    margin: 0 0 var(--space-lg) 0;
    text-align: center;
}

.eq-board-cards {
    display: flex;
    gap: var(--space-xl);
    justify-content: center;
    flex-wrap: wrap;
}

.eq-board-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.eq-board-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Actions */
.eq-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

/* Card Picker Modal */
.eq-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.eq-picker-modal {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 95vw;
    max-height: 90vh;
    overflow: auto;
}

.eq-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.eq-picker-header h3 {
    margin: 0;
}

.eq-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.eq-picker-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
}

.eq-picker-card {
    width: 45px;
    height: 60px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.eq-picker-card:hover:not(.eq-picker-dead) {
    border-color: var(--color-primary);
    transform: scale(1.1);
    z-index: 1;
}

.eq-picker-dead {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--color-bg-elevated);
}

/* Range Selector */
.eq-range-selector {
    padding: var(--space-md);
}

.eq-range-selector select {
    width: 100%;
}

/* Picker Preview */
.eq-preview-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
}

.eq-preview-title {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    min-width: 60px;
}

.eq-preview-slots {
    display: flex;
    gap: var(--space-sm);
}

.eq-preview-slot {
    width: 40px;
    height: 50px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.eq-preview-empty {
    background: var(--color-bg);
    color: var(--color-text-muted);
}

.eq-preview-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.eq-picker-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

/* Progress Bar */
.eq-progress {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    justify-content: center;
}

.eq-progress-bar {
    width: 300px;
    height: 20px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.eq-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-call));
    transition: width 0.1s ease;
}

.eq-progress-text {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 40px;
}

/* Text alignment utility */
.text-center {
    text-align: center;
}

/* ==== Range Preview Mini Chart ==== */
.eq-mini-chart {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 1px;
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    margin-top: var(--space-sm);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-border);
}

.eq-mini-cell {
    aspect-ratio: 1;
}

.eq-range-preview {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.15s;
}

.eq-range-preview:hover {
    transform: scale(1.02);
}

.eq-range-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xs);
}

.eq-range-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ==== Range Editor Modal ==== */
.eq-range-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.eq-range-editor {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.eq-range-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.eq-range-editor-header h3 {
    margin: 0;
}

.eq-range-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0;
    line-height: 1;
}

.eq-range-close:hover {
    color: var(--color-text);
}

.eq-range-actions {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.eq-action-btn {
    padding: var(--space-xs) var(--space-sm);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.1s, border-color 0.1s;
}

.eq-action-btn:hover {
    transform: scale(1.05);
}

.eq-action-btn.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--color-primary);
}

.eq-range-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 2px;
    background: var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    user-select: none;
}

.eq-range-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.1s;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}

.eq-range-cell:hover {
    opacity: 0.85;
}

.eq-range-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
}

.eq-range-stats {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.eq-range-btns {
    display: flex;
    gap: var(--space-sm);
}

