/* ui-manager.css - Complete UI Management for AWDE Agent Wizard */
/* FIXED: Added proper dark background for the page */

/* ==========================================
   GLOBAL DARK MODE BACKGROUND - FIXED
   ========================================== */

html {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: #f1f5f9;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ==========================================
   STATUS MESSAGE SYSTEM
   ========================================== */

.status-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    pointer-events: none;
}

.status-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-message.status-success {
    background: rgba(34, 197, 94, 0.9);
    color: white;
    border-color: rgba(34, 197, 94, 0.3);
}

.status-message.status-error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-color: rgba(239, 68, 68, 0.3);
}

.status-message.status-warning {
    background: rgba(245, 158, 11, 0.9);
    color: white;
    border-color: rgba(245, 158, 11, 0.3);
}

.status-message.status-info {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
}

.status-message.status-loading {
    background: rgba(75, 85, 99, 0.9);
    color: white;
    border-color: rgba(75, 85, 99, 0.3);
}

.status-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.status-content {
    flex: 1;
    min-width: 0;
}

.status-main {
    font-weight: 600;
    margin-bottom: 4px;
}

.status-details {
    font-size: 0.9rem;
    opacity: 0.9;
    word-wrap: break-word;
}

.status-close {
    background: none;
    border: none;
    color: currentColor;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.status-close:hover {
    opacity: 1;
}

/* Status message animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================
   ENHANCED STATUS OVERLAY SYSTEM
   ========================================== */

.enhanced-status-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 360px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.status-overlay-header {
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px 12px 0 0;
}

.overlay-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.overlay-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0.25rem 0 0 0;
}

/* ==========================================
   10-PHASE PROGRESS GRID - FIXED FOR INDEX.HTML
   ========================================== */

.ten-phase-grid {
    padding: 1rem;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr; /* Force single column to fix height */
}

/* Override any existing phase-item styles */
.phase-item {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 6px !important;
    padding: 0.25rem 0.4rem !important;
    transition: all 0.2s ease !important;
    /* Remove any height constraints that might exist */
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    /* Ensure proper layout */
    display: block !important;
    grid-template-columns: none !important;
}

.phase-item.active {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

.phase-item.completed {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.1) !important;
}

.phase-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin: 0 !important;
    margin-bottom: 0.25rem !important;
}

.phase-number {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

.phase-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #f1f5f9;
    margin: 0;
    line-height: 1.2;
}

