/**
 * Deckbuilder page styles
 * All deckbuilder-specific styles; no inline styles in template.
 */

/* Deckbuilder page container */
.tcg-deckbuilder .tcg-page .container,
body.tcg-deckbuilder .container {
    max-width: 1400px;
}

/* Header */
.tcg-deckbuilder .header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.tcg-deckbuilder .header h1 img {
    width: 48px;
    height: 48px;
}

.tcg-deckbuilder .header-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Buttons */
.tcg-deckbuilder .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.tcg-deckbuilder .btn-primary {
    background: #4CAF50;
    color: white;
}

.tcg-deckbuilder .btn-primary:hover {
    background: #45a049;
}

.tcg-deckbuilder .btn-secondary {
    background: #2196F3;
    color: white;
}

.tcg-deckbuilder .btn-secondary:hover {
    background: #0b7dda;
}

.tcg-deckbuilder .btn-danger {
    background: #f44336;
    color: white;
}

.tcg-deckbuilder .btn-danger:hover {
    background: #da190b;
}

.tcg-deckbuilder .btn-link {
    background: transparent;
    color: #2196F3;
    border: 1px solid #2196F3;
}

.tcg-deckbuilder .btn-link:hover {
    background: #2196F3;
    color: white;
}

.tcg-deckbuilder .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Layout */
.tcg-deckbuilder .deckbuilder-layout {
    display: flex;
    flex-direction: column !important;
    gap: 20px;
}

.tcg-deckbuilder .card-code, .tcg-deckbuilder .card-meta {
    font-size: 0.7rem;
    font-weight: normal;
}

.tcg-deckbuilder .search-panel,
.tcg-deckbuilder .deck-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Collapsible search panel */
.tcg-deckbuilder .search-panel-collapsible {
    padding: 0;
    overflow: hidden;
}

.tcg-deckbuilder .search-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    text-align: left;
    transition: background 0.2s ease;
}

.tcg-deckbuilder .search-panel-toggle:hover {
    background: rgba(33, 150, 243, 0.08);
}

.tcg-deckbuilder .search-panel-title {
    flex: 1;
}

.tcg-deckbuilder .search-panel-chevron {
    font-size: 0.75rem;
    color: #666;
    transition: transform 0.25s ease;
}

.tcg-deckbuilder .search-panel-collapsible[data-expanded="true"] .search-panel-chevron {
    transform: rotate(180deg);
}

