:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-app: #f1f5f9;
    --bg-editor: #ffffff;
    --bg-preview: #cbd5e1;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-app);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Editor Pane */
.editor-pane {
    width: 500px;
    background: var(--bg-editor);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 4px 0 20px rgba(0,0,0,0.05);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo i {
    width: 28px;
    height: 28px;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.editor-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.editor-scroll::-webkit-scrollbar {
    width: 6px;
}

.editor-scroll::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}

.form-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.form-section:focus-within {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.section-header i {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.section-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    flex: 1;
    color: #0f172a;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.add-btn {
    background: #f1f5f9;
    border: none;
    color: var(--primary);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn:hover {
    background: var(--primary);
    color: white;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input, textarea {
    padding: 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    color: #334155;
    background: #fcfcfd;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dynamic-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed var(--border);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

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

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.item-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.remove-item {
    background: #fee2e2;
    border: none;
    color: #ef4444;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-item:hover {
    background: #ef4444;
    color: white;
}

/* Preview Pane */
.preview-pane {
    flex: 1;
    background: var(--bg-preview);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-toolbar {
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 5;
}

.template-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.template-selector span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.template-options {
    display: flex;
    background: #f1f5f9;
    padding: 0.3rem;
    border-radius: 12px;
    gap: 0.3rem;
}

.template-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.template-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-container {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 1.5rem;
    display: flex;
    justify-content: center;
    scrollbar-width: thin;
}

.resume-sheet {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm 20mm;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

/* Template Specifics */

/* SHARED PREVIEW COMPONENTS */
.p-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.p-contact span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.p-contact i {
    width: 14px;
    height: 14px;
}

.p-item {
    margin-bottom: 1.25rem;
}

.p-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.15rem;
}

.p-title {
    font-weight: 700;
    color: #1e293b;
}

.p-subtitle {
    font-weight: 500;
    color: #475569;
}

.p-date {
    font-size: 0.85rem;
    color: #64748b;
}

.p-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 0.35rem;
    white-space: pre-line;
}

.p-skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.p-skill-tag {
    background: #f1f5f9;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
}

/* MODERN TEMPLATE */
.modern {
    color: #334155;
}

.modern h1 {
    font-size: 2.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.modern .p-job-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 1rem;
}

.modern .preview-header {
    border-bottom: 3px solid #f1f5f9;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.modern .preview-section {
    margin-bottom: 2rem;
}

.modern .preview-section h2 {
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modern .preview-section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

/* CLASSIC TEMPLATE */
.classic {
    font-family: 'Georgia', serif;
    color: #111;
}

.classic .preview-header {
    text-align: center;
    border-bottom: 1px solid #111;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.classic h1 {
    font-size: 2.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.classic .p-contact {
    justify-content: center;
}

.classic .preview-section h2 {
    font-size: 1.1rem;
    border-bottom: 1px solid #111;
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    font-weight: bold;
}

.classic .p-title {
    color: #000;
}

.classic .p-skill-tag {
    background: none;
    padding: 0;
    border-radius: 0;
}

.classic .p-skill-tag::after {
    content: ' \2022 ';
    margin-left: 0.5rem;
}

.classic .p-skill-tag:last-child::after {
    content: '';
}

/* MINIMAL TEMPLATE */
.minimal {
    color: #444;
}

.minimal .preview-header {
    margin-bottom: 3rem;
}

.minimal h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.minimal .p-job-title {
    font-size: 1.1rem;
    color: #888;
}

.minimal .preview-section {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.minimal .preview-section h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #999;
    padding-top: 0.25rem;
}

.minimal .p-item {
    margin-bottom: 1.5rem;
}

/* Print Overrides */
@media print {
    body {
        background: white;
        overflow: visible;
    }
    .app-container {
        display: block;
        height: auto;
    }
    .editor-pane, .preview-toolbar {
        display: none !important;
    }
    .preview-pane {
        background: white;
        overflow: visible;
    }
    .preview-container {
        padding: 0;
        overflow: visible;
    }
    .resume-sheet {
        box-shadow: none;
        margin: 0;
        width: 100%;
        padding: 10mm;
    }
}
