/**
 * Fantasy Trade Tool Direct Embed Styles - Matches Original App Layout
 * Version: 2.0.0
 */

.fantasy-trade-tool-container {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    min-height: 600px;
}

/* Loading State */
.trade-tool-loading {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: trade-tool-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes trade-tool-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header Section - Matches Original Layout */
.trade-tool-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    background: #ffffff;
}

.header-left {
    flex: 1;
}

.trade-tool-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
}

.trade-tool-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* Mode Toggle - Blue style like original */
.mode-toggle {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d1d5db;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.mode-btn.active {
    background: #3b82f6;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: #f3f4f6;
}

/* Control Groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Select Controls */
.league-size-select,
.scoring-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    min-width: 60px;
}

.league-size-select:focus,
.scoring-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Superflex Toggle */
.superflex-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
}

.superflex-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Trade Evaluation Banner */
.trade-evaluation-banner {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 32px;
    text-align: center;
}

.evaluation-text {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

/* Main Trade Interface - Side by Side Layout */
.trade-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

.team-panel {
    padding: 24px 32px;
    border-right: 1px solid #e5e7eb;
    background: #ffffff;
}

.team-panel:last-child {
    border-right: none;
}

.team-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 24px 0;
    text-align: center;
}

/* Player Search - Exact Match to Original */
.player-search-container {
    position: relative;
    margin-bottom: 32px;
}

.player-search {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background: #ffffff;
}

.player-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:hover {
    background: #f9fafb;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    margin-bottom: 2px;
}

.search-result-details {
    font-size: 12px;
    color: #6b7280;
}

.search-result-value {
    font-weight: 600;
    color: #059669;
    font-size: 14px;
}

/* Player Table Header */
.player-table-header {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.col-player { text-align: left; }
.col-age { text-align: center; width: 60px; }
.col-value { text-align: right; width: 80px; }
.col-action { width: 40px; }

/* Selected Players Table */
.selected-players-table {
    min-height: 200px;
    margin-bottom: 24px;
}

/* Player Row - Table Style Like Original */
.player-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
    transition: background-color 0.2s ease;
}

.player-row:hover {
    background: #f9fafb;
}

.player-row:last-child {
    border-bottom: none;
}

/* Player Info */
.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-button {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.player-button:hover {
    background: #2563eb;
}

.position-suffix {
    font-size: 12px;
    font-weight: 700;
    margin-left: 2px;
}

/* Age Column */
.player-age {
    text-align: center;
    width: 60px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

/* Value Column */
.player-value {
    text-align: right;
    width: 80px;
    font-size: 14px;
    color: #374151;
    font-weight: 600;
}

/* Remove Button */
.remove-player-btn {
    background: transparent;
    color: #9ca3af;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
    font-weight: 400;
}

.remove-player-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Team Total - Matches Original Layout */
.team-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
}

.total-label {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.total-value {
    font-size: 20px;
    font-weight: 700;
    color: #3b82f6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    margin-bottom: 24px;
}

.empty-state-text {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.empty-state-subtext {
    font-size: 12px;
    color: #d1d5db;
}

/* Action Buttons - Hidden by default */
.trade-actions {
    padding: 24px 32px;
    display: flex;
    justify-content: center;
    gap: 12px;
    border-top: 1px solid #e5e7eb;
}

.clear-all-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.clear-all-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .trade-panels {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .trade-tool-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .mode-toggle {
        width: 100%;
    }
    
    .team-totals {
        flex-direction: column;
        gap: 10px;
    }
    
    .player-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .player-value-section {
        align-self: flex-end;
    }
}

/* Dark Theme */
.fantasy-trade-tool-container[data-theme="dark"] {
    background: #1f2937;
    color: #f9fafb;
}

.fantasy-trade-tool-container[data-theme="dark"] .team-panel {
    background: #374151;
    border-color: #4b5563;
}

.fantasy-trade-tool-container[data-theme="dark"] .player-card {
    background: #4b5563;
    border-color: #6b7280;
}

.fantasy-trade-tool-container[data-theme="dark"] .player-search {
    background: #374151;
    border-color: #6b7280;
    color: #f9fafb;
}

.fantasy-trade-tool-container[data-theme="dark"] .search-results {
    background: #374151;
    border-color: #6b7280;
}

.fantasy-trade-tool-container[data-theme="dark"] .search-result-item:hover {
    background: #4b5563;
}

/* Success/Error States */
.trade-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
}

.trade-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
}