/* Page Structure */
.page-wrapper {
    display: flex;
    height: 100vh;
    background: #f7fafc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 100%);
    border-right: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #d1d5db;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    gap: 0;
}

.nav-btn {
    appearance: none;
    background: transparent;
    border: none;
    border-left: 4px solid transparent;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: #f0f1f3;
    color: #374151;
}

.nav-btn.active {
    background: #fff;
    border-left-color: #0ea5a4;
    color: #0ea5a4;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: 0;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

.message {
    padding: 12px 16px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    font-weight: 500;
    position: fixed !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 999999 !important;
    max-width: 400px;
}

.message.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #0ea5a4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.progress-bar-container {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

#progressBar {
    background: linear-gradient(90deg, #0ea5a4 0%, #0d9488 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content {
    display: none;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

/* Table Wrapper */
.table-wrapper {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
}

.table tbody tr:hover {
    background: #f9fafb;
}

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

/* Buttons */
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-primary {
    background: #0ea5a4;
    border-color: #0ea5a4;
    color: #fff;
}

.btn-primary:hover {
    background: #0d9488;
    border-color: #0d9488;
}

.btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Links styled as buttons */
a.btn {
    text-decoration: none;
}

a.btn:hover {
    text-decoration: none;
}

/* Modal Dialog */
.dialog {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0;
    width: 1125px !important;
    max-width: 95vw !important;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.dialog:not([open]) {
    display: none;
    pointer-events: none;
}

#pitchModal {
    width: 1125px !important;
    max-width: 95vw !important;
}

#exportModal {
    width: 1125px !important;
    max-width: 95vw !important;
}

/* Override Basecoat's container width constraint */
@media (min-width: 40rem) {
    .dialog>div {
        max-width: 1125px !important;
    }

    #pitchModal>div {
        max-width: 1125px !important;
    }

    #exportModal>div {
        max-width: 1125px !important;
    }
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.dialog>div {
    display: flex;
    flex-direction: column;
    height: auto;
}

/* More specific selector to override Basecoat's .dialog>*>header rule */
.dialog>*>header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.dialog>*>header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    flex: 0 1 auto;
}

.dialog>*>header button {
    appearance: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    transition: color 0.2s ease;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog header button:hover {
    color: #1f2937;
}

.dialog section {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.dialog footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Confirm Dialog */
.dialog-confirm,
.dialog-confirm>div {
    width: 400px !important;
    min-width: 400px !important;
    max-width: 90vw !important;
    height: auto !important;
    max-height: fit-content !important;
}

.dialog-confirm footer {
    border-top: none;
}

/* Form */
form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: #0ea5a4;
    box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.1);
}

/* Validation Styling for Select Placeholders */
select.input:invalid {
    color: #999;
}

select.input option {
    color: #1f2937;
    /* Reverts to normal text color for options */
}

select.input option[value=""][disabled] {
    display: none;
}

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

/* Export Content */
#exportContent {
    line-height: 1.6;
}

#exportContent p {
    margin: 0 0 12px 0;
    color: #374151;
}

#exportContent strong {
    color: #1f2937;
}

#exportContent pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #d1d5db;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .dialog {
        max-width: 95vw;
        width: auto;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px 12px;
    }
}

/* Dynamic Configuration Elements */
.config-card {
    border: 1px solid #e2e8f0;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: #fff;
}

.config-card.placeholder {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
}

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

.config-fields {
    transition: all 0.3s ease;
    overflow: hidden;
}

.config-fields.hidden {
    display: none;
}

.config-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.config-name.placeholder {
    color: #64748b;
}

.badge {
    font-size: 12px;
    color: #64748b;
    background: #e2e8f0;
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.badge.light {
    background: #f1f5f9;
}

.config-field {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.field-label {
    font-size: 12px;
    color: #475569;
}

.no-config-text {
    font-size: 12px;
    color: #94a3b8;
}

.card-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #0f172a;
}

.llm-grid,
.session-limits-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: end;
}

.session-limits-grid {
    gap: 12px;
}

.input-label {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.input-label-small {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.language-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
}

.language-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 12px;
    align-items: center;
}

.action-col {
    display: flex;
    align-items: flex-end;
}

.no-data-cell {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.no-data-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.btn-danger-light {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.code-sm {
    font-size: 12px;
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

/* Export Display */
.skills-container {
    background: #fef3c7;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.skill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin: 4px 0;
    background: white;
    border-radius: 4px;
}

.score-high {
    color: #10b981;
}

.score-med {
    color: #f59e0b;
}

.score-low {
    color: #ef4444;
}

.bg-score-high {
    background: #d1fae5;
}

.bg-score-med {
    background: #fef3c7;
}

.bg-score-low {
    background: #fee2e2;
}

.message-bubble {
    padding: 8px 12px;
    margin: 6px 0;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 4px solid #0ea5a4;
}

.message-bubble.user {
    border-left-color: #10b981;
}

.message-meta {
    color: #6b7280;
    font-size: 12px;
}

.eval-result-box {
    background: #f0fdfa;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #0ea5a4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.eval-pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.6;
}

.score-overall {
    font-size: 16px;
    font-weight: bold;
}

.skills-heading {
    display: block;
    margin-top: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #6b7280;
}

.skill-badge {
    display: inline-block;
    margin-right: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.section-heading {
    display: block;
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 16px;
    color: #0f172a;
}

.section-container {
    margin-top: 24px;
    margin-bottom: 24px;
}

.section-container .section-heading {
    margin-top: 0;
    margin-bottom: 12px;
}

.message-text {
    margin: 4px 0;
}

.skill-name {
    font-weight: 500;
    color: #1f2937;
}

.skill-score {
    font-size: 18px;
    font-weight: bold;
}