:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 16px;
    opacity: 0.95;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 24px;
}

.form-section, .preview-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.form-section {
    height: fit-content;
}

.form-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 24px;
}

.form-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-header p {
    font-size: 14px;
    opacity: 0.9;
}

.form-content {
    padding: 24px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.template-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.template-option {
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.template-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.template-option.active {
    border-color: var(--primary);
    background: var(--gray-50);
}

.template-option .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.template-option .name {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--gray-900);
    transform: scale(1.15);
}

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

label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 14px;
}

.label-with-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hint {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 400;
}

input, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.rich-textarea {
    min-height: 120px;
}

.textarea-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    padding: 6px;
    background: var(--gray-50);
    border-radius: 6px;
}

.toolbar-btn {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--gray-100);
}

button {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(0);
}

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

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-700);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.section-title {
    font-size: 16px;
    color: var(--gray-900);
    font-weight: 600;
}

.add-button {
    background: var(--success);
    font-size: 13px;
    padding: 6px 12px;
    margin: 0;
    border: none;
    cursor: pointer;
}

.dynamic-section {
    border: 1.5px solid var(--gray-200);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    position: relative;
    background: var(--gray-50);
    transition: all 0.2s;
}

.dynamic-section:hover {
    border-color: var(--gray-300);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.section-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.preview-section {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.preview-header {
    background: var(--gray-900);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-actions button {
    padding: 8px 16px;
    font-size: 13px;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--gray-100);
}

.resume-preview {
    background: #f3f4f6;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    display: flex;
    justify-content: center;
}

/* Base resume page (modern default) */
.resume-page {
    background: #ffffff;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
    width: 100%;
    max-width: 800px;
    min-height: 842px;
    padding: 24px 32px 32px;
    box-sizing: border-box;
}

.resume-root {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: #111827;
    font-size: 13px;
}

.resume-root .header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.resume-root .header h1 {
    font-size: 26px;
    margin: 0 0 4px 0;
    letter-spacing: 0.03em;
}

.resume-root .contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 11px;
    color: #4b5563;
}

.resume-section {
    margin-bottom: 18px;
}

.resume-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
}

.resume-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--accent, #2563eb), transparent);
}

.resume-summary,
.resume-languages {
    font-size: 12px;
    color: #374151;
    line-height: 1.6;
}

.item {
    margin-bottom: 10px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 2px;
}

.item-title {
    font-weight: 600;
    font-size: 12px;
    color: #111827;
}

.item-subtitle {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
}

.item-duration {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

.item-description {
    font-size: 11.5px;
    color: #374151;
    margin-top: 4px;
}

.item-description ul {
    margin: 0;
    padding-left: 18px;
}

.item-description li {
    margin: 0 0 2px 0;
}

.item-description li::marker {
    color: #2563eb;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-tag {
    border-radius: 999px;
    border: 1px solid #2563eb;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(37, 99, 235, 0.04);
}

/* ---------- TEMPLATE VARIANTS ---------- */

/* Modern (default) */
.template-modern.resume-page {
    border-left-color: #2563eb;
}

/* Classic layout */
.template-classic.resume-page {
    border-left: 0;
    border: 1px solid var(--gray-200);
    background: #ffffff;
}

.template-classic .resume-root {
    font-family: "Times New Roman", serif;
}

.template-classic .resume-root .header {
    text-align: center;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.template-classic .resume-root .header h1 {
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.template-classic .resume-root .contact {
    justify-content: center;
    font-size: 11px;
}

.template-classic .resume-section-title {
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.template-classic .resume-section-title::after {
    display: none;
}

/* Creative layout (2-column sidebar + main) */
.template-creative.resume-page {
    border-left: 0;
    border-radius: 8px;
    padding: 0;
    background: transparent;
    max-width: 900px;
}

.template-creative .wrapper {
    display: flex;
    min-height: 842px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

/* Sidebar */
.template-creative .sidebar {
    width: 32%;
    color: #ffffff;
    padding: 22mm 10mm 18mm 18mm;
    box-sizing: border-box;
    font-size: 11px;
}

.template-creative .sidebar h1 {
    font-size: 20px;
    margin: 0 0 6px 0;
    font-weight: 700;
}

.template-creative .sidebar .contact {
    font-size: 11px;
    line-height: 1.8;
    margin-bottom: 12px;
    display: block;
}

.template-creative .sidebar .section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 12px 0 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.4);
    padding-bottom: 4px;
}

.template-creative .sidebar .skills,
.template-creative .sidebar .languages {
    font-size: 11px;
    line-height: 1.6;
}

/* Main column */
.template-creative .main {
    width: 68%;
    padding: 24mm 20mm 20mm 18mm;
    box-sizing: border-box;
    font-size: 12px;
}

.template-creative .section {
    margin-bottom: 14px;
}

.template-creative .section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 6px;
}

.template-creative .summary {
    font-size: 12px;
    color: #374151;
    line-height: 1.6;
}

.template-creative .item {
    margin-bottom: 8px;
}

.template-creative .item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 2px;
}

.template-creative .item-title {
    font-weight: 600;
    font-size: 12px;
}

.template-creative .item-subtitle {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
}

.template-creative .item-duration {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

.template-creative .item-description {
    font-size: 11.5px;
    color: #374151;
}

.template-creative .item-description ul {
    margin: 0;
    padding-left: 18px;
}
