:root {
    --primary: #3b82f6;
    --primary-light: #dbeafe;
    --primary-dark: #1e40af;
    --success: #22c55e;
    --success-light: #dcfce7;
    --gray-light: #f3f4f6;
    --gray: #9ca3af;
    --gray-dark: #4b5563;
    --red: #ef4444;
    --red-light: #fee2e2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: #f9fafb;
    color: #111827;
    line-height: 1.5;
    padding: 1.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

.header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    flex-direction: column;
    gap: 1rem;
    flex-wrap: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-grow: 1;
}

.form-control {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    background-color: white;
    color: var(--gray-dark);
    font-size: 0.875rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

#searchInput {
    min-width: 200px;
    flex-grow: 1;
}

.search-container {
    position: relative;
    display: flex;
    flex-grow: 1;
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.search-result-item:hover {
    background-color: var(--primary-light);
}

.source-selector {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    background-color: white;
    color: var(--gray-dark);
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 200px;
}

.source-selector:hover {
    border-color: var(--primary);
}

.source-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1f2937;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    justify-content: space-around;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #1f2937;
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-info {
    background-color: #0ea5e9; /* A nice sky blue */
    color: white;
}

.btn-info:hover {
    background-color: #0284c7; /* Darker sky blue */
}

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

.normative {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--gray-light);
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
}

.normative h2 {
    font-size: 1rem;
    color: var(--gray-dark);
    margin-bottom: 0.5rem;
}

.normative p {
    font-size: 0.875rem;
    color: #6b7280;
}

.progress-section {
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 0.75rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 9999px;
    transition: width 0.5s;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Default, will be adjusted by JS if fewer stats */
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-dark);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1f2937;
}

.current-phase {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background-color: var(--primary-light);
    border-radius: 0.5rem;
    border: 1px solid #bfdbfe;
}

.current-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.current-phase-title {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.phase-badge {
    padding: 0.25rem 0.75rem;
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-dark);
    border-radius: 9999px;
    font-size: 0.875rem;
}

.current-phase-desc {
    color: #1e3a8a;
    margin-bottom: 0.75rem;
}

.current-phase-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.deadline span:first-child, .risks span:first-child {
    font-weight: normal; /* Reset from potential bold if label itself is bold */
}
.deadline span:last-child, .risks span:last-child {
    font-weight: 600;
}


.risks {
    color: var(--red);
}

.phases-list-container { /* Renamed to avoid conflict with phasesList JS variable */
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.phases-list-header { /* Renamed to avoid conflict */
    padding: 1rem;
    background-color: var(--gray-light);
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}

.phase-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.phase-item:last-child {
    border-bottom: none;
}

.phase-completed {
    background-color: var(--success-light);
    border-left: 4px solid var(--success);
}

.phase-current {
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.phase-future {
    background-color: white;
    border-left: 4px solid var(--gray);
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.phase-number-container {
    display: flex;
    align-items: center;
}

.phase-number {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    margin-right: 0.75rem;
    font-weight: 500;
}

.phase-completed .phase-number {
    background-color: var(--success);
    color: white;
}

.phase-current .phase-number {
    background-color: var(--primary);
    color: white;
}

.phase-future .phase-number {
    background-color: var(--gray-light);
    color: var(--gray-dark);
}

.phase-info h3 {
    font-weight: 500;
}

.phase-info p {
    font-size: 0.875rem;
    color: var(--gray-dark);
}

.phase-info ul {
    font-size: 0.875rem;
    color: var(--gray-dark);
    padding-left: 1.25rem; /* Match other lists in the component */
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.phase-content {
    margin-top: 0.75rem;
    padding-left: 2.75rem;
    display: none;
}

.phase-content p {
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.phase-documents {
    margin-top: 0.75rem;
}

.phase-documents h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.phase-documents ul {
    padding-left: 1.25rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.footer-notes {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--gray);
}

.show {
    display: block;
}

.chevron {
    transition: transform 0.2s;
}

.rotate {
    transform: rotate(180deg);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #16a34a;
}

.add-procedure-btn {
    font-size: 1.2rem;
    font-weight: bold;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-procedure-btn:hover {
    transform: scale(1.05);
    transition: transform 0.2s;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease-out;
}

.preview-modal-content {
    max-width: 1000px;
    width: 95%;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: var(--gray-light);
    border-radius: 0.5rem 0.5rem 0 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--gray-dark);
    font-size: 1.25rem;
}

.close {
    color: var(--gray);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
    border: none;
    background: none;
}

.close:hover {
    color: var(--gray-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-dark);
}

.json-input {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    background-color: #f9fafb;
}

.json-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.json-error {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: var(--red-light);
    border: 1px solid var(--red);
    border-radius: 0.25rem;
    color: var(--red);
    font-size: 0.875rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background-color: var(--gray-light);
    border-radius: 0 0 0.5rem 0.5rem;
}

#previewContainer {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    max-height: 500px;
    overflow-y: auto;
}
