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

body {
    background: #1a1a1a;
    color: white;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

.deck-builder-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: #2a2a2a;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #444;
}

.header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.back-btn {
    padding: 10px 20px;
    background: #444;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.back-btn:hover {
    background: #555;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 20px;
    background: #4a90e2;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.action-btn:hover {
    background: #357abd;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 1fr; /* Info (Left), Pool (Mid), Deck (Right) */
    height: calc(100vh - 70px);
    overflow: hidden;
}

/* LEFT COLUMN: INFO */
.card-info-section {
    padding: 30px;
    background: #121212;
    border-right: 2px solid #444;
    overflow-y: auto;
}

.info-panel-content h3 {
    font-size: 42px; /* Way bigger */
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.info-stats-item {
    font-size: 26px; /* Way bigger */
    margin-bottom: 15px;
    text-align: left;
    color: #eee;
}

.info-stats-item strong { color: #4a90e2; }

#info-text {
    font-size: 24px; /* Way bigger */
    margin-top: 25px;
    line-height: 1.6;
    color: #ccc;
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: left;
}

/* CENTER COLUMN: POOL */
.card-pool-section {
    padding: 20px;
    border-right: 2px solid #444;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-pool {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    overflow-y: auto;
}

/* RIGHT COLUMN: DECK */
.current-deck-section {
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === FILTER BAR VISUALS === */
.section-header {
    margin-bottom: 10px;
    padding: 0 5px;
}

.search-input {
    width: 100%;
    padding: 10px;
    background: #222;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
    font-size: 14px;
}
.search-input:focus { border-color: #4a90e2; outline: none; }

.filter-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0 5px;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1; /* Make them equal width */
    padding: 8px 5px;
    background: #333;
    border: 1px solid #555;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    min-width: 70px;
}

.filter-btn:hover {
    background: #444;
    color: white;
}

.filter-btn.active {
    background: #4a90e2; /* Blue Active State */
    color: white;
    border-color: #4a90e2;
    box-shadow: 0 0 8px rgba(74, 144, 226, 0.4);
}

.filter-btn:hover {
    background: #444;
}

.filter-btn.active {
    background: #4a90e2;
    border-color: #4a90e2;
}

.advanced-filters {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-row label {
    min-width: 120px;
    font-size: 13px;
    color: #aaa;
}

.filter-select {
    flex: 1;
    padding: 6px 10px;
    background: #333;
    border: 1px solid #555;
    color: white;
    border-radius: 5px;
    font-size: 13px;
}

.filter-select:focus {
    outline: none;
    border-color: #4a90e2;
}

.filter-row input[type="checkbox"] {
    margin-right: 5px;
}

.card-pool {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 10px;
    background: #252525;
    border-radius: 5px;
}

/* Current Deck Section */
.current-deck-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.clear-btn {
    padding: 8px 15px;
    background: #f44336;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.clear-btn:hover {
    background: #da190b;
}

.deck-stats {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-size: 14px;
    color: #aaa;
    margin-right: 10px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #4a90e2;
    min-width: 30px;
}

.stat-limit {
    font-size: 14px;
    color: #666;
}

.deck-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.deck-tab {
    flex: 1;
    padding: 10px;
    background: #333;
    border: 1px solid #555;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
}

.deck-tab:hover {
    background: #444;
}

.deck-tab.active {
    background: #4a90e2;
    border-color: #4a90e2;
}

.deck-display {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 10px;
    background: #252525;
    border-radius: 5px;
}

.deck-display.hidden {
    display: none;
}

/* Card Styles */
.card-item {
    width: 100px;
    height: 135px;
    border: 2px solid #333;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
    word-wrap: break-word;
    overflow: hidden;
}

.card-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.card-item.hidden {
    display: none;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.card-name-fallback {
    padding: 4px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* Card colors by type */
.card-item[data-type="Phantom"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-item[data-type="Spirit"] {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.card-item[data-type="Counter"] {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.card-item[data-type="Environment"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card-count {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

/* Scrollbar styling */
.card-pool::-webkit-scrollbar,
.deck-display::-webkit-scrollbar {
    width: 8px;
}

.card-pool::-webkit-scrollbar-track,
.deck-display::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.card-pool::-webkit-scrollbar-thumb,
.deck-display::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.card-pool::-webkit-scrollbar-thumb:hover,
.deck-display::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Validation indicators */
.stat-value.invalid {
    color: #f44336;
}

.stat-value.valid {
    color: #4caf50;
}

.card-item {
    user-select: none; /* Prevents text selection on double-click */
    -webkit-user-select: none;
}

.kw-trigger {
    color: #3498db !important;
    text-decoration: none !important;
    cursor: help;
    font-weight: bold;
}

#keyword-popup {
    position: fixed;
    background: rgba(10, 15, 25, 0.98);
    border: 1px solid #3498db;
    color: #eee;
    padding: 15px;
    border-radius: 8px;
    z-index: 5000;
    max-width: 280px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.kw-close {
    position: absolute;
    top: 5px;
    right: 10px;
    cursor: pointer;
    color: #3498db;
    font-size: 18px;
}

#keyword-popup.hidden {
    display: none;
}

