/* --- Modern Minimalism & Variables --- */
:root {
    --primary: #6b46c1;
    --primary-light: #8b5cf6;
    --dark-navy: #12122b;
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #2d3748;
    --text-muted: #718096;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

/* --- Responsive Layout Engine --- */
.deckbuilder-main-content {
    display: grid;
    grid-template-columns: 1fr; /* Default: Single column for Mobile */
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
}

/* Tablet / Small Desktop (2 Columns) */
@media (min-width: 768px) {
    .deckbuilder-main-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* Large Desktop (3 Columns: Search | Deck | Stats) */
@media (min-width: 1200px) {
    .deckbuilder-main-content {
        grid-template-columns: 380px 1fr 340px;
        padding: 2rem;
    }
}

/* --- Clean Panels --- */
.search-section, .deck-section, .stats-card, .import-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

/* Sticky behavior for Sidebars on Desktop */
@media (min-width: 1200px) {
    .search-section, .stats-card {
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

/* --- Modern Slate Header --- */
.header {
    background: rgba(248, 250, 252, 0.8); /* Very light slate grey */
    backdrop-filter: blur(10px); /* Modern frosted glass effect */
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8); /* Subtle grey border */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #475569; /* Deep slate grey */
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
}

/* Update Input to match the new light header */
.deck-name-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: #1e293b;
    font-weight: 500;
    transition: all 0.2s;
}

.deck-name-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Format Select update */
.format-select {
    background: #f1f5f9; /* Soft grey background */
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
}

/* --- Inputs & Buttons --- */
.search-input, .import-textarea, .deck-name-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    transition: all 0.2s;
    color: var(--text-main); /* Fixed: ensure text is visible */
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
    outline: none;
}

.btn {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, opacity 0.2s;
}

.btn-primary {
    background: #6366f1; /* Bright Indigo */
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* --- Deck List & Row Styles --- */
.deck-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.deck-card:hover {
    background: #f8fafc;
}

.quantity-badge {
    background: #edf2f7;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 800;
    margin-right: 0.5rem;
}

/* --- Visual Stats --- */
.price-display {
    font-size: 2rem;
    font-weight: 800;
    color: #059669; /* Modern Green */
    margin-bottom: 1rem;
}

.mana-curve {
    display: flex;
    align-items: flex-end;
    height: 140px;
    gap: 6px;
    margin: 1.5rem 0;
}

.mana-bar {
    flex: 1;
    background: var(--primary-light);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

/* --- Search Result Grid --- */
.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.card-result {
    display: flex;
    flex-direction: column;
    text-align: center;
    cursor: pointer;
}

.search-card-img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}