/* Job Description Formatter - Styles */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

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

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tab-content.hidden {
    display: none;
}

.tab-content h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.tab-content > p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Textarea */
textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Options */
.options, .enhancement-options {
    margin: 1rem 0;
}

.options label, .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

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

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

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

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

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

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

/* Output Section */
.output-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.output-actions {
    display: flex;
    gap: 0.5rem;
}

.output-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 600px;
}

.output-container .placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
}

/* Formatted Output */
.formatted-output {
    line-height: 1.8;
}

.formatted-output h4 {
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    text-transform: capitalize;
}

.formatted-output h4:first-child {
    margin-top: 0;
}

.formatted-output ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.formatted-output li {
    margin-bottom: 0.25rem;
}

.formatted-output p {
    margin-bottom: 1rem;
}

/* Analysis Output */
.analysis-output {
    line-height: 1.8;
}

.analysis-output .score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin: 1rem 0;
}

.analysis-output .score-label {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.analysis-output .section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.analysis-output .section h5 {
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.analysis-output .section ul {
    margin-left: 1.25rem;
}

.analysis-output .section li {
    margin-bottom: 0.5rem;
}

/* Meta Info */
.meta-info {
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.meta-info.hidden {
    display: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.spinner-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Error/Success Messages */
.message {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.message.error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.message.success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* JSON Output */
.json-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.btn-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-toggle:hover {
    background: var(--border);
    color: var(--text);
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* HTML View Content */
.job-description-html {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    line-height: 1.8;
}

.job-description-html h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.job-description-html h3:first-child {
    margin-top: 0;
}

.job-description-html p {
    margin-bottom: 0.75rem;
}

.job-description-html ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.job-description-html li {
    margin-bottom: 0.25rem;
}

.job-description-html strong {
    color: var(--text);
    font-weight: 600;
}

/* Job Description Structure: ul with h4 inside as first child */
.job-description-html ul {
    margin-left: 0;
    margin-bottom: 1.5rem;
    padding-left: 0;
    list-style: none;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.job-description-html ul:last-of-type {
    margin-bottom: 0;
}

/* h4 as first child inside ul */
.job-description-html ul > h4 {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 1rem 0.5rem 1rem;
    margin: 0;
    border-bottom: 2px solid var(--primary);
}

/* li elements after h4 */
.job-description-html ul li {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.job-description-html ul li:last-child {
    border-bottom: none;
}

.job-description-html ul li p {
    margin: 0;
    line-height: 1.6;
}

/* Job Meta (Location | Employment Type | etc.) */
.job-description-html .job-meta {
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Job Details Section */
.job-description-html .job-details,
.job-description-html .job-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
}

@media (max-width: 600px) {
    .job-description-html .job-details,
    .job-description-html .job-details-grid {
        grid-template-columns: 1fr;
    }
}

.job-description-html .job-details p,
.job-description-html .job-details-grid p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Detail Items for Job Details Grid */
.job-description-html .detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.job-description-html .detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.job-description-html .detail-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

/* Skills Tags / Nice to Have */
.job-description-html .skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.job-description-html .skill-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Highlighted Points and Sub-points */
.job-description-html .main-list {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.job-description-html .highlight-point {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.job-description-html .sub-list {
    list-style: disc;
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.job-description-html .sub-point {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
}

.job-description-html .sub-point::marker {
    color: var(--primary);
}

/* Text View */
.text-view pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Utility Classes */
.hidden {
    display: none !important;
}
