:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --resume-bg: #ffffff;
    --resume-text: #1e293b;
    --resume-accent: #2563eb;
    --font-ui: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.15), transparent 25%);
    min-height: 100vh;
    overflow: hidden;
}

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

/* ================== Editor Panel ================== */
.editor-panel {
    width: 40%;
    min-width: 400px;
    max-width: 500px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.editor-header {
    padding: 30px 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.editor-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.editor-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

#resume-form {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Custom Scrollbar for Editor */
#resume-form::-webkit-scrollbar {
    width: 6px;
}
#resume-form::-webkit-scrollbar-track {
    background: transparent;
}
#resume-form::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.form-section {
    margin-bottom: 32px;
}

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

.form-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.input-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.input-row {
    display: flex;
    gap: 16px;
}
.input-row .input-group {
    flex: 1;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input, textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea {
    resize: vertical;
}

.btn-icon {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s;
}
.btn-icon:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.dynamic-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    position: relative;
    transition: all 0.3s ease;
    animation: slideIn 0.3s forwards;
}

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

.remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    color: var(--danger-color);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.6;
}
.remove-btn:hover {
    opacity: 1;
}

.editor-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.9);
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
}

/* ================== Preview Panel ================== */
.preview-panel {
    flex: 1;
    background: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
    overflow-y: auto;
}

.resume-wrapper {
    background: var(--resume-bg);
    width: 21cm;
    min-height: 29.7cm; /* A4 aspect ratio */
    padding: 40px 50px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    color: var(--resume-text);
    font-family: 'Inter', sans-serif;
    transform-origin: top center;
    transition: transform 0.3s ease;
}

/* Print Specifics for Resume Preview content */
.resume-header {
    border-bottom: 2px solid var(--resume-accent);
    padding-bottom: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.resume-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--resume-text);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.resume-header h2 {
    font-size: 18px;
    font-weight: 400;
    color: var(--resume-accent);
    margin-bottom: 12px;
}

.contact-info {
    font-size: 13px;
    color: #475569;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.separator {
    color: #94a3b8;
}

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

.section-title {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--resume-accent);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

#preview-summary {
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    text-align: justify;
}

.preview-item {
    margin-bottom: 16px;
}
.preview-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.preview-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--resume-text);
}
.preview-item-date {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}
.preview-item-subtitle {
    font-size: 14px;
    font-style: italic;
    color: #475569;
    margin-bottom: 6px;
}
.preview-item-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    margin-left: 12px;
}
.preview-item-desc li {
    margin-bottom: 4px;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-tag {
    background: #f1f5f9;
    color: #334155;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}


/* Responsive mapping */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        overflow: auto;
    }
    .editor-panel {
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    body {
        overflow: auto;
    }
    #resume-form {
        overflow: visible;
    }
    .preview-panel {
        overflow: visible;
        padding: 20px;
    }
    .resume-wrapper {
        width: 100%;
        max-width: 21cm;
        min-height: auto;
    }
}

/* Print Settings */
@media print {
    body * {
        visibility: hidden;
    }
    body {
        background: white;
    }
    .preview-panel, .resume-wrapper, .resume-wrapper * {
        visibility: visible;
    }
    .preview-panel {
        position: absolute;
        left: 0;
        top: 0;
        padding: 0;
        background: transparent;
    }
    .resume-wrapper {
        box-shadow: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }
}
