/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.login-card h1 {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 30px;
    color: #666;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.version {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 20px;
}

/* Main layout */
.main-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    white-space: nowrap;
}

.logo a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.logo a:hover {
    color: #764ba2;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    padding: 0.625rem 1.25rem;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9375rem;
}

.nav-link:hover {
    background-color: #f5f5f5;
    color: #333;
}

.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.username {
    font-weight: 500;
    color: #333;
}

.user-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.user-info .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.user-info .btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 140px);
}

.main-footer {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Messages */
.messages {
    margin-bottom: 1.5rem;
}

/* Tabs */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 2rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 1rem;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-link:hover {
    color: #333;
    background-color: #f8f9fa;
}

.tab-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Workspace */
.workspace-container {
    max-width: 1200px;
}

.workspace-container h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.375rem;
}

.subtitle {
    font-size: 0.9375rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Workflow Steps */
.workflow-steps {
    margin-bottom: 1.5rem;
}

.workflow-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.workflow-step:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.step-content .form-control {
    margin-bottom: 0.75rem;
}

/* Prompt and Testset Cards */
.prompt-card, .testset-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-card:hover, .testset-card:hover {
    border-color: #667eea;
    background: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.prompt-card.selected, .testset-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.prompt-card h4, .testset-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.prompt-card .badge, .testset-card .badge {
    margin-top: 0.5rem;
}

/* Prompt Rows (thin compact display) */
.prompt-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-row:hover {
    border-color: #667eea;
    background: white;
}

.prompt-row.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.15);
}

.prompt-row .prompt-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
    color: #333;
}

.prompt-row .prompt-model {
    font-size: 0.8125rem;
    color: #6b7280;
}

.prompt-row .badge {
    font-size: 0.75rem;
}

/* Selected Info */
.selected-info {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.selected-info p {
    margin: 0.25rem 0;
    color: #333;
    font-size: 0.9375rem;
}

.selected-info strong {
    color: #667eea;
}

/* Publish Options */
.publish-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
}

/* Evaluation Config */
.eval-config-toggle {
    margin: 0.75rem 0;
}

.eval-config-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    animation: slideDown 0.3s ease;
}

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

/* Searchable Select */
.searchable-select-wrapper {
    width: 100%;
}

.searchable-select-search {
    font-size: 0.9375rem;
}

.searchable-select-search:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Quick Actions */
.quick-actions {
    margin-top: 1rem;
}

/* Recent Activity */
.recent-activity {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.recent-activity h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1.5rem;
}

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

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.activity-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.activity-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-icon.status-completed {
    background-color: #28a745;
}

.activity-icon.status-running {
    background-color: #007bff;
}

.activity-icon.status-failed {
    background-color: #dc3545;
}

.activity-icon.status-draft {
    background-color: #6c757d;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.activity-meta {
    font-size: 0.875rem;
    color: #666;
    margin: 0.25rem 0 0 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        padding: 1rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .workflow-step {
        flex-direction: column;
    }

    .step-number {
        align-self: flex-start;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .main-nav {
        flex-wrap: wrap;
        width: 100%;
    }

    .nav-link {
        flex: 1;
        text-align: center;
        min-width: 80px;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions .btn-primary,
    .page-actions .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .workflow-step {
        padding: 1rem;
    }

    .publish-options {
        flex-direction: column;
    }

    .publish-options button {
        width: 100%;
    }
}

/* Review Carousel Modal */
.carousel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 10px;
}

.carousel-modal.hidden {
    display: none;
}

.carousel-container {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1600px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.carousel-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.carousel-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.carousel-title span {
    font-size: 13px;
    opacity: 0.9;
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    line-height: 1;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.carousel-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.carousel-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-nav-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateX(0) translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.carousel-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.carousel-nav-btn span {
    font-size: 18px;
}

.carousel-counter {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.carousel-counter span {
    color: #667eea;
    font-weight: 600;
}

.carousel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    background: #ffffff;
    min-height: 0;
}

.carousel-output-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.carousel-output-card.failed {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

.carousel-output-card.passed {
    border-left: 4px solid #10b981;
    background: #ecfdf5;
}

.carousel-footer {
    padding: 12px 20px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.feedback-form {
    margin-bottom: 10px;
}

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

.feedback-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.feedback-inputs select,
.feedback-inputs input {
    flex: 1;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.feedback-inputs select:focus,
.feedback-inputs input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.carousel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.carousel-actions .btn-primary,
.carousel-actions .btn-secondary {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    width: auto;
}

/* Keyboard hint - hidden to save space */
.carousel-navigation::after {
    display: none;
}

/* Responsive carousel */
@media (max-width: 768px) {
    .carousel-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .carousel-header {
        border-radius: 0;
        padding: 16px;
    }

    .carousel-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .carousel-nav-btn {
        width: 100%;
        justify-content: center;
    }

    .feedback-inputs {
        flex-direction: column;
    }

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

    .carousel-actions .btn-primary,
    .carousel-actions .btn-secondary {
        width: 100%;
    }
}
