/* Template Combination Manager Styles */

/* Combination Button in Toolbar */
.combination-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.combination-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.combination-btn .btn-icon {
    font-size: 20px;
}

/* Combination Modal */
.combination-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.combination-modal-content {
    /* FIXED: Match Prompt Studio dark theme instead of white */
    background: var(--bg-secondary, #1a1a2e);
    color: var(--text-primary, #e0e0e0);
    border-radius: 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color, #333);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.combination-modal-header {
    padding: 30px;
    border-bottom: 2px solid var(--border-color, #333);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 36px;
    cursor: pointer;
    color: var(--text-secondary, #999);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-hover, #2a2a3e);
    color: var(--text-primary, #e0e0e0);
}

/* Tabs */
.combination-tabs {
    display: flex;
    padding: 0 30px;
    gap: 10px;
    border-bottom: 2px solid var(--border-color, #333);
}

.tab-btn {
    padding: 15px 30px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    color: #764ba2;
}

.tab-pane {
    display: none;
    padding: 30px;
}

.tab-pane.active {
    display: block;
}

/* Combinations Grid */
.combinations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.combination-card {
    background: var(--bg-primary, #0f0f23);
    border: 2px solid var(--border-color, #333);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.combination-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    background: var(--bg-hover, #1a1a35);
}

.combo-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.combination-card h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: var(--text-primary, #e0e0e0);
}

.combo-description {
    color: var(--text-secondary, #999);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.combo-templates {
    background: var(--bg-secondary, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--text-secondary, #999);
}

.combo-value {
    color: #667eea;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
}

.combo-benefits {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.combo-benefits li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary, #ccc);
    border-bottom: 1px solid var(--border-color, #333);
}

.combo-benefits li:last-child {
    border-bottom: none;
}

.combo-use-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.combo-use-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Custom Combination Builder */
.custom-combination-builder {
    max-width: 800px;
    margin: 0 auto;
}

.custom-combination-builder h3 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.template-selector {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 25px;
}

.template-category-group {
    margin-bottom: 25px;
}

.template-category-group h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.template-checkbox {
    display: block;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-checkbox:hover {
    background: #f0f4ff;
    transform: translateX(5px);
}

.template-checkbox input {
    margin-right: 12px;
    cursor: pointer;
}

.template-checkbox span {
    font-size: 15px;
    color: #333;
}

/* Loading State */
.combination-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.loader-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-content p {
    font-size: 18px;
    font-weight: 600;
}

/* Results Modal */
.combination-results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15000;
    animation: fadeIn 0.3s ease;
}

.results-modal-content {
    background: white;
    border-radius: 20px;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.results-header {
    padding: 30px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.results-header h2 {
    margin: 0;
    font-size: 28px;
}

.results-body {
    padding: 30px;
}

.unified-strategy {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.unified-strategy h3 {
    margin-top: 0;
    color: #667eea;
    font-size: 24px;
    margin-bottom: 20px;
}

.unified-strategy pre {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.individual-results {
    margin-top: 30px;
}

.individual-results h3 {
    color: #764ba2;
    font-size: 24px;
    margin-bottom: 20px;
}

.template-result {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.template-result h4 {
    margin-top: 0;
    color: #333;
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.template-result pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.results-actions {
    padding: 25px 30px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .combination-modal-content,
    .results-modal-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .combination-modal-header,
    .results-body {
        border-color: #333;
    }

    .combination-card {
        background: #2a2a2a;
        border-color: #444;
    }

    .combination-card h3 {
        color: #e0e0e0;
    }

    .combo-description {
        color: #aaa;
    }

    .combo-templates {
        background: #333;
    }

    .template-selector {
        background: #2a2a2a;
    }

    .template-checkbox {
        background: #333;
    }

    .template-checkbox:hover {
        background: #3a3a5a;
    }

    .unified-strategy {
        background: #2a2a2a;
    }

    .unified-strategy pre {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }

    .template-result {
        background: #2a2a2a;
        border-color: #444;
    }

    .template-result pre {
        background: #1a1a1a;
        color: #e0e0e0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .combinations-grid {
        grid-template-columns: 1fr;
    }

    .combination-modal-content,
    .results-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 15px;
    }

    .combination-modal-header,
    .results-header {
        padding: 20px;
    }

    .combination-modal-header h2 {
        font-size: 24px;
    }

    .tab-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .results-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }
}
