/* Corrective Action Modal Overlay */
.corrective-action-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.corrective-action-modal-overlay.show {
    display: flex;
}

/* Modal Container */
.corrective-action-modal-container {
    background: linear-gradient(135deg, #0a1d37, #1e3a8a);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    margin-top: 20px;
}

/* Modal Header */
.corrective-action-modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.corrective-action-modal-title {
    color: #facc15;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
}

.corrective-action-modal-icon {
    margin-right: 10px;
    font-size: 20px;
}

.corrective-action-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.corrective-action-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Modal Body */
.corrective-action-modal-body {
    padding: 20px;
}

/* Alert Information Section */
.corrective-action-alert-info {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border: 1px solid #dc3545;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #ffffff;
}

.alert-info-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.alert-info-icon {
    font-size: 20px;
    margin-right: 8px;
}

.alert-info-message {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.alert-info-details {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 5px;
}

/* Status and Progress Section */
.corrective-action-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #ffc107;
    color: #000;
}

.status-in-progress {
    background: #17a2b8;
    color: #fff;
}

.status-completed {
    background: #28a745;
    color: #fff;
}

.status-escalated {
    background: #dc3545;
    color: #fff;
}

/* Progress Bar */
.progress-section {
    margin: 15px 0;
}

.progress-text {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    margin-bottom: 8px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #facc15);
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Action Steps List */
.corrective-action-steps-header {
    color: #e2e8f0;
    font-size: 16px;
    margin-bottom: 15px;
}

.corrective-action-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.corrective-action-step {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.corrective-action-step:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.corrective-action-step.completed {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.corrective-action-step.completed .step-text {
    opacity: 0.8;
}

.corrective-action-step.completed .step-title {
    text-decoration: line-through;
}

/* Step Checkbox */
.step-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    background: #1e3a8a;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
    position: relative;
}

.step-checkbox:checked {
    background: linear-gradient(45deg, #3b82f6, #facc15);
    border-color: #facc15;
}

.step-checkbox:checked::after {
    content: '✓';
    color: #0a1d37;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.step-checkbox:focus {
    outline: none;
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.5);
    border-color: #facc15;
}

.step-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Step Content */
.step-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #e2e8f0;
}

.step-number {
    color: #facc15;
    font-weight: 500;
    margin-right: 8px;
}

.step-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.step-description {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.3;
    margin-top: 4px;
}

.step-timestamp {
    color: #34d399;
    font-size: 11px;
    font-style: italic;
    margin-top: 4px;
}

/* Notes Section */
.corrective-action-notes {
    margin: 20px 0;
}

.notes-label {
    color: #e2e8f0;
    font-size: 16px;
    margin-bottom: 8px;
    display: block;
}

.notes-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 14px;
    background: #1e3a8a;
    color: #facc15;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
}

.notes-textarea:focus {
    border-color: #facc15;
    background: #2b4b9b;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
    outline: none;
}

.notes-textarea::placeholder {
    color: #94a3b8;
    opacity: 0.7;
}

/* Modal Footer */
.corrective-action-modal-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-info {
    flex: 1;
    min-width: 200px;
}

.footer-timestamp {
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
}

.footer-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Action Buttons */
.corrective-action-btn {
    background: linear-gradient(45deg, #3b82f6, #facc15);
    border: none;
    color: #0a1d37;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s, color 0.3s, transform 0.2s;
    font-family: 'Open Sans', sans-serif;
}

.corrective-action-btn:hover {
    background: linear-gradient(45deg, #facc15, #3b82f6);
    color: #ffffff;
    transform: translateY(-1px);
}

.corrective-action-btn:active {
    transform: translateY(0);
}

.corrective-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.corrective-action-btn.btn-escalate {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: #ffffff;
}

.corrective-action-btn.btn-escalate:hover {
    background: linear-gradient(45deg, #d97706, #b45309);
}

.corrective-action-btn.btn-close {
    background: #475569;
    color: #ffffff;
    border: 1px solid #64748b;
    padding: 10px 20px; 
    min-width: 100px; 
    white-space: nowrap; 
}

.corrective-action-btn.btn-close:hover {
    background: #334155;
    border-color: #94a3b8;
}

/* Loading State */
.corrective-action-loading {
    text-align: center;
    padding: 40px 20px;
    color: #facc15;
}

.corrective-action-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #facc15;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.corrective-action-error {
    text-align: center;
    padding: 20px;
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    margin: 10px 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .corrective-action-modal-overlay {
        padding: 10px;
    }

    .corrective-action-modal-container {
        max-height: 95vh;
        margin-top: 0;
    }

    .corrective-action-modal-header,
    .corrective-action-modal-body,
    .corrective-action-modal-footer {
        padding: 15px;
    }

    .corrective-action-modal-title {
        font-size: 16px;
    }

    .corrective-action-steps-header {
        font-size: 14px;
    }

    .corrective-action-step {
        padding: 10px;
    }

    .step-content {
        font-size: 13px;
    }

    .step-description {
        font-size: 11px;
    }

    .corrective-action-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-buttons {
        width: 100%;
        justify-content: center;
    }

    .corrective-action-btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 400px) {
    .corrective-action-modal-header,
    .corrective-action-modal-body,
    .corrective-action-modal-footer {
        padding: 12px;
    }

    .corrective-action-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .step-checkbox {
        width: 16px;
        height: 16px;
    }

    .notes-textarea {
        min-height: 60px;
        font-size: 13px;
    }
}

/* Animation for modal appearance */
.corrective-action-modal-container {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.hidden {
    display: none !important;
}

.modal-open {
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #facc15);
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}


.progress-bar.progress-animated {
    width: var(--progress-width, 0%);
}