/**
 * Six Sigma Project Tool Styles
 * Comprehensive styling for DMAIC methodology tool with collaboration support
 * Theme: Catppuccin Dark/Light with BPRboard palette
 */

/* ========================================
   WORKSPACE SELECTOR
   ======================================== */

.workspace-selector {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.workspace-selector h3 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
}

.workspace-selector h4 {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Workspace List */
.workspace-list {
    margin-bottom: 2rem;
}

.workspace-card {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.workspace-card:hover {
    background: rgba(30, 30, 46, 0.8);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(137, 180, 250, 0.15);
}

.workspace-card h5 {
    color: var(--accent-blue);
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
}

.workspace-card p {
    color: var(--text-muted);
    margin: 0 0 1rem;
}

/* Workspace Create Form */
.workspace-create {
    background: rgba(30, 30, 46, 0.4);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.workspace-create input,
.workspace-create textarea {
    width: 100%;
    background: rgba(17, 17, 27, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
}

.workspace-create input:focus,
.workspace-create textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.workspace-create textarea {
    min-height: 80px;
    resize: vertical;
}

/* ========================================
   DMAIC TOOL CONTAINER
   ======================================== */

.sixsigma-tool-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sixsigma-header {
    margin-bottom: 1.5rem;
}

.sixsigma-header h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin: 0 0 0.5rem;
}

.sixsigma-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* ========================================
   DMAIC PHASE NAVIGATION
   ======================================== */

.dmaic-phases {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.phase-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: rgba(30, 30, 46, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phase-btn:hover {
    background: rgba(30, 30, 46, 0.8);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.phase-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(137, 180, 250, 0.3);
}

/* Phase indicators with colors */
.phase-btn[data-phase="define"].active {
    background: var(--accent-primary);
}

.phase-btn[data-phase="measure"].active {
    background: var(--accent-green);
}

.phase-btn[data-phase="analyze"].active {
    background: var(--accent-yellow);
}

.phase-btn[data-phase="improve"].active {
    background: var(--accent-purple);
}

.phase-btn[data-phase="control"].active {
    background: var(--accent-teal);
}

/* ========================================
   PHASE CONTENT
   ======================================== */

.phase-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(30, 30, 46, 0.4);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.phase-section {
    margin-bottom: 2rem;
}

.phase-section h3 {
    color: var(--accent-blue);
    font-size: 1.3rem;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phase-section h3::before {
    content: '';
    width: 4px;
    height: 1.3rem;
    background: var(--accent-blue);
    border-radius: 2px;
}

.phase-section p {
    color: var(--text-muted);
    margin: 0 0 1rem;
    line-height: 1.6;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.sixsigma-form-group {
    margin-bottom: 1.5rem;
}

.sixsigma-form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sixsigma-form-group input[type="text"],
.sixsigma-form-group input[type="date"],
.sixsigma-form-group input[type="number"],
.sixsigma-form-group textarea,
.sixsigma-form-group select {
    width: 100%;
    background: rgba(17, 17, 27, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.sixsigma-form-group input:focus,
.sixsigma-form-group textarea:focus,
.sixsigma-form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
}

.sixsigma-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.sixsigma-form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ========================================
   DYNAMIC LISTS (Goals, KPIs, Causes, etc.)
   ======================================== */

.sixsigma-list {
    margin-top: 1rem;
}

.sixsigma-list-item {
    background: rgba(17, 17, 27, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: all 0.3s ease;
}

.sixsigma-list-item:hover {
    background: rgba(17, 17, 27, 0.8);
    border-color: var(--accent-blue);
}

.sixsigma-list-item-content {
    flex: 1;
    color: var(--text-primary);
}

.sixsigma-list-item-actions {
    display: flex;
    gap: 0.5rem;
}

.sixsigma-list-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Add item form */
.sixsigma-add-item {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.sixsigma-add-item input {
    flex: 1;
}

/* ========================================
   FISHBONE DIAGRAM (Analyze Phase)
   ======================================== */

.fishbone-diagram {
    background: rgba(17, 17, 27, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin: 1rem 0;
    position: relative;
}

.fishbone-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.fishbone-category {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.fishbone-category:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(137, 180, 250, 0.1);
}

.fishbone-category h4 {
    color: var(--accent-blue);
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fishbone-category-icon {
    font-size: 1.2rem;
}

.fishbone-causes {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fishbone-cause {
    background: rgba(17, 17, 27, 0.6);
    border-left: 3px solid var(--accent-blue);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fishbone-cause:last-child {
    margin-bottom: 0;
}

/* ========================================
   SOLUTION PROPOSALS (Improve Phase)
   ======================================== */

.solution-card {
    background: rgba(17, 17, 27, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.solution-card:hover {
    border-color: var(--accent-purple);
    box-shadow: 0 2px 8px rgba(203, 166, 247, 0.1);
}

.solution-card h4 {
    color: var(--accent-purple);
    font-size: 1.2rem;
    margin: 0 0 0.75rem;
}

.solution-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.solution-meta-item {
    display: flex;
    flex-direction: column;
}

.solution-meta-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.solution-meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ========================================
   PROCESS METRICS DISPLAY
   ======================================== */

.process-metrics {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.process-metrics h4 {
    color: var(--accent-blue);
    font-size: 1.2rem;
    margin: 0 0 1rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: rgba(17, 17, 27, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
}

.metric-value {
    color: var(--accent-blue);
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.sixsigma-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.sixsigma-btn-primary {
    background: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(137, 180, 250, 0.3);
}

.sixsigma-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(137, 180, 250, 0.5);
    transform: translateY(-2px);
}

.sixsigma-btn-secondary {
    background: rgba(30, 30, 46, 0.8);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.sixsigma-btn-secondary:hover {
    background: rgba(30, 30, 46, 1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.sixsigma-btn-success {
    background: linear-gradient(135deg, var(--accent-green), #94e2d5);
    color: var(--bg-primary);
}

.sixsigma-btn-success:hover {
    box-shadow: 0 4px 12px rgba(166, 227, 161, 0.4);
    transform: translateY(-2px);
}

.sixsigma-btn-danger {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.sixsigma-btn-danger:hover {
    background: var(--accent-red);
    color: var(--text-primary);
}

.sixsigma-btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.sixsigma-btn-block {
    width: 100%;
    justify-content: center;
}

.sixsigma-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   ACTION BAR
   ======================================== */

.sixsigma-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.sixsigma-action-group {
    display: flex;
    gap: 0.5rem;
}

/* ========================================
   STATS & BADGES
   ======================================== */

.sixsigma-stats {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.sixsigma-stat {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sixsigma-stat-icon {
    font-size: 1.5rem;
}

.sixsigma-stat-info {
    display: flex;
    flex-direction: column;
}

.sixsigma-stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.sixsigma-stat-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.sixsigma-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sixsigma-badge-define {
    background: rgba(137, 180, 250, 0.2);
    color: #89b4fa;
}

.sixsigma-badge-measure {
    background: rgba(166, 227, 161, 0.2);
    color: #a6e3a1;
}

.sixsigma-badge-analyze {
    background: rgba(249, 226, 175, 0.2);
    color: #f9e2af;
}

.sixsigma-badge-improve {
    background: rgba(203, 166, 247, 0.2);
    color: #cba6f7;
}

.sixsigma-badge-control {
    background: rgba(137, 220, 235, 0.2);
    color: #89dceb;
}

/* ========================================
   PROGRESS INDICATOR
   ======================================== */

.sixsigma-progress {
    margin: 1.5rem 0;
}

.sixsigma-progress-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.sixsigma-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(30, 30, 46, 0.8);
    border-radius: 4px;
    overflow: hidden;
}

.sixsigma-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.5s ease;
}

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

@media (max-width: 1024px) {
    .dmaic-phases {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fishbone-categories {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sixsigma-tool-container {
        padding: 0.5rem;
    }

    .phase-btn {
        min-width: 100px;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .phase-content {
        padding: 0.75rem;
    }

    .sixsigma-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sixsigma-action-group {
        justify-content: stretch;
    }

    .sixsigma-btn {
        flex: 1;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .solution-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sixsigma-header h2 {
        font-size: 1.4rem;
    }

    .phase-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
    }

    .workspace-selector {
        padding: 1rem;
    }

    .sixsigma-stats {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ========================================
   LIGHT THEME OVERRIDES
   ======================================== */

[data-theme="light"] .workspace-card,
[data-theme="light"] .sixsigma-form-group input,
[data-theme="light"] .sixsigma-form-group textarea,
[data-theme="light"] .sixsigma-form-group select,
[data-theme="light"] .sixsigma-list-item,
[data-theme="light"] .fishbone-diagram,
[data-theme="light"] .fishbone-category,
[data-theme="light"] .solution-card {
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .workspace-card:hover,
[data-theme="light"] .sixsigma-list-item:hover,
[data-theme="light"] .fishbone-category:hover,
[data-theme="light"] .solution-card:hover {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .workspace-create,
[data-theme="light"] .phase-content,
[data-theme="light"] .process-metrics {
    background: rgba(240, 240, 245, 0.6);
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.phase-content {
    animation: slideIn 0.3s ease;
}

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

.sixsigma-btn-primary:active {
    animation: pulse 0.3s ease;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.sixsigma-divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

.sixsigma-text-center {
    text-align: center;
}

.sixsigma-text-muted {
    color: var(--text-muted);
}

.sixsigma-text-primary {
    color: var(--accent-blue);
}

.sixsigma-mt-1 { margin-top: 0.5rem; }
.sixsigma-mt-2 { margin-top: 1rem; }
.sixsigma-mt-3 { margin-top: 1.5rem; }
.sixsigma-mb-1 { margin-bottom: 0.5rem; }
.sixsigma-mb-2 { margin-bottom: 1rem; }
.sixsigma-mb-3 { margin-bottom: 1.5rem; }

.sixsigma-flex {
    display: flex;
}

.sixsigma-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sixsigma-flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sixsigma-flex-gap {
    gap: 1rem;
}
