/* ============================================
   DECK PANEL
   Deck header, entries, controls, stack/grid views
   ============================================ */

/* Deck Content Wrapper */
.deck-content-inner {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    /* Remove height: 100% and overflow: hidden so .deck-panel can scroll naturally */
    min-height: 0;
    width: 100%;
}

/* Deck Header: Preview + Controls */
.deck-header {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 8px;
    background: var(--widget-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* Deck Toolbar (Collapsible Toggle) */
.deck-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--divider-border);
    min-height: 32px;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.toolbar-btn {
    width: 100%;
    text-shadow: none !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.collapse-controls-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8em;
    font-style: italic;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.collapse-controls-btn:hover {
    color: var(--accent-hover);
    background: transparent;
}

/* Format Selector */
.format-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--widget-bg);
    border-radius: 8px;
    margin-bottom: 10px;
}

.format-label {
    color: #888;
    font-size: 0.9em;
}

.format-selector {
    flex: 1;
}

/* Deck Preview Column */
.deck-preview-column {
    flex-shrink: 0;
    width: 33%;
    min-width: 120px;
    max-width: 220px;
    aspect-ratio: 488 / 680;
    position: relative;
}

.deck-preview-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 0;
    left: 0;
}

.deck-preview-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.85em;
    font-style: italic;
    position: absolute;
    top: 0;
    left: 0;
}

.commander-crown {
    position: absolute;
    top: -6px;
    left: 4px;
    font-size: 1.5em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    z-index: 1;
}

/* Commander/Partner toggle button */
.crown-btn {
    background: transparent;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    /* Increased base opacity */
    transition: opacity 0.2s, transform 0.2s;
    color: var(--text-muted);
    /* Use theme-aware muted color */
}

.crown-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.crown-btn.active {
    opacity: 1;
    color: #ffd700;
    /* Gold when active */
    filter: drop-shadow(0 0 2px gold);
}

.crown-placeholder {
    width: 22px;
    display: inline-block;
}

/* Companion toggle button */
.companion-btn {
    background: transparent;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    /* Increased base opacity */
    transition: opacity 0.2s, transform 0.2s;
    color: var(--text-muted);
    /* Use theme-aware muted color */
}

.companion-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.companion-btn.active {
    opacity: 1;
    color: #a855f7;
    /* Purple when active */
    filter: drop-shadow(0 0 3px #a855f7);
}

/* Deck Controls */
.deck-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: stretch;
    gap: 8px;
    min-width: 0;
    padding: 10px 0;
}

.deck-controls-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deck-search-row {
    width: 100%;
}

.deck-search-input {
    width: 100%;
    padding: 8px 12px;
}

.deck-sort-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deck-sort-label {
    color: #888;
    font-size: 0.85em;
}

.deck-sort-dropdown {
    flex: 1;
}

/* Renamed to avoid conflicts */
.deck-action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    /* Increasing gap slightly */
    margin-top: auto;
    width: 100%;
}

.deck-action-grid>button {
    /* Resetting width constraints */
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;

    /* Internal layout */
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    height: 100%;

    /* overriding forms.css flex:1 if present */
    flex: none !important;
}

/* Preserve base visual styles from classes but override layout */
.deck-action-grid .action-btn {
    font-size: 0.8em;
}

/* Deck List */
.deck-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    margin-bottom: 20px;
    padding-right: 6px;
    box-sizing: border-box;
    padding-bottom: 40px; /* Spacing before footer */
}

/* Grouped Deck List */
.deck-list-grouped {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.deck-group {
    background: var(--widget-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.deck-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--deck-header-bg);
    color: var(--deck-header-text);
    font-size: 0.85em;
    font-weight: 600;
    border-bottom: 1px solid var(--deck-header-border);
}

.group-label {
    flex: 1;
}

.group-badge {
    background: var(--deck-header-border);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Zone Header (Top-level Deck/Sideboard sections) */
.deck-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--deck-header-bg);
    border-left: 3px solid var(--accent-color);
    margin-bottom: 8px;
    border-radius: 4px;
}

.deck-zone-header .group-label {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--deck-header-text);
}

/* Deck Entry */
.deck-entry {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 12px;
    min-height: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9em;
    background: transparent;
    transition: background 0.2s;
    position: relative;
    color: var(--text-color);
}

.deck-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.deck-entry.invalid {
    opacity: 0.7;
    background: rgba(255, 0, 0, 0.1);
    border-left: 3px solid #ff4444;
}

.deck-entry.invalid .entry-name {
    color: #ff6b6b;
}

.deck-entry.filtered-out {
    opacity: 0.25;
    pointer-events: none;
}

.deck-entry.has-validation-errors {
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.25) 0%, rgba(220, 53, 69, 0.1) 100%);
    border-left: 3px solid #dc3545;
}

