/* ============================================
   AI PLAYGROUND MULTI-FILE MODULE CSS
   TLOGic - Standalone styles for AI analysis
   ============================================ */

/* All classes prefixed with .ai-playground- to avoid conflicts */

:root {
    --aip-primary: #be302a;
    --aip-primary-dark: #8a2420;
    --aip-primary-light: #f8d7d6;
    --aip-success: #198754;
    --aip-warning: #ffc107;
    --aip-border: var(--bs-border-color, #dee2e6);
    --aip-bg-tertiary: var(--bs-tertiary-bg, #f8f9fa);
}

/* ============================================
   CONTAINER
   ============================================ */

.ai-playground-container {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
}

/* ============================================
   PROVIDER STATUS BAR
   ============================================ */

.ai-playground-provider-status {
    padding: 10px 20px;
    background: var(--aip-bg-tertiary);
    border-bottom: 1px solid var(--aip-border);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-playground-provider-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.ai-playground-provider-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-playground-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aip-success);
}

.ai-playground-status-dot.warning {
    background: var(--aip-warning);
}

.ai-playground-status-dot.error {
    background: #dc3545;
}

.ai-playground-settings-btn {
    padding: 5px 12px;
    border: 1px solid var(--aip-border);
    background: var(--bs-body-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bs-body-color);
}

.ai-playground-settings-btn:hover {
    background: var(--aip-bg-tertiary);
}

/* ============================================
   STEP INDICATOR
   ============================================ */

.ai-playground-step-indicator {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--aip-border);
    flex-shrink: 0;
}

.ai-playground-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 30px;
    position: relative;
}

.ai-playground-step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 2px;
    background: var(--aip-border);
}

.ai-playground-step-item.completed:not(:last-child)::after {
    background: var(--aip-success);
}

.ai-playground-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--aip-border);
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.ai-playground-step-item.active .ai-playground-step-number {
    background: var(--aip-primary);
    color: white;
}

.ai-playground-step-item.completed .ai-playground-step-number {
    background: var(--aip-success);
    color: white;
}

.ai-playground-step-label {
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    transition: all 0.3s ease;
}

.ai-playground-step-item.active .ai-playground-step-label {
    color: var(--aip-primary);
    font-weight: 600;
}

.ai-playground-step-item.completed .ai-playground-step-label {
    color: var(--aip-success);
}

/* ============================================
   STEP CONTENT AREAS
   ============================================ */

.ai-playground-step-content {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
    display: none;
}

.ai-playground-step-content.active {
    display: block;
}

.ai-playground-step-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--bs-body-color);
}

.ai-playground-step-description {
    color: var(--bs-secondary-color);
    margin-bottom: 25px;
}

/* ============================================
   CATEGORY CARDS (Step 1)
   ============================================ */

.ai-playground-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.ai-playground-category-card {
    border: 2px solid var(--aip-border);
    border-radius: 10px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    background: var(--bs-body-bg);
}

.ai-playground-category-card:hover {
    border-color: var(--aip-primary);
    background: var(--aip-primary-light);
}

.ai-playground-category-card.selected {
    border-color: var(--aip-primary);
    background: var(--aip-primary-light);
}

.ai-playground-category-card i {
    font-size: 2rem;
    color: var(--aip-primary);
    margin-bottom: 10px;
    display: block;
}

.ai-playground-category-card h5 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

.ai-playground-category-card p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.ai-playground-category-card .check-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--aip-primary);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.ai-playground-category-card.selected .check-indicator {
    display: flex;
}

/* ============================================
   FIELD PICKER (Step 1)
   ============================================ */

.ai-playground-field-toggle-btn {
    margin-bottom: 15px;
}

.ai-playground-field-picker {
    border: 1px solid var(--aip-border);
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
    background: var(--bs-body-bg);
}

.ai-playground-field-group {
    border-bottom: 1px solid var(--aip-border);
}

.ai-playground-field-group:last-child {
    border-bottom: none;
}

