/* CAPA Workflow Specific Styles */
/* Import common styles first */
@import url('../style.css');

/* Workflow Progress Bar */
.workflow-progress-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    position: relative;
}

.workflow-progress-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
    transform: translateY(-50%);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.progress-step:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.step-label {
    font-size: 0.8rem;
    text-align: center;
    color: #6c757d;
    font-weight: 500;
    max-width: 100px;
    line-height: 1.2;
}

/* Active step */
.progress-step.active .step-circle {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    animation: pulse-active 2s infinite;
}

.progress-step.active .step-label {
    color: #0d6efd;
    font-weight: 600;
}

/* Completed step */
.progress-step.completed .step-circle {
    background-color: #198754;
    color: white;
    border-color: #198754;
}

.progress-step.completed .step-label {
    color: #198754;
}

@keyframes pulse-active {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

/* CAPA Summary Card */
#capa-summary-card {
    border-left: 4px solid #0d6efd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#capa-summary-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

/* RCA Visualization Styles */
.why-step {
    background: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    position: relative;
}

.why-step::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #0d6efd;
    border-radius: 2px;
}

/* Fishbone Diagram */
.fishbone-container {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.problem-statement {
    display: inline-block;
    position: relative;
}

.problem-statement::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 20px solid #0d6efd;
}

/* Fault Tree Styles */
.fault-tree-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

.tree-level {
    margin-bottom: 1.5rem;
}

.fault-box {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    margin: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.top-event {
    background-color: #dc3545;
    color: white;
}

.intermediate {
    background-color: #fd7e14;
    color: white;
}

.basic-event {
    background-color: #17a2b8;
    color: white;
}

.gate-symbol {
    align-self: center;
    font-weight: bold;
    background: #6c757d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.fault-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 1rem;
}

/* Implementation Tracking */
.effectiveness-meter {
    min-width: 120px;
}

.effectiveness-meter .progress {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.effectiveness-meter .progress-bar {
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.6s ease;
}

/* Step Templates */
.step-template {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Processing Animation */
.spinner-border {
    animation: spinner-border 1s linear infinite;
}

/* Action Plan Table */
#generated-actions-table tr {
    transition: background-color 0.2s ease;
}

#generated-actions-table tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Card Headers with Gradient */
.card-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
}

.card-header.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #31d2f2 100%) !important;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%) !important;
}

/* Evidence Upload Section */
.evidence-upload-section {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.evidence-upload-section:hover {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, 0.05);
}

/* Status Badges */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .workflow-progress-container {
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .progress-step {
        min-width: 80px;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .workflow-progress-container {
        flex-direction: column;
        gap: 1rem;
    }

    .workflow-progress-container::before {
        display: none;
    }

    .step-circle {
        width: 35px;
        height: 35px;
    }

    .step-label {
        font-size: 0.75rem;
        max-width: 80px;
    }

    #capa-summary-details .row {
        flex-direction: column;
    }

    .fault-tree-container {
        padding: 1rem;
    }

    .fault-group {
        margin: 0 0.5rem;
    }
}

@media (max-width: 576px) {
    .workflow-progress-container {
        padding: 0.5rem;
    }

    #generated-actions-table {
        font-size: 0.8rem;
    }

    .effectiveness-meter {
        min-width: 100px;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {

    .workflow-progress-container,
    .btn,
    .sidebar-section {
        display: none !important;
    }

    #capa-summary-card,
    #workflow-content-area {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .workflow-progress-container::before {
        background: #495057;
    }

    .why-step {
        background: #343a40;
        color: #f8f9fa;
    }

    .fishbone-container,
    .fault-tree-container {
        background: #343a40;
    }

    .evidence-upload-section {
        background: #343a40;
        border-color: #495057;
    }
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

/* Custom Scrollbars */
.step-template::-webkit-scrollbar {
    width: 6px;
}

.step-template::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.step-template::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.step-template::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}