:root {
    /* App Theme Colors - Dark Ocean Blue */
    --app-bg: #0B192C;
    --app-surface: #1A365D;
    --app-surface-light: #2C4B7A;
    --app-primary: #00B4D8;
    --app-text: #E2E8F0;
    --app-text-muted: #94A3B8;
    --app-border: #2D3748;

    /* CV Base Colors */
    --cv-left-bg: #272E34;
    --cv-right-bg: #F5F6F8;
    --cv-text-light: #FFFFFF;
    --cv-text-dark: #333333;
    --cv-text-muted: #666666;
    
    /* Default Accent Color - dynamically overridden by JS */
    --cv-accent: #D4AF37; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--app-bg);
    color: var(--app-text);
    overflow: hidden; /* App container handles scroll */
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 400px;
    background-color: var(--app-surface);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--app-border);
    box-shadow: 4px 0 15px rgba(0,0,0,0.3);
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--app-border);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: var(--app-primary);
}

.controls-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Scrollbar for sidebar */
.controls-container::-webkit-scrollbar {
    width: 6px;
}
.controls-container::-webkit-scrollbar-track {
    background: transparent;
}
.controls-container::-webkit-scrollbar-thumb {
    background: var(--app-surface-light);
    border-radius: 4px;
}

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

.control-section h2 {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--app-text-muted);
    margin-bottom: 6px;
}

.input-group input, 
.input-group textarea {
    width: 100%;
    background-color: var(--app-bg);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.input-group input:focus, 
.input-group textarea:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px rgba(0, 180, 216, 0.2);
}

/* Dynamic Lists */
.dynamic-item {
    background-color: var(--app-bg);
    border: 1px solid var(--app-border);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    position: relative;
}

.dynamic-item .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #E74C3C;
    cursor: pointer;
    font-size: 0.9rem;
}

.add-btn {
    background-color: var(--app-surface-light);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* Color Picker */
.color-picker-group {
    margin-bottom: 20px;
}

.color-options {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

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

.color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
    transform: scale(1.1);
}

/* Footer & Buttons */
.sidebar-footer {
    padding: 20px 24px;
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--app-border);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, #00B4D8, #0077B6);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 180, 216, 0.4);
}

/* Preview Area */
.preview-area {
    flex: 1;
    background-color: #04101A; /* Deeper dark for background behind paper */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
    overflow-y: auto;
}

/* Custom Scrollbar for preview */
.preview-area::-webkit-scrollbar {
    width: 8px;
}
.preview-area::-webkit-scrollbar-track {
    background: var(--app-bg);
}
.preview-area::-webkit-scrollbar-thumb {
    background: var(--app-surface);
    border-radius: 4px;
}

.preview-wrapper {
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform-origin: top center;
    /* Adding some margin bottom so it doesn't stick to edge when scrolling */
    margin-bottom: 40px;
}


/* ========================================= */
/* CV DOCUMENT STYLES (A4 Format)            */
/* ========================================= */

.cv-document {
    width: 210mm;
    height: 297mm;
    background-color: var(--cv-right-bg);
    display: flex;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    color: var(--cv-text-dark);
}

/* Background Graphics matching Image */
.bg-graphic {
    position: absolute;
    z-index: 0;
}

.bg-top-right {
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #E5E7EB, #FFFFFF);
    transform: rotate(45deg);
}

.bg-bottom-right {
    bottom: -150px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #E5E7EB, #F9FAFB);
    transform: rotate(45deg);
    opacity: 0.7;
}

.bg-bottom-left {
    bottom: -100px;
    left: -100px;
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #2A323A, #1A1F24);
    transform: rotate(45deg);
    z-index: 2; /* Over left column */
}

/* Left Column */
.cv-left {
    width: 35%;
    background-color: var(--cv-left-bg);
    color: var(--cv-text-light);
    position: relative;
    z-index: 1;
    padding-bottom: 40px;
}

/* Profile Image */
.profile-img-container {
    padding: 40px 0 20px;
    display: flex;
    justify-content: center;
}

.profile-img-container img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #3A424A;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Right Column */
.cv-right {
    width: 65%;
    padding: 50px 40px 40px 40px;
    position: relative;
    z-index: 1;
}

/* Sections */
.cv-section {
    margin-bottom: 25px;
    position: relative;
}

.section-left {
    padding: 0 30px;
}

/* Section Titles with Accent Backgrounds */
.section-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 20px;
    padding: 8px 15px;
    background-color: var(--cv-accent);
    color: #111;
    position: relative;
    display: inline-block;
    text-transform: uppercase;
}

/* Left Titles shape */
.left-title {
    width: 120%; /* Extend outside */
    margin-left: -30px; /* Pull left */
    padding-left: 30px;
    border-radius: 0 15px 15px 0;
}

/* Right Titles shape */
.right-title {
    width: calc(100% + 40px); /* Extend to right edge */
    background-color: var(--cv-accent);
    color: #222;
    padding-left: 20px;
    border-radius: 15px 0 0 15px;
    margin-left: -5px;
}

/* Left Column Content */
.info-block {
    margin-bottom: 15px;
}

.info-block h4 {
    font-size: 12px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.info-block p {
    font-size: 11px;
    color: #B0B5BA;
    line-height: 1.4;
}

.contact-list {
    list-style: none;
}

.contact-list li {
    font-size: 11px;
    color: #B0B5BA;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.contact-list i {
    color: var(--cv-accent);
    font-size: 12px;
    margin-top: 2px;
    width: 14px;
    text-align: center;
}

.social-text {
    font-size: 11px;
    color: #B0B5BA;
}

/* Right Column Content */
.header-section {
    margin-bottom: 40px;
}

.header-section h1 {
    font-size: 38px;
    font-weight: 700;
    color: #272E34;
    letter-spacing: 1px;
    line-height: 1.1;
    text-transform: uppercase;
}

.header-section h2 {
    font-size: 20px;
    font-weight: 400;
    color: #555;
    font-style: italic;
    margin-top: 5px;
}

.about-text {
    font-size: 12px;
    color: #444;
    line-height: 1.6;
    text-align: justify;
}

.cv-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cv-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.cv-item-left {
    flex: 1;
    padding-right: 15px;
}

.cv-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.cv-item-subtitle {
    font-size: 12px;
    color: #666;
}

.cv-item-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--cv-accent);
    white-space: nowrap;
}

.cv-item-desc {
    margin-top: 5px;
    font-size: 11px;
    color: #555;
    line-height: 1.5;
    padding-left: 15px;
}

.cv-item-desc li {
    margin-bottom: 3px;
}

.skills-list {
    padding-left: 20px;
}

.skills-list li {
    font-size: 12px;
    color: #444;
    line-height: 1.8;
    position: relative;
}

/* Custom Bullet points for skills */
.skills-list li::marker {
    color: var(--cv-accent);
}

/* Responsive adjustment for the preview on smaller screens */
@media (max-width: 1400px) {
    .preview-wrapper {
        transform: scale(0.8);
    }
}

@media (max-width: 1100px) {
    .preview-wrapper {
        transform: scale(0.6);
    }
}

@media (max-width: 800px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 50vh;
    }
    
    .preview-area {
        height: 50vh;
    }
    
    .preview-wrapper {
        transform: scale(0.4);
    }
}