.deck-entry.has-validation-errors:hover {
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.35) 0%, rgba(220, 53, 69, 0.15) 100%);
}

.deck-entry.has-validation-errors .entry-name {
    color: #ff6b6b;
}

.entry-count {
    font-weight: bold;
    color: var(--accent-color);
    min-width: 24px;
    text-align: right;
}

.entry-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.deck-entry:hover .entry-controls {
    opacity: 1;
}

.entry-buttons {
    display: flex;
    gap: 4px;
}

.validation-icon {
    color: #ff4444;
    font-size: 0.9em;
    margin-left: 6px;
}

/* Deck Actions */
.deck-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-shrink: 0;
    padding-top: 16px;
}

.clear-deck-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.clear-deck-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* Empty Deck State */
.empty-deck {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-deck .hint {
    font-size: 0.85em;
    color: #555;
}

.empty-import-btn {
    margin-top: 16px;
    padding: 12px 24px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: all 0.2s;
}

.empty-import-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    background: var(--accent-gradient);
    box-shadow: 0 6px 16px var(--accent-glow);
}

/* Commander Button in Deck Entry */
.cmdr-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.cmdr-btn:hover {
    opacity: 1;
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.2);
}

.cmdr-menu {
    cursor: pointer;
    font-size: 1.2em;
    color: #ffd700;
    margin-left: 4px;
}

/* Stack View */
.deck-stack-view {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    padding: 16px;
    width: 100%;
    overflow: visible;
    height: auto;
}

.stack-column {
    flex: 1 1 200px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--entry-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

.stack-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    font-weight: bold;
    color: var(--text-color);
    font-size: 0.9rem;
    height: 36px;
    margin-bottom: 4px;
}

.stack-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.stack-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.stack-count {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    min-width: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stack-cards {
    display: flex;
    flex-direction: column;
    padding-bottom: 100px;
}

.stack-card {
    position: relative;
    width: 100%;
    aspect-ratio: 63/88;
    /* Maintain a constant 36px stacking distance regardless of card size */
    /* 1.396 is the height/width ratio (88/63) */
    margin-bottom: calc(-1.396 * 100% + 36px);
    transition: transform 0.2s ease, z-index 0s;
    cursor: pointer;
    z-index: 0;
}

.stack-card:last-child {
    margin-bottom: 0;
}

.stack-card img {
    width: 100%;
    border-radius: 9px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.2s;
}

.stack-card:hover,
.stack-card.hover-active {
    z-index: 100;
    transform: translateY(-5px) scale(1.05);
}

.stack-card:hover img,
.stack-card.hover-active img {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.8);
}

.stack-card-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-color);
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 20;
}


.stack-add-btn,
.stack-remove-btn {
    position: absolute;
    bottom: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 21;
    font-size: 0.8rem;
    padding: 0;
    transition: all 0.2s ease;
    border: none;
    color: white;
    font-weight: bold;
}

.stack-add-btn {
    right: -8px;
    background: rgba(46, 204, 113, 0.9);
}

.stack-remove-btn {
    left: -8px;
    background: rgba(231, 76, 60, 0.9);
}

.stack-card:hover .stack-add-btn,
.stack-card:hover .stack-remove-btn {
    display: flex;
}

.stack-add-btn:hover {
    background: #27ae60;
    transform: scale(1.1);
}

.stack-remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Command Zone Section */
.command-zone-section {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--divider-border);
    padding-bottom: 8px;
}

.command-zone-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: var(--widget-bg);
    border-radius: 6px;
}

.command-zone-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.command-zone-count {
    background: var(--accent-color);
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.command-zone-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.command-zone-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--widget-bg);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    transition: background 0.2s ease;
    cursor: pointer;
}

.command-zone-entry:hover {
    background: var(--accent-bg-hover);
}

.cz-badge {
    font-size: 14px;
    flex-shrink: 0;
}

.cz-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cz-mana {
    font-family: monospace;
    font-size: 0.85em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cz-mana-symbols {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.cz-remove-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.command-zone-entry:hover .cz-remove-btn {
    opacity: 1;
}

.cz-remove-btn:hover {
    color: #ff4444;
}

/* Companion Section */
.companion-section {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--divider-border);
    padding-bottom: 8px;
}

.companion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: rgba(234, 179, 8, 0.15);
    border-radius: 6px;
}

.companion-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #eab308;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.companion-count {
    background: #eab308;
    color: #000; /* Fixed contrast: dark text on yellow */
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.companion-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.companion-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(234, 179, 8, 0.08);
    border-radius: 6px;
    border-left: 3px solid #eab308;
    transition: background 0.2s ease;
    cursor: pointer;
}

