/* CloudBees Architect Web UI Styles */

:root {
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --secondary-color: #5f6368;
    --success-color: #34a853;
    --error-color: #ea4335;
    --warning-color: #fbbc04;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border-color: #dadce0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

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

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.hidden {
    display: none !important;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
}

.drop-zone p {
    margin: 0;
    color: var(--text-secondary);
}

.drop-zone .hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(26, 115, 232, 0.1);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.file-info span {
    font-weight: 500;
    color: var(--primary-color);
}

.btn-remove {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
}

.btn-remove:hover {
    color: var(--error-color);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(26, 115, 232, 0.05);
}

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

.radio-option input {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radio-option input:checked + .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: inset 0 0 0 3px var(--surface);
}

.radio-text {
    font-weight: 500;
    flex-grow: 1;
}

.radio-option .hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    background: var(--text-secondary);
    color: white;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

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

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

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

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

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

/* Progress */
.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.phase-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.phase-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.phase-item.active {
    background: rgba(26, 115, 232, 0.1);
    border-left: 3px solid var(--primary-color);
}

.phase-item.completed {
    background: rgba(52, 168, 83, 0.1);
}

.phase-item.error {
    background: rgba(234, 67, 53, 0.1);
}

.phase-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cb-logo {
    width: 20px;
    height: 20px;
    fill: var(--border-color);
    transition: fill 0.2s ease;
}

.phase-item.active .cb-logo {
    fill: var(--primary-color);
    animation: spin 1s linear infinite;
}

.phase-item.completed .cb-logo {
    fill: var(--success-color);
}

.phase-item.error .cb-logo {
    fill: var(--error-color);
}

.phase-name {
    font-weight: 500;
    min-width: 100px;
}

.phase-status {
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex-grow: 1;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-panel {
    display: none;
}

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

/* Output */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--surface);
}

.output-area {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre;
    tab-size: 2;
}

.cleanup-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(52, 168, 83, 0.1);
    border-radius: var(--radius);
    margin: 1.5rem 0;
    color: var(--success-color);
}

.cleanup-message svg {
    flex-shrink: 0;
}

/* Error */
.error-container {
    text-align: center;
    padding: 2rem;
}

.error-container svg {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-container h2 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Debug Phase Outputs */
.phase-output {
    margin-top: 1rem;
}

.phase-output-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.phase-output pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.phase-item.active .phase-icon {
    animation: spin 1s linear infinite;
}

/* Copy success feedback */
.btn.copied {
    background: var(--success-color) !important;
    border-color: var(--success-color) !important;
}

/* Token Usage */
.token-usage {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--background);
    border-radius: var(--radius);
}

.token-usage h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.token-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.token-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.token-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.token-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.token-stat.total .token-value {
    color: var(--primary-color);
}

/* Phase Timings Table */
.phase-timings {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--background);
    border-radius: var(--radius);
}

.phase-timings h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.timings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.timings-table th,
.timings-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.timings-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timings-table td {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
}

.timings-table tr:last-child td {
    border-bottom: none;
}

.timings-table .phase-name-cell {
    font-weight: 500;
    font-family: inherit;
}

.timings-table .duration-cell {
    color: var(--primary-color);
}

.timings-table .total-row {
    background: rgba(26, 115, 232, 0.05);
    font-weight: 600;
}

.timings-table .total-row td {
    border-top: 2px solid var(--border-color);
}
