:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #3a0ca3;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Navigation */
nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav a {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

nav a:hover {
    background-color: var(--light-gray);
}

nav a.active {
    background-color: var(--primary-color);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn, button {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary, button[type="submit"] {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, button[type="submit"]:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn-outline:hover {
    color: #fff;
    background-color: var(--primary-color);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Forms */
form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    color: var(--dark-color);
    background-color: #fff;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check input[type="checkbox"] {
    width: auto;
}

input.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem;
    margin-bottom: 0;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
}

/* Alerts & Messages */
.alert, .messages li {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    list-style: none;
}

.alert-success, .messages li.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger, .messages li.error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning, .messages li.warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info, .messages li.info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.messages {
    padding: 0;
    margin: 1rem 0;
}

/* Tables */
table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--dark-color);
    border-collapse: collapse;
}

thead {
    background-color: var(--light-gray);
}

th, td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    text-align: left;
}

th {
    font-weight: 600;
}

tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Main Content */
main {
    padding: 2rem 0;
}

section {
    margin-bottom: 2rem;
}

/* Footer */
footer {
    background-color: #fff;
    border-top: 1px solid var(--light-gray);
    padding: 1rem 0;
    text-align: center;
    color: var(--gray-color);
    font-size: 0.875rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }

.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.flex {
    display: flex;
}

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

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Specific Components */
.api-key-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-primary { background-color: var(--primary-color); color: white; }
.badge-success { background-color: var(--success-color); color: white; }
.badge-warning { background-color: var(--warning-color); color: white; }
.badge-secondary { background-color: var(--gray-color); color: white; }

.score-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
}

.score-circle {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
    padding: 5px;
}

.score-1 { background-color: #ff6b6b; color: white; }
.score-2 { background-color: #ffa06b; color: white; }
.score-3 { background-color: #ffd56b; color: #212529; }
.score-4 { background-color: #c1ff6b; color: #212529; }
.score-5 { background-color: #6bff7c; color: #212529; }

/* HTMX indicator styling */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Match results highlight */
.top-match {
    background-color: rgba(76, 201, 240, 0.1) !important;
    border-left: 4px solid var(--success-color);
}

.match-rank {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Form error styling */
.errorlist {
    color: var(--warning-color);
    list-style: none;
    padding: 0;
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

/* Equal width and centered score for criteria columns in results table */
#results-table th.score-col, #results-table td.score-col {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: center;
}
#results-table .score-wrapper {
    margin-left: auto;
    margin-right: auto;
}

/* Home Page Styling */
.hero-section {
    text-align: center;
    padding: 3rem 1rem 2rem;
    background: linear-gradient(135deg, #4361ee08 0%, #4cc9f010 100%);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.hero-text {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    color: var(--gray-color);
}

.feature-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.feature-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.info-card {
    border-top: 4px solid var(--primary-color);
}

.auth-section {
    background-color: rgba(67, 97, 238, 0.03);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.section-title {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--gray-color);
    margin-bottom: 1rem;
}

.notice-text {
    background-color: rgba(76, 201, 240, 0.1);
    border-left: 3px solid var(--success-color);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-text {
        font-size: 1.1rem;
    }
    
    .feature-section {
        grid-template-columns: 1fr;
    }
}

/* Profile Page Styling */
.profile-hero {
    background: linear-gradient(145deg, rgba(67, 97, 238, 0.05) 0%, rgba(76, 201, 240, 0.1) 100%);
    border-bottom: 3px solid var(--primary-color);
}

.profile-card {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.profile-header {
    padding: 1.5rem;
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

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

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: var(--gray-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: white;
}

.step-text {
    font-size: 0.9rem;
    color: var(--gray-color);
    text-align: center;
}

.step.active .step-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* Clickable step styles */
.step-clickable {
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.step-clickable:hover {
    text-decoration: none;
}

.step-clickable:hover .step-number {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.step-clickable:hover .step-text {
    color: var(--primary-dark);
    font-weight: 600;
}

.step-connector {
    height: 2px;
    background-color: #e9ecef;
    flex: 1;
    margin: 0 10px;
    position: relative;
    top: -14px;
}

.profile-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-section:last-child {
    border-bottom: none;
    margin-bottom: 1rem;
}

.profile-section .section-title {
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
}

.field-hint {
    color: var(--gray-color);
    font-style: italic;
    margin-top: 4px;
    display: block;
}

.funding-range {
    background-color: rgba(67, 97, 238, 0.03);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .profile-steps {
        flex-direction: column;
        gap: 1rem;
    }
    
    .step-connector {
        width: 2px;
        height: 20px;
        margin: 5px 0;
    }
    
    .funding-range {
        flex-direction: column;
    }
} 