:root {
    --primary-color: #00c091;
    /* Enhancv Green */
    --text-dark: #1f2329;
    --text-muted: #6b7280;
    --bg-light: #f9fbfd;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --status-success: #22c55e;
    --status-warning: #eab308;
    --status-error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout */
.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
    position: relative;
    align-items: flex-start;
    /* Important for sticky sidebar */
}

/* Sticky Sidebar */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Score Circle */
/* Score Gauge (Semi-Circle) */
.score-container {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.score-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.score-gauge {
    position: relative;
    width: 160px;
    height: 80px;
    margin: 0 auto;
    overflow: hidden;
    /* Clips the bottom half */
}

/* Base Grey Track + Colored Fill via Conic Gradient */
.gauge-arc {
    width: 160px;
    height: 160px;
    /* Full circle, bottom clipped */
    border-radius: 50%;
    /* Gradient injected inline for dynamic values */
    transition: background 0.5s ease;
}

/* White Center to make it a donut/arc */
.gauge-center {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 136px;
    height: 136px;
    background: #fff;
    border-radius: 50%;
    z-index: 1;
}

.score-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    line-height: 1;
    z-index: 2;
    /* Above the mask */
}

.score-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-dark);
}

.score-max {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.issues-count {
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.issues-count span {
    color: var(--status-warning);
    /* Or dynamic */
}

/* Sidebar Navigation */
.nav-group {
    margin-bottom: 1rem;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.nav-header:hover {
    background-color: #f3f4f6;
}

.nav-header.active {
    background-color: #ecfdf5;
    /* Light green */
    color: var(--primary-color);
}

.nav-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-score {
    font-size: 0.85rem;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 12px;
    color: var(--text-muted);
}

.nav-header.active .group-score {
    background: var(--primary-color);
    color: white;
}

.nav-items {
    padding-left: 1rem;
    margin-top: 0.5rem;
    display: block;
    /* Can be toggled */
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
}

.nav-item:hover {
    color: var(--text-dark);
    background-color: #f3f4f6;
}

.nav-item.active {
    background-color: #e6fffa;
    color: var(--primary-color);
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
}

.status-success {
    background-color: var(--status-success);
}

.status-warning {
    background-color: var(--status-warning);
}

.status-error {
    background-color: var(--status-error);
}

.item-badge {
    margin-left: auto;
    font-size: 0.75rem;
    background: var(--status-error);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.content-section {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    scroll-margin-top: 2rem;
    /* Buffer for scrolling */
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title .icon {
    color: var(--primary-color);
}

/* Cards / Accordions within Sections */
.analysis-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.card-header:hover {
    background: #f9fafb;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
}

.card-body {
    padding: 0 1.5rem;
    /* Remove vertical padding when closed */
    border-top: 1px solid transparent;
    background: #f9fbfd;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-body.open {
    padding: 1.5rem;
    border-top-color: var(--border-color);
    max-height: 5000px;
    /* Increased to accommodate long optimization lists */
    opacity: 1;
}

.card-details {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* Generic Placeholders */
.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.progress-bar-bg {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    /* JS can animate this */
    transition: width 0.5s ease;
}

/* Tag/Badge Styles for specifics */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag-warning {
    background: #fef3c7;
    color: #92400e;
}

.tag-success {
    background: #d1fae5;
    color: #065f46;
}

/* Prompt Configuration Area (Internal) */
#prompt-config {
    margin-top: 4rem;
    border: 2px dashed #ccc;
    padding: 2rem;
    background: #f0f0f0;
}

#prompt-config h2 {
    color: #555;
    margin-bottom: 1rem;
}

.prompt-group {
    margin-bottom: 1.5rem;
}

.prompt-group h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    color: #666;
}

/* Header & Navigation */
.main-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.brand-icon {
    font-size: 1.5rem;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.btn-logout {
    color: var(--status-error);
}

/* Footer */
.main-footer {
    margin-top: 4rem;
    padding: 1rem 0;
    background: #000000;
    text-align: center;
    color: #ffffff;
    font-size: 0.85rem;
}

.item-badge {
    margin-left: auto;
    font-size: 0.75rem;
    background: var(--status-error);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Login Page Styles */
.login-page {
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.brand-icon-large {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 192, 145, 0.1);
}

.btn-block {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-block:hover {
    filter: brightness(110%);
}

.alert {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: left;
}

.alert-error {
    background: #fef2f2;
    color: var(--status-error);
    border: 1px solid #fecaca;
}

/* Upload Page Styles */
.upload-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    /* Adjust for header/footer */
    padding-bottom: 2rem;
}

.upload-card {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 3rem 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    background: #f9fafb;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: #ecfdf5;
}

.drop-zone input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.btn {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    margin-top: 1.5rem;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: background 0.2s;
}

.btn:hover {
    filter: brightness(110%);
}

.error {
    color: #ef4444;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.loader {
    display: none;
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* Job Description Input */
.jd-input-group {
    margin-top: 2rem;
    text-align: left;
    position: relative;
}

.jd-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.jd-textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s;
    background: #f9fafb;
    color: var(--text-dark);
}

.jd-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.jd-textarea::placeholder {
    color: #9ca3af;
    font-weight: 400;
}