.ai-playground-field-group-header {
    padding: 12px 15px;
    background: var(--aip-bg-tertiary);
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.ai-playground-field-group-header:hover {
    background: var(--bs-secondary-bg);
}

.ai-playground-field-group-header input[type="checkbox"] {
    margin-right: 10px;
    accent-color: var(--aip-primary);
    width: 16px;
    height: 16px;
}

.ai-playground-field-group-header .group-name {
    flex: 1;
    font-weight: 500;
    color: var(--bs-body-color);
}

.ai-playground-field-group-header .field-count {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    margin-right: 10px;
}

.ai-playground-field-group-header i {
    color: var(--bs-secondary-color);
    transition: transform 0.2s;
}

.ai-playground-field-group-header.expanded i {
    transform: rotate(90deg);
}

.ai-playground-field-group-fields {
    padding: 10px 15px 10px 45px;
    display: none;
    background: var(--bs-body-bg);
}

.ai-playground-field-group-fields.show {
    display: block;
}

.ai-playground-field-item {
    padding: 6px 0;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.ai-playground-field-item input[type="checkbox"] {
    margin-right: 10px;
    accent-color: var(--aip-primary);
}

.ai-playground-field-item label {
    flex: 1;
    cursor: pointer;
    color: var(--bs-body-color);
}

.ai-playground-field-item .field-type {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    background: var(--aip-bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* ============================================
   FILE DROP ZONE (Step 2)
   ============================================ */

.ai-playground-selection-badge {
    background: var(--aip-primary-light);
    border: 1px solid var(--aip-primary);
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-playground-selection-badge i {
    color: var(--aip-primary);
    font-size: 1.2rem;
}

.ai-playground-selection-badge .summary-text {
    flex: 1;
    color: var(--bs-body-color);
}

.ai-playground-selection-badge .summary-text strong {
    color: var(--aip-primary);
}

.ai-playground-selection-badge .edit-link {
    color: var(--aip-primary);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.ai-playground-selection-badge .edit-link:hover {
    text-decoration: underline;
}

.ai-playground-file-drop-zone {
    border: 3px dashed var(--aip-border);
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 25px;
    background: var(--bs-body-bg);
}

.ai-playground-file-drop-zone:hover,
.ai-playground-file-drop-zone.dragover {
    border-color: var(--aip-primary);
    background: var(--aip-primary-light);
}

.ai-playground-file-drop-zone i {
    font-size: 3rem;
    color: var(--bs-secondary-color);
    margin-bottom: 15px;
    transition: color 0.2s;
}

.ai-playground-file-drop-zone:hover i,
.ai-playground-file-drop-zone.dragover i {
    color: var(--aip-primary);
}

.ai-playground-file-drop-zone h4 {
    margin: 0 0 8px 0;
    color: var(--bs-body-color);
}

.ai-playground-file-drop-zone p {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

/* ============================================
   FILE LIST (Step 2)
   ============================================ */

.ai-playground-file-list {
    border: 1px solid var(--aip-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.ai-playground-file-list-header {
    padding: 12px 15px;
    background: var(--aip-bg-tertiary);
    border-bottom: 1px solid var(--aip-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-playground-file-list-header h6 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bs-body-color);
}

.ai-playground-file-list-header .file-count {
    background: var(--aip-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.ai-playground-file-list-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-playground-file-list-summary {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.ai-playground-clear-all-btn {
    padding: 5px 12px;
    border: 1px solid var(--aip-border);
    background: var(--bs-body-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bs-secondary-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-playground-clear-all-btn:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.ai-playground-file-list-items {
    max-height: 300px;
    overflow-y: auto;
}

.ai-playground-file-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--aip-border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.ai-playground-file-item:last-child {
    border-bottom: none;
}

.ai-playground-file-item:hover {
    background: var(--aip-bg-tertiary);
}

.ai-playground-file-item input[type="checkbox"] {
    accent-color: var(--aip-primary);
    width: 16px;
    height: 16px;
}

.ai-playground-file-icon {
    width: 40px;
    height: 40px;
    background: var(--aip-primary-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aip-primary);
    flex-shrink: 0;
}

.ai-playground-file-info {
    flex: 1;
    min-width: 0;
}

.ai-playground-file-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--bs-body-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-playground-file-meta {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.ai-playground-file-stats {
    text-align: right;
    flex-shrink: 0;
}

.ai-playground-file-stats .txn-count {
    font-weight: 600;
    color: var(--aip-primary);
}

.ai-playground-file-remove {
    padding: 5px 10px;
    border: none;
    background: none;
    color: var(--bs-secondary-color);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.ai-playground-file-remove:hover {
    color: var(--aip-primary);
}

.ai-playground-file-list-empty {
    padding: 40px;
    text-align: center;
    color: var(--bs-secondary-color);
}

.ai-playground-file-list-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--aip-border);
}

/* ============================================
   PROCESSING PANEL (Step 3)
   ============================================ */

.ai-playground-processing-panel {
    background: var(--aip-bg-tertiary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.ai-playground-processing-panel.complete {
    background: #d1e7dd;
    border: 1px solid #a3cfbb;
}

.ai-playground-processing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ai-playground-processing-header h6 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bs-body-color);
}

.ai-playground-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--aip-border);
    border-top-color: var(--aip-primary);
    border-radius: 50%;
    animation: aip-spin 1s linear infinite;
}

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

.ai-playground-progress-bar {
    height: 8px;
    background: var(--aip-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ai-playground-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--aip-primary), #e85550);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.ai-playground-progress-text {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

/* ============================================
   DATA SUMMARY CARDS (Step 3)
   ============================================ */

.ai-playground-data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.ai-playground-summary-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--aip-border);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.ai-playground-summary-card i {
    font-size: 1.5rem;
    color: var(--aip-primary);
    margin-bottom: 8px;
}

.ai-playground-summary-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

.ai-playground-summary-card .label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

/* ============================================
   PROMPT SECTION (Step 3)
   ============================================ */

.ai-playground-prompt-section {
    background: var(--bs-body-bg);
    border: 1px solid var(--aip-border);
    border-radius: 8px;
    overflow: hidden;
}

.ai-playground-prompt-suggestions {
    padding: 15px;
    background: var(--aip-bg-tertiary);
    border-bottom: 1px solid var(--aip-border);
}

.ai-playground-prompt-suggestions-label {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-playground-suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-playground-suggestion-pill {
    padding: 6px 14px;
    background: var(--bs-body-bg);
    border: 1px solid var(--aip-border);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--bs-body-color);
}

.ai-playground-suggestion-pill:hover {
    background: var(--aip-primary);
    color: white;
    border-color: var(--aip-primary);
}

.ai-playground-prompt-input-area {
    padding: 15px;
}

.ai-playground-prompt-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--aip-border);
    border-radius: 6px;
    font-size: 0.95rem;
    resize: vertical;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.ai-playground-prompt-textarea:focus {
    outline: none;
    border-color: var(--aip-primary);
    box-shadow: 0 0 0 3px rgba(190, 48, 42, 0.1);
}

.ai-playground-prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-playground-prompt-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-playground-token-info {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-playground-token-info .token-count {
    font-weight: 600;
    color: var(--aip-primary);
}

.ai-playground-token-info.warning .token-count {
    color: var(--aip-warning);
}

.ai-playground-token-info.danger .token-count {
    color: #dc3545;
}

.ai-playground-btn-download {
    background: var(--bs-body-bg);
    border: 1px solid var(--aip-border);
    color: var(--bs-body-color);
    padding: 10px 20px;
}

.ai-playground-btn-download:hover {
    background: var(--aip-bg-tertiary);
    border-color: var(--aip-primary);
    color: var(--aip-primary);
}

/* ============================================
   RESULTS AREA (Step 3)
   ============================================ */

.ai-playground-results-area {
    margin-top: 25px;
    border: 1px solid var(--aip-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.ai-playground-results-header {
    padding: 12px 15px;
    background: var(--aip-bg-tertiary);
    border-bottom: 1px solid var(--aip-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-playground-results-header h6 {
    margin: 0;
    color: var(--bs-body-color);
}

.ai-playground-results-actions {
    display: flex;
    gap: 8px;
}

.ai-playground-results-actions button {
    padding: 5px 12px;
    border: 1px solid var(--aip-border);
    background: var(--bs-body-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bs-body-color);
}

.ai-playground-results-actions button:hover {
    background: var(--aip-bg-tertiary);
}

.ai-playground-results-content {
    padding: 20px;
    min-height: 150px;
}

.ai-playground-results-placeholder {
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 40px;
}

.ai-playground-results-placeholder i {
    font-size: 3rem;
    color: var(--aip-border);
    margin-bottom: 15px;
}

.ai-playground-results-text {
    line-height: 1.7;
    color: var(--bs-body-color);
}

.ai-playground-results-text p {
    margin-bottom: 1rem;
}

.ai-playground-results-text ul,
.ai-playground-results-text ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.ai-playground-results-text strong {
    color: var(--aip-primary);
}

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */

.ai-playground-step-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 25px;
    border-top: 1px solid var(--aip-border);
    margin-top: 25px;
}

.ai-playground-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.ai-playground-btn-back {
    background: var(--bs-body-bg);
    border: 1px solid var(--aip-border);
    color: var(--bs-secondary-color);
}

.ai-playground-btn-back:hover {
    background: var(--aip-bg-tertiary);
    color: var(--bs-body-color);
}

.ai-playground-btn-next {
    background: var(--aip-primary);
    border: none;
    color: white;
}

.ai-playground-btn-next:hover {
    background: var(--aip-primary-dark);
}

.ai-playground-btn-next:disabled {
    background: var(--aip-border);
    cursor: not-allowed;
}

.ai-playground-btn-analyze {
    background: linear-gradient(135deg, var(--aip-primary), #e85550);
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 1rem;
}

.ai-playground-btn-analyze:hover {
    background: linear-gradient(135deg, var(--aip-primary-dark), var(--aip-primary));
}

.ai-playground-btn-analyze:disabled {
    background: var(--aip-border);
    cursor: not-allowed;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .ai-playground-step-indicator {
        padding: 15px 10px;
    }
    
    .ai-playground-step-item {
        padding: 0 15px;
    }
    
    .ai-playground-step-item:not(:last-child)::after {
        width: 20px;
        right: -10px;
    }
    
    .ai-playground-step-label {
        display: none;
    }
    
    .ai-playground-step-content {
        padding: 20px 15px;
    }
    
    .ai-playground-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ai-playground-data-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ai-playground-prompt-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ai-playground-btn-analyze {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ai-playground-category-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-playground-provider-status {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .ai-playground-provider-info {
        flex-wrap: wrap;
        gap: 10px;
    }
}
