/* PRD Generator Agent - Styles */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #6b7280;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #f9fafb;
    --bg-white: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main */
.main {
    flex: 1;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #e5e7eb;
    padding: 0.4rem;
    border-radius: var(--radius-lg);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Sections */
.section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.select,
.textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.textarea {
    resize: vertical;
    min-height: 120px;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

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

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

.btn-primary:disabled {
    background: var(--secondary);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* Progress */
.progress-container {
    margin: 1.5rem 0;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 1.25rem;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-step.active .step-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.progress-step.active .step-label {
    color: var(--primary);
}

.progress-step.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.progress-step.completed .step-label {
    color: var(--success);
}

.status-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

/* Clarification Questions */
.questions-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.question-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
}

.question-card h4 {
    font-size: 0.875rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.question-card p {
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.question-card .options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-card .option-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.question-card .option-btn:hover {
    border-color: var(--primary);
}

.question-card .option-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.question-card textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
}

/* Result Section */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.prd-content {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.7;
}

.prd-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.prd-content h2 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.prd-content h3 {
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.prd-content p {
    margin-bottom: 0.75rem;
}

.prd-content ul,
.prd-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.prd-content li {
    margin-bottom: 0.25rem;
}

.prd-content code {
    background: #e5e7eb;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
}

.prd-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.prd-content pre code {
    background: none;
    padding: 0;
}

.prd-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}

.prd-content th,
.prd-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.prd-content th {
    background: var(--bg-white);
    font-weight: 600;
}

.prd-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: var(--text-secondary);
}

.prd-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* Error */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* Tech Spec Trigger */
.tech-spec-trigger {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg);
}

.tech-spec-trigger h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 0.75rem;
}

.tech-spec-trigger p {
    color: #0c4a6e;
    margin-bottom: 0.5rem;
}

.tech-spec-trigger ul {
    margin: 0.75rem 0 1rem 1.25rem;
    color: #0c4a6e;
}

.tech-spec-trigger li {
    margin-bottom: 0.25rem;
}

/* Upload Area */
.upload-container {
    margin-bottom: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg);
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f5f3ff;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: #ede9fe;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.8125rem;
    color: var(--secondary);
}

.upload-mini {
    padding: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upload-mini .icon {
    font-size: 1.2rem;
}

.upload-requirement-wrapper {
    margin-top: 1rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 0.75rem 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

.file-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.file-status .file-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #9d174d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-remove {
    background: #fce7f3;
    color: #9d174d;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.btn-remove:hover {
    background: #fbcfe8;
}

.uploaded-file-info {
    padding: 1rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.file-name {
    font-weight: 600;
    color: #166534;
    margin-bottom: 0.5rem;
}

.file-preview {
    font-size: 0.8125rem;
    color: #15803d;
    background: #dcfce7;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-family: monospace;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-bottom: 0.75rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Tech Spec Content */
.tech-spec-content {
    border-left: 4px solid #0ea5e9;
}

/* Style Preferences */
.style-preferences {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.style-preferences h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.pref-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pref-row:last-child {
    margin-bottom: 0;
}

.pref-row .form-group {
    margin-bottom: 0;
}

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

@media (max-width: 640px) {
    .pref-row {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .progress-steps {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .step-label {
        display: none;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        width: 100%;
    }
}

/* Loading Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 0.75rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 1rem;
}

/* Sub-progress bar (granular) */
.sub-progress-container {
    margin: 1.5rem 0;
    background: #f1f5f9;
    border-radius: 10px;
    height: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.sub-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5 0%, #818cf8 100%);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 0.5rem;
    font-weight: 500;
}