/**
 * Lineup Optimizer Styles
 * Styling for the multi-strategy lineup generator modal
 */

/* Modal overlay and container */
#lineup-modal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

#lineup-modal.modal-overlay.active {
    display: flex;
}

#lineup-modal .modal-content {
    background: var(--bg-card, #1a1a2e);
    border: 2px solid rgba(255, 255, 255, 0.3);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#lineup-modal .modal-header {
    padding: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

#lineup-modal .modal-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary, #fff);
    margin: 0;
}

#lineup-modal .modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary, #aaa);
    margin: 5px 0 0 0;
}

#lineup-modal .modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#lineup-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#lineup-modal .modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Configuration Section */
.lineup-config-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lineup-config-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary, #fff);
    font-size: 18px;
}

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

.config-row label {
    min-width: 180px;
    font-weight: 500;
    color: var(--text-primary, #fff);
}

.config-row select,
.config-row input[type="range"] {
    flex: 1;
    max-width: 400px;
}

.config-row select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #1a1a2e;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.config-row select option {
    background: #fff;
    color: #1a1a2e;
    padding: 8px;
}

.config-row select:focus {
    outline: none;
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

#min-ab-value {
    display: inline-block;
    min-width: 30px;
    font-weight: bold;
    color: var(--accent-color, #4CAF50);
}

/* Player exclusions */
#player-exclusions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.player-exclude-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #ccc);
    font-size: 13px;
    cursor: pointer;
}

.player-exclude-cb {
    cursor: pointer;
}

/* Opponent Analysis Card */
.opponent-analysis-card {
    background: linear-gradient(135deg, rgba(255, 100, 100, 0.1), rgba(255, 150, 150, 0.05));
    border-left: 4px solid #ff6b6b;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 6px;
}

.opponent-analysis-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ff6b6b;
    font-size: 16px;
}

.opponent-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.stat-group h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-primary, #fff);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row span:first-child {
    color: var(--text-secondary, #aaa);
}

.stat-row strong {
    color: var(--text-primary, #fff);
}

.tendencies-section {
    margin-top: 15px;
}

.tendencies-section h5 {
    margin-bottom: 8px;
    color: #ffa500;
}

.tendencies-section ul {
    margin: 0;
    padding-left: 20px;
}

.tendencies-section li {
    margin-bottom: 5px;
    color: var(--text-secondary, #ccc);
    font-size: 13px;
}

/* Lineup Tabs */
.lineup-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-color, #4CAF50);
    border-bottom-color: var(--accent-color, #4CAF50);
    background: rgba(76, 175, 80, 0.1);
}

/* Lineup Strategy Card */
.lineup-strategy-card {
    background: var(--bg-card, #1a1a2e);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.strategy-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.strategy-header h3 {
    margin: 0 0 10px 0;
    color: var(--accent-color, #4CAF50);
    font-size: 22px;
}

.strategy-description {
    color: var(--text-secondary, #ccc);
    margin: 10px 0;
    font-size: 15px;
    line-height: 1.5;
}

.strategy-when-to-use {
    color: #ffa500;
    margin: 10px 0 0 0;
    font-size: 14px;
    font-style: italic;
}

/* Batting Order Section */
.batting-order-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary, #fff);
    font-size: 16px;
}

.batting-order-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 13px;
}

.batting-order-table thead {
    background: rgba(255, 255, 255, 0.05);
}

.batting-order-table th,
.batting-order-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.batting-order-table th {
    color: var(--text-secondary, #aaa);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.batting-order-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.batting-order-table .position-num {
    font-weight: bold;
    color: var(--accent-color, #4CAF50);
    font-size: 16px;
    width: 40px;
    text-align: center;
}

.batting-order-table .player-name {
    color: var(--text-primary, #fff);
    font-size: 14px;
}

.batting-order-table td:not(.position-num):not(.player-name):not(.rationale-cell) {
    color: var(--text-secondary, #ccc);
    text-align: center;
    font-family: 'Courier New', monospace;
}

.rationale-cell {
    color: var(--text-secondary, #aaa);
    font-style: italic;
    font-size: 12px;
    max-width: 300px;
}

.rationale-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    border-left: 3px solid var(--accent-color, #4CAF50);
}

/* Strategy Advantages */
.strategy-advantages {
    background: rgba(76, 175, 80, 0.08);
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid var(--accent-color, #4CAF50);
}

.strategy-advantages h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-color, #4CAF50);
    font-size: 14px;
}

.strategy-advantages ul {
    margin: 0;
    padding-left: 20px;
}

.strategy-advantages li {
    margin-bottom: 6px;
    color: var(--text-secondary, #ccc);
    font-size: 13px;
}

/* Strategy Totals */
.strategy-totals {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.total-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.total-label {
    color: var(--text-secondary, #aaa);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-value {
    color: var(--accent-color, #4CAF50);
    font-size: 20px;
    font-weight: bold;
}

/* Lineup Actions */
.lineup-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent-color, #4CAF50);
    color: #fff;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: #4CAF50;
    color: #fff;
}

.btn-success:hover {
    background: #45a049;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

/* Loading indicator */
.modal-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #aaa);
    font-size: 16px;
}

.modal-loading::before {
    content: "⚾";
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    #lineup-modal .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .lineup-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .tab-btn {
        font-size: 12px;
        padding: 10px 15px;
    }

    .opponent-stats-grid {
        grid-template-columns: 1fr;
    }

    .strategy-totals {
        gap: 15px;
    }

    .batting-order-table {
        font-size: 11px;
    }

    .batting-order-table th,
    .batting-order-table td {
        padding: 8px 5px;
    }

    .rationale-cell {
        font-size: 10px;
    }
}

/* Scrollbar styling */
#lineup-modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#lineup-modal .modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#lineup-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#lineup-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
