/* file: platform_app/static/style.css */
/* [PRODUCTION-GRADE V5.1] - Complete, consistent, and modern UI stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --off-white: #fafafa;
    --pure-white: #ffffff;
    --dark-text: #1a1a1a;
    --cosmic-blue: #4a9eff;
    --success-green: #10b981;
    --error-red: #ef4444;
    --warning-amber: #f59e0b;
    --text-muted: #666666;
    --light-border: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--off-white);
    color: #374151;
    line-height: 1.7;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem;
}

.app-container {
    background-color: var(--pure-white);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.07);
    border: 1px solid var(--light-border);
    width: 100%;
    max-width: 900px;
    padding: 2.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

header {
    text-align: center;
    border-bottom: 1px solid var(--light-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--dark-text);
    margin: 0 0 0.5rem 0;
}

h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--light-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--dark-text);
}

p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --- Chat View --- */
#chat-container {
    height: 60vh;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.user-message {
    background-color: var(--cosmic-blue);
    color: var(--pure-white);
    align-self: flex-end;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
}

.model-message {
    background-color: #f3f4f6;
    color: var(--dark-text);
    align-self: flex-start;
    border-radius: 18px 18px 18px 4px;
}

.thinking span {
    display: inline-block;
    animation: bounce 1.4s infinite;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #9ca3af;
    margin: 0 2px;
}

.thinking span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

textarea#chat-input {
    flex-grow: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--light-border);
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    resize: none;
    transition: all 0.3s ease;
    line-height: 1.5;
}

textarea#chat-input:focus {
    outline: none;
    border-color: var(--cosmic-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

/* --- Production-Grade Button System --- */
.omni-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.8rem 1.75rem;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex-shrink: 0;
}

.omni-button-primary {
    background-color: var(--cosmic-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.2);
}

.omni-button-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.3);
}

.omni-button-secondary {
    background-color: var(--pure-white);
    color: var(--cosmic-blue);
    border-color: var(--cosmic-blue);
}

.omni-button-secondary:hover:not(:disabled) {
    background-color: rgba(74, 158, 255, 0.05);
}

.omni-button-danger {
    background-color: var(--pure-white);
    color: var(--error-red);
    border-color: var(--error-red);
    width: 100%;
    margin-top: 1rem;
}

.omni-button-danger:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.05);
}

.omni-button:disabled {
    background-color: #d1d5db;
    border-color: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#confirm-blueprint-btn,
#begin-analysis-btn,
#submit-review-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem 2rem;
}

#add-files-btn {
    width: 100%;
    margin-top: 1.5rem;
}


/* --- High-Precision Blueprint Editor --- */
.blueprint-header {
    margin-bottom: 2rem;
}

#bp-fse_domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--dark-text);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.25rem;
    width: 100%;
    transition: border-color 0.3s;
    background-color: transparent;
}

#bp-fse_domain:focus {
    outline: none;
    border-bottom-color: var(--cosmic-blue);
}

#bp-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.25rem;
    width: 100%;
    resize: none;
    background-color: transparent;
    margin-top: 0.5rem;
}

#bp-description:focus {
    outline: none;
    border-color: var(--light-border);
    border-radius: 6px;
    background-color: #f9fafb;
}

.blueprint-cards-container {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.blueprint-card {
    background-color: #f9fafb;
    border: 1px solid var(--light-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--dark-text);
}

.card-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header svg {
    color: var(--cosmic-blue);
}

.task-group {
    padding-top: 1.5rem;
    border-top: 1px solid var(--light-border);
    margin-top: 1.5rem;
}

.task-group:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.task-group h5 {
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.item-tag {
    display: inline-flex;
    align-items: center;
    background-color: #e0eaf6;
    color: #3d7ac4;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.item-tag button {
    background: none;
    border: none;
    color: #9ab3d3;
    margin-left: 0.5rem;
    padding: 0;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.item-tag button:hover {
    color: var(--error-red);
}

.new-item-input {
    border: none;
    border-bottom: 2px dashed #ccc;
    background: transparent;
    padding: 0.25rem;
    font-size: 0.9rem;
    outline: none;
    width: 100px;
}

.new-item-input:focus {
    border-bottom-style: solid;
    border-bottom-color: var(--cosmic-blue);
}

.proactive-card .card-header {
    margin-bottom: 0;
}

.proactive-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--light-border);
}

.proactive-options label {
    font-weight: 500;
}

.proactive-options select,
.proactive-options input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--cosmic-blue);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- File Uploader & Status Log --- */
#file-uploader {
    margin-bottom: 1.5rem;
}

#file-list {
    margin-top: 1.5rem;
    min-height: 50px;
}

.file-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9fafb;
    border: 1px solid var(--light-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    animation: fadeIn 0.5s ease;
}

.file-count {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--dark-text);
}

.file-count svg {
    color: var(--cosmic-blue);
}

.clear-files-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    transition: color 0.2s;
}

.clear-files-btn:hover {
    color: var(--error-red);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

footer {
    margin-top: 2.5rem;
}

.log-container {
    background-color: #1e293b;
    color: #e2e8f0;
    border-radius: 15px;
    padding: 1.5rem;
    height: 300px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid #334155;
}

.log-entry.success {
    color: #4ade80;
}

.log-entry.error {
    color: #f87171;
}

.log-entry.warning {
    color: #facc15;
}

.placeholder {
    color: #64748b;
}

/* --- NEW STYLES FOR REVIEW VIEW --- */

#review-progress {
    text-align: center;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.review-card {
    background-color: #f9fafb;
    border: 1px solid var(--light-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.review-text-container {
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--pure-white);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.review-text-container pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--dark-text);
}

.review-tasks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.review-task-item {
    display: flex;
    flex-direction: column;
}

.review-task-item label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

.review-task-item select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    background-color: var(--pure-white);
}

.review-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}