.companion-entry:hover {
    background: rgba(234, 179, 8, 0.15);
}

.companion-entry:hover .cz-remove-btn {
    opacity: 1;
}

/* Stack View Overlay Controls */
.stack-cmd-btn-overlay {
    position: absolute;
    bottom: 75px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 25;
    pointer-events: none;
}

.stack-crown-btn,
.stack-companion-btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    border-radius: 50%;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateY(10px);
}

.stack-card:hover .stack-crown-btn,
.stack-card:hover .stack-companion-btn {
    opacity: 1;
    transform: translateY(0);
}

.stack-crown-btn:hover,
.stack-companion-btn:hover {
    transform: scale(1.1) translateY(0);
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent-color);
}

.stack-crown-btn.active {
    opacity: 1;
    transform: translateY(0);
    background: rgba(138, 43, 226, 0.8);
    border-color: #8a2be2;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
}

.stack-companion-btn.active {
    opacity: 1;
    transform: translateY(0);
    background: rgba(234, 179, 8, 0.8);
    border-color: #eab308;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}

/* Deck Control Section */
/* Deck Control Section */
.deck-control-section {
    background: var(--widget-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.deck-control-section .deck-section-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

/* Mobile Deck Overrides */
@media (max-width: 768px) {
    .deck-header {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    /* Hide preview on mobile - saves space */
    .deck-preview-column {
        display: none;
    }

    .deck-controls {
        width: 100%;
    }

    /* Hide view mode toggles - force list view only */
    .view-toggles,
    .deck-view-toggles {
        display: none !important;
    }

    /* Stack view hidden on mobile - List view is forced via Rust code */
    .deck-stack-view {
        display: none !important;
    }

    /* Compact format row */
    .format-row {
        flex-direction: row;
        align-items: center;
        padding: 8px;
        margin-bottom: 8px;
    }

    /* Compact control sections */
    .deck-control-section {
        padding: 8px;
        margin-bottom: 8px;
    }

    .deck-control-section .deck-section-header {
        margin-bottom: 4px;
        font-size: 0.7rem;
    }

    /* Deck entries - reduced height for better information density */
    .deck-entry {
        padding: 6px 10px;
        min-height: 38px;
        gap: 8px;
    }

    .entry-count {
        min-width: 28px;
        font-size: 1em;
    }

    .entry-name {
        font-size: 0.9em;
    }

    /* Entry buttons - larger for touch */
    .entry-buttons {
        gap: 6px;
    }

    .entry-buttons button {
        min-width: 36px;
        min-height: 36px;
        padding: 6px;
        font-size: 1.1em;
    }

    /* Action button grid - 4 columns for compact buttons */
    .deck-action-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    /* Hide text labels in action grid on mobile */
    .deck-action-grid .deck-control-btn span {
        display: none;
    }

    .deck-action-grid .deck-control-btn svg {
        margin: 0;
        font-size: 1.4em;
    }

    .deck-action-grid>button {
        min-height: 44px;
        padding: 10px 0;
        font-size: 0.75em;
        justify-content: center;
    }

    .deck-action-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Control buttons - larger touch targets */
    .deck-control-btn {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.8em;
    }

    /* AI row buttons */
    .deck-ai-row {
        flex-wrap: wrap;
    }

    .deck-ai-row .deck-control-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 100px;
    }

    .deck-info-stats {
        flex-wrap: wrap;
    }

    /* Let parent handle scrolling */
    .deck-content-inner {
        overflow: visible !important;
    }

    /* Command zone - more compact */
    .command-zone-section {
        padding: 8px;
    }

    .command-zone-entry {
        padding: 8px;
    }

    .companion-section {
        padding: 8px;
    }

    .companion-entry {
        padding: 8px;
    }
}

/* Unified Deck Control Button */
.deck-control-btn {
    background: var(--accent-gradient);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    flex: 1;
    transition: filter 0.2s;
    font-size: 0.9em;
    min-width: 0;
    white-space: nowrap;
}

.deck-control-btn:hover {
    filter: brightness(1.1);
}

.deck-control-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    opacity: 0.7;
}

.deck-control-btn.secondary {
    background: #334155;
}

/* AI & Goldfish Controls */
.deck-ai-row {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
}

.ai-suggestions-button-group {
    display: flex;
    gap: 8px;
    flex: 0 0 auto !important;
    width: auto !important;
}

/* Specific overrides if needed, but deck-control-btn handles most */
/* Legacy classes removed */

/* Card reference styles for suggestions */
.card-ref {
    color: var(--accent-color);
    font-weight: 600;
    cursor: help;
    border-bottom: 1px dotted var(--accent-color);
    transition: all 0.2s ease;
}

.card-ref:hover {
    background: var(--accent-bg-hover);
    color: var(--accent-hover);
}


/* Deck suggestions content styling */
.ai-suggestions-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.ai-suggestions-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.ai-suggestions-content li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.ai-suggestions-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* ============================================
   DECK PANEL - COMPACT REDESIGN
   ============================================ */

/* Redesign toolbar - deck-header logic merged */

/* New Toolbar Container */
.deck-toolbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 60px;
    height: auto;
    padding: 8px 16px;
    background: var(--widget-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px 16px !important;
    flex-shrink: 0;
    flex-wrap: wrap !important;
}

/* Toolbar Groups */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

.toolbar-group.left {
    flex: 1;
    min-width: 0;
    /* Allow shrinking */
}

.toolbar-group.center {
    flex: 0 0 auto;
}

.toolbar-group.right {
    flex: 0 0 auto;
    justify-content: flex-end;
}

/* Compact Search */
.toolbar-search-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-color);
    font-size: 0.9em;
    width: 200px;
    transition: width 0.2s ease, box-shadow 0.2s;
}