.tcg-deckbuilder .search-panel-body {
    padding: 0 20px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.tcg-deckbuilder .search-panel-body[hidden] {
    display: none;
}

/* Search */
.tcg-deckbuilder .search-header {
    margin-bottom: 20px;
    padding-top: 20px;
}

.tcg-deckbuilder .search-header h2 {
    margin-bottom: 10px;
    color: #333;
}

.tcg-deckbuilder .search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tcg-deckbuilder .search-row .search-input {
    flex: 1;
    min-width: 0;
}

.tcg-deckbuilder .search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.tcg-deckbuilder .filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tcg-deckbuilder .filter-select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.tcg-deckbuilder .filter-standard-only {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tcg-deckbuilder .filter-standard-only input {
    margin: 0;
}

/* Card results */
.tcg-deckbuilder .card-results {
    max-height: 600px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.tcg-deckbuilder .card-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.tcg-deckbuilder .card-item:hover {
    border-color: #2196F3;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tcg-deckbuilder .card-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 5px;
}

.tcg-deckbuilder .card-item .card-name {
    font-size: 12px;
    font-weight: normal;
    color: #333;
}

.tcg-deckbuilder .card-item .card-meta {
    font-size: 14px;
    font-weight: normal;
    color: #666;
    margin-top: 4px;
}

/* Deck panel */
.tcg-deckbuilder .deck-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tcg-deckbuilder .deck-header h2 {
    margin: 0;
    color: #333;
}

.tcg-deckbuilder .deck-stats {
    font-size: 1rem;
    font-weight: normal;
    color: #2196F3;
}

.tcg-deckbuilder .leader-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.tcg-deckbuilder .leader-section h3 {
    margin-bottom: 10px;
    color: #333;
}

.tcg-deckbuilder .leader-slot {
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.tcg-deckbuilder .leader-slot .placeholder {
    color: #999;
    margin: 0;
}

.tcg-deckbuilder .deck-list {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.tcg-deckbuilder .deck-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
}

.tcg-deckbuilder .deck-card-item .card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.tcg-deckbuilder .deck-card-item .card-info img {
    width: 50px;
    height: auto;
    border-radius: 4px;
}

.tcg-deckbuilder .deck-card-item .card-count {
    font-weight: normal;
    color: #2196F3;
    min-width: 30px;
    font-size: 1rem;
}

.tcg-deckbuilder .deck-card-item .card-controls {
    display: flex;
    gap: 5px;
}

.tcg-deckbuilder .deck-card-item button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #f5f5f5;
}

.tcg-deckbuilder .deck-card-item button:hover {
    background: #e0e0e0;
}

.tcg-deckbuilder .empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Validation */
.tcg-deckbuilder .deck-validation {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tcg-deckbuilder .deck-validation.valid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.tcg-deckbuilder .deck-validation.valid .deck-validation-notes {
    margin: 10px 0 0 0;
    padding-left: 20px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.tcg-deckbuilder .deck-validation.invalid {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

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

/* Saved decks section */
.tcg-deckbuilder .saved-decks-section {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.tcg-deckbuilder .saved-decks-title {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.tcg-deckbuilder .saved-decks-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tcg-deckbuilder .saved-decks-select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}

.tcg-deckbuilder .deck-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Rotation warning */
.tcg-deckbuilder .rotation-warning {
    background: rgba(255, 193, 7, 0.5);
    border: 1px solid var(--tcg-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #333;
}

/* Print Info Modal */
.tcg-print-info-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tcg-print-info-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.tcg-print-info-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.tcg-print-info-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    color: #333;
}

.tcg-print-info-desc {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: #666;
}

.tcg-print-info-form .tcg-print-info-row {
    margin-bottom: 16px;
}

.tcg-print-info-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.tcg-print-info-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
}

.tcg-print-info-form input:focus {
    outline: none;
    border-color: #2196F3;
}

.tcg-print-info-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.tcg-print-info-actions .btn {
    flex: 1;
}

/* Import from Clipboard Modal */
#tcg-import-modal .tcg-print-info-content {
    max-width: 520px;
}

.tcg-import-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 180px;
    margin-bottom: 16px;
}

.tcg-import-textarea:focus {
    outline: none;
    border-color: #2196F3;
}

.tcg-import-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.tcg-import-result.tcg-import-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.tcg-import-result.tcg-import-partial {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.tcg-import-result.tcg-import-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.tcg-import-result ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.tcg-import-result .tcg-import-notfound {
    margin: 8px 0 4px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .tcg-deckbuilder .deckbuilder-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tcg-deckbuilder .header h1 {
        font-size: 2rem;
    }

    .tcg-deckbuilder .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tcg-deckbuilder .btn {
        min-height: 44px;
        padding: 12px 18px;
    }

    .tcg-deckbuilder .search-panel,
    .tcg-deckbuilder .deck-panel {
        padding: 16px;
    }

    .tcg-deckbuilder .search-panel-toggle {
        padding: 14px 16px;
        min-height: 48px;
    }

    .tcg-deckbuilder .search-row {
        flex-direction: column;
        gap: 8px;
    }

    .tcg-deckbuilder .search-row .btn {
        width: 100%;
    }

    .tcg-deckbuilder .filters {
        flex-direction: column;
        gap: 8px;
    }

    .tcg-deckbuilder .filter-select {
        min-height: 44px;
        font-size: 16px;
    }

    .tcg-deckbuilder .search-input {
        min-height: 44px;
        font-size: 16px;
    }

    .tcg-deckbuilder .card-results {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        max-height: 400px;
    }

    .tcg-deckbuilder .deck-actions {
        flex-wrap: wrap;
    }

    .tcg-deckbuilder .deck-actions .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .tcg-deckbuilder .saved-decks-controls {
        flex-direction: column;
        gap: 8px;
    }

    .tcg-deckbuilder .saved-decks-controls select {
        min-height: 44px;
        font-size: 16px;
    }

    .tcg-deckbuilder .saved-decks-controls .btn {
        width: 100%;
    }

    .tcg-print-info-modal {
        padding: 16px;
    }

    .tcg-print-info-content {
        padding: 20px;
    }

    .tcg-print-info-form input {
        min-height: 44px;
        font-size: 16px;
    }

    .tcg-print-info-actions {
        flex-direction: column;
    }

    .tcg-print-info-actions .btn {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .tcg-deckbuilder .header h1 {
        font-size: 1.5rem;
    }

    .tcg-deckbuilder .header h1 img {
        width: 36px;
        height: 36px;
    }

    .tcg-deckbuilder .search-panel,
    .tcg-deckbuilder .deck-panel {
        padding: 12px;
    }

    .tcg-deckbuilder .search-panel-body {
        padding: 0 12px 12px;
    }

    .tcg-deckbuilder .card-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tcg-deckbuilder .card-item {
        padding: 8px;
    }

    .tcg-deckbuilder .deck-actions .btn {
        min-width: 100%;
    }
}

/* Print Deck – same format as vinticards-eventsplanner (tables: Qty, Card Name, Card Number, Set Name, Reg) */
@media print {
    body.tcg-print-deck > *:not(#tcg-print-deck-modal) {
        display: none !important;
    }

    body.tcg-print-deck {
        margin: 0 !important;
        padding: 0 !important;
    }

    #tcg-print-deck-modal {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        background: white !important;
        overflow: visible !important;
    }

    #tcg-print-deck-modal .vep-modal-content {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
    }

    #tcg-print-deck-modal .vep-modal-body {
        padding: 0 !important;
        margin: 0 !important;
    }

    .vep-deck-view {
        padding: 0 !important;
        margin: 0 !important;
    }

    .vep-deck-header {
        margin: 0 0 12px 0 !important;
        padding: 0 0 10px 0 !important;
        border-bottom: 1px solid #333 !important;
    }

    .vep-deck-header p {
        margin: 2px 0 !important;
        font-size: 11px !important;
    }

    .vep-deck-view h4 {
        margin: 10px 0 6px 0 !important;
        font-size: 12px !important;
    }

    .vep-deck-table {
        font-size: 10px !important;
        margin-bottom: 8px !important;
        width: 100%;
        border-collapse: collapse;
    }

    .vep-deck-table th,
    .vep-deck-table td {
        padding: 4px 8px !important;
        text-align: left;
        border: 1px solid #ddd;
    }

    .vep-deck-table th {
        background: #f5f5f5;
        font-weight: 600;
    }

    .vep-deck-view,
    .vep-deck-table,
    .vep-deck-header {
        break-inside: avoid;
    }
}

@page {
    size: A4;
    margin: 12mm;
}