.phase-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.phase-badge.accessible {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.phase-badge.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.phase-badge.generating {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.phase-badge.review {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.phase-badge.pending {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.phase-badge.locked {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.phase-artifacts {
    display: flex;
    gap: 0.25rem;
    margin: 0;
    margin-top: 0.25rem;
}

.artifact-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.artifact-dot.generated {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.artifact-dot.approved {
    background: #22c55e;
    border-color: #22c55e;
}

.artifact-dot.empty {
    background: transparent;
}

/* ==========================================
   GENERATION STATUS PANEL
   ========================================== */

.generation-status-panel {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1rem;
}

.generation-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #f1f5f9;
}

.current-generation {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.generation-phase {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 0.25rem;
}

.generation-progress {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.progress-bar-mini {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
    transition: width 0.3s ease;
}

/* ==========================================
   QUICK ACTIONS
   ========================================== */

.quick-actions-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.action-btn-mini {
    padding: 0.4rem 0.6rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    color: #3b82f6;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.action-btn-mini:hover {
    background: rgba(59, 130, 246, 0.2);
}

/* ==========================================
   ACTIVITY FEED
   ========================================== */

.activity-feed-mini {
    margin-top: 1rem;
}

.activity-feed-header {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #f1f5f9;
}

.activity-stream {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.4);
}

.activity-entry {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 0.75rem;
    color: #cbd5e1;
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

/* ==========================================
   MAIN CONTENT - SIMPLIFIED (no overlay)
   ========================================== */

.main-content-enhanced {
    background: rgba(30, 41, 59, 0.3);
    min-height: 100vh;
    padding: 40px;
}

.container {
    background: transparent;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* ==========================================
   WIZARD HEADER ENHANCEMENTS
   ========================================== */

.wizard-header {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.wizard-header-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.wizard-header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6, #2563eb);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.wizard-header p {
    color: #cbd5e1;
    font-size: 1.1rem;
    margin: 0;
}

.enhanced-phase-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3b82f6;
}

.generation-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #8b5cf6;
}

.generation-indicator-dot {
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: pulse-generation 2s infinite;
}

@keyframes pulse-generation {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* ==========================================
   PHASE OVERVIEW
   ========================================== */

.phase-overview {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.phase-overview h2 {
    margin: 0 0 15px 0;
    color: #f1f5f9;
    font-size: 1.4rem;
}

.phase-overview p {
    margin: 0;
    color: #94a3b8;
    line-height: 1.6;
}

/* ==========================================
   TOGGLE BUTTON
   ========================================== */

.overlay-toggle {
    position: fixed;
    top: 20px;
    right: 390px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1001;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.overlay-toggle:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1200px) {
    .enhanced-status-overlay {
        display: none;
    }
    
    .main-content-enhanced {
        margin-right: 0;
    }
    
    .overlay-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-content-enhanced {
        padding: 20px;
    }
    
    .ten-phase-grid {
        padding: 0.5rem;
        gap: 0.4rem;
    }
    
    .phase-item {
        padding: 0.2rem 0.3rem !important;
    }
    
    .overlay-title {
        font-size: 1rem;
    }
    
    .phase-name {
        font-size: 0.75rem;
    }
    
    .phase-number {
        font-size: 0.6rem;
    }
    
    .wizard-header h1 {
        font-size: 1.8rem;
    }
    
    .wizard-header-enhanced {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* ==========================================
    PHASE ACTION BUTTONS
    ========================================== */

    .phase-actions-compact {
        display: flex;
        gap: 4px;
        margin-top: 6px;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .phase-item:hover .phase-actions-compact {
        opacity: 1;
    }

    .action-btn-mini {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        color: white !important;
        padding: 4px 8px !important;
        margin: 0 2px !important;
        border-radius: 4px !important;
        font-size: 0.8rem !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        opacity: 0.7 !important;
    }

    .action-btn-mini:hover {
        opacity: 1 !important;
        background: rgba(255, 255, 255, 0.2) !important;
        transform: translateY(-1px) !important;
    }

    .action-btn-mini:disabled {
        opacity: 0.4 !important;
        cursor: not-allowed !important;
    }

    /* ==========================================
    FILE INDICATORS
    ========================================== */

    .file-indicator {
        font-size: 10px !important;
        background: rgba(59, 130, 246, 0.1) !important;
        color: #60a5fa !important;
        padding: 2px 4px !important;
        border-radius: 3px !important;
        margin-left: 8px !important;
        animation: fadeIn 0.3s ease-in-out !important;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: scale(0.8); }
        to { opacity: 1; transform: scale(1); }
    }

    /* ==========================================
    ITERATION WORKSPACE
    ========================================== */

    .iteration-workspace {
        position: fixed;
        top: 10%;
        left: 10%;
        width: 80%;
        height: 80%;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 12px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        color: white;
        display: none;
        flex-direction: column;
    }

    .workspace-header {
        padding: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .workspace-header h3 {
        margin: 0;
        color: #f1f5f9;
        font-size: 18px;
        font-weight: 600;
    }

    .workspace-content {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        padding: 20px;
        overflow: hidden;
    }

    .chat-section {
        display: flex;
        flex-direction: column;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 16px;
    }

    .chat-input {
        display: flex;
        gap: 8px;
    }

    .chat-input input {
        flex: 1;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
        padding: 10px;
        color: white;
        font-size: 14px;
    }

    .chat-input input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }

    .chat-input button {
        background: #3b82f6;
        border: none;
        border-radius: 6px;
        padding: 10px 20px;
        color: white;
        cursor: pointer;
        font-weight: 500;
        transition: background 0.2s ease;
    }

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

    .chat-message {
        margin: 8px 0;
        padding: 12px;
        border-radius: 8px;
        max-width: 80%;
    }

    .chat-message.user {
        background: rgba(59, 130, 246, 0.2);
        margin-left: auto;
        border: 1px solid rgba(59, 130, 246, 0.3);
    }

    .chat-message.assistant {
        background: rgba(34, 197, 94, 0.2);
        margin-right: auto;
        border: 1px solid rgba(34, 197, 94, 0.3);
    }

    .chat-message.system {
        background: rgba(75, 85, 99, 0.2);
        margin: 8px auto;
        text-align: center;
        border: 1px solid rgba(75, 85, 99, 0.3);
    }

    .message-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 6px;
        font-size: 12px;
        opacity: 0.8;
    }

    .message-role {
        font-weight: 600;
    }

    .message-time {
        font-size: 10px;
    }

    .preview-section {
        display: flex;
        flex-direction: column;
    }

    .preview-tabs {
        display: flex;
        gap: 4px;
        margin-bottom: 16px;
    }

    .preview-tab {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px 6px 0 0;
        padding: 8px 16px;
        color: rgba(255, 255, 255, 0.7);
        cursor: pointer;
        font-size: 14px;
        transition: all 0.2s ease;
    }

    .preview-tab.active {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border-bottom-color: transparent;
    }

    .preview-content {
        flex: 1;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0 8px 8px 8px;
        padding: 16px;
        overflow-y: auto;
    }

    .content-display {
        color: #e2e8f0;
        font-size: 14px;
        line-height: 1.6;
    }

    /* Mobile responsive */
    @media (max-width: 768px) {
        .iteration-workspace {
            top: 5%;
            left: 5%;
            width: 90%;
            height: 90%;
        }
        
        .workspace-content {
            grid-template-columns: 1fr;
            grid-template-rows: 1fr 1fr;
        }
    }

    /* ==========================================
    ENHANCED STATUS CONTAINER
    ========================================== */

    .status-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 10000;
        max-width: 400px;
        pointer-events: none;
    }

    .status-message {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 8px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(10px);
        pointer-events: auto;
        animation: slideInRight 0.3s ease-out;
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: white;
    }

    .status-message.status-success {
        background: rgba(34, 197, 94, 0.9);
        border-color: rgba(34, 197, 94, 0.3);
    }

    .status-message.status-error {
        background: rgba(239, 68, 68, 0.9);
        border-color: rgba(239, 68, 68, 0.3);
    }

    .status-message.status-warning {
        background: rgba(245, 158, 11, 0.9);
        border-color: rgba(245, 158, 11, 0.3);
    }

    .status-message.status-info {
        background: rgba(59, 130, 246, 0.9);
        border-color: rgba(59, 130, 246, 0.3);
    }

    .status-message.status-loading {
        background: rgba(75, 85, 99, 0.9);
        border-color: rgba(75, 85, 99, 0.3);
    }

    .status-icon {
        font-size: 1.2rem;
        flex-shrink: 0;
        margin-top: 2px;
    }

    .status-content {
        flex: 1;
        min-width: 0;
    }

    .status-main {
        font-weight: 600;
        margin-bottom: 4px;
    }

    .status-close {
        background: none;
        border: none;
        color: currentColor;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 0;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background 0.2s ease;
    }

    .status-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(100%);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* ==========================================
    SYNC STATUS INDICATORS
    ========================================== */

    .sync-status {
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 4px;
        font-weight: 500;
    }

    .sync-status.success {
        background: rgba(34, 197, 94, 0.1);
        color: #22c55e;
        border: 1px solid rgba(34, 197, 94, 0.2);
    }

    .sync-status.warning {
        background: rgba(245, 158, 11, 0.1);
        color: #f59e0b;
        border: 1px solid rgba(245, 158, 11, 0.2);
    }

    .sync-status.error {
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        border: 1px solid rgba(239, 68, 68, 0.2);
    }

    .sync-status.syncing {
        background: rgba(59, 130, 246, 0.1);
        color: #3b82f6;
        border: 1px solid rgba(59, 130, 246, 0.2);
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }
}