.toolbar-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

/* Filter Toggle Button */
.toolbar-filter-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    transition: all 0.2s;
}

.toolbar-filter-btn:hover,
.toolbar-filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Icon-only buttons for View Toggles */
.toolbar-view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-view-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.toolbar-view-btn.active {
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
}

/* Collapsible Filter Drawer */
.filter-drawer {
    background: var(--widget-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    height: auto;
    flex-shrink: 0;
    animation: slideDown 0.2s ease-out;
}

@media (max-width: 768px) {
    .filter-drawer {
        overflow: visible !important;
        padding-bottom: 24px !important;
        height: auto !important;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown Menu Styles */
.dropdown-group:hover .dropdown-content {
    display: block !important;
}

.menu-item:hover {
    background: var(--bg-secondary) !important;
}

/* Fix AiSuggestionsButton growing too large */
/* Merged above */

/* Reset button sizing in toolbar */
.deck-toolbar-container .deck-control-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 6px 12px !important;
    min-height: 32px !important;
    height: 32px !important;
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .deck-toolbar-container {
        padding: 4px;
        gap: 4px !important;
        flex-direction: column !important;
        /* Stack rows */
        align-items: stretch !important;
        height: auto !important;
    }

    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }

    .toolbar-group.left {
        flex: 0 0 auto !important;
        margin-bottom: 4px;
        display: grid !important;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 8px;
        width: 100%;
    }

    .toolbar-group.right {
        flex: 1 1 auto !important;
        /* Allow growing */
        width: 100%;
        justify-content: space-between !important;
        /* Spread actions */
        gap: 4px;
    }

    .toolbar-search-input {
        width: 100% !important;
        min-width: 0;
        grid-column: 1 / -1;
        grid-row: 1;
        font-size: 16px !important;
        /* Prevents iOS zoom on focus */
        height: 38px;
    }

    .toolbar-search-input:focus {
        width: 100% !important;
    }

    .toolbar-filter-btn {
        grid-column: 1;
        grid-row: 2;
    }

    .deck-sort-row {
        grid-column: 2;
        grid-row: 2;
        width: 100% !important;
        display: flex;
        flex: 1;
        min-width: 0;
        margin-right: 0 !important;
    }

    .deck-sort-dropdown {
        flex: 1;
        max-width: 120px !important;
        width: 100%;
    }

    /* Hide text labels in toolbar buttons */
    .deck-toolbar-container .text,
    .deck-toolbar-container .deck-control-btn span:not(.pro-badge),
    .toolbar-filter-btn .toolbar-btn-text {
        display: none !important;
    }

    /* Ensure icon is visible and centered */
    .deck-toolbar-container svg {
        margin: 0 !important;
    }

    .toolbar-group.center {
        display: none;
    }

    /* Standardize button sizes */
    .deck-toolbar-container .deck-control-btn,
    .toolbar-filter-btn,
    .ai-suggestions-button-group {
        padding: 0 !important;
        /* Let children handle padding */
        height: 38px !important;
        flex: 1 !important;
        /* Make buttons even width on bottom row */
        display: flex;
        justify-content: center;
        min-width: 0;
    }

    .ai-suggestions-button-group .deck-control-btn {
        width: 100% !important;
        height: 100% !important;
        padding: 8px 12px !important;
    }

    .deck-toolbar-container .deck-control-btn:not(.ai-suggestions-button-group .deck-control-btn),
    .toolbar-filter-btn {
        padding: 8px 12px !important;
    }

    /* Search row buttons shouldn't grow excessively */
    .toolbar-group.left .toolbar-filter-btn,
    .toolbar-group.left .deck-sort-dropdown {
        flex: 0 0 auto;
    }

    /* Merged above */
}