:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --accent-color: #58a6ff;
    --text-primary: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: rgba(240, 246, 252, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #161b22, #0d1117);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.app-container {
    display: grid;
    grid-template-columns: 450px 1fr;
    height: 100vh;
    gap: 1px;
    background: var(--border-color);
    margin: 0 auto;
    max-width: 100%;
    transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.collapsed {
    grid-template-columns: 60px 1fr;
}

.app-container.collapsed .input-panel>*:not(header) {
    display: none;
}

.app-container.collapsed .input-panel header h1,
.app-container.collapsed .input-panel header p,
.app-container.collapsed .input-panel header .tab-group {
    display: none;
}

.app-container.collapsed .input-panel {
    padding: 1rem 0.5rem;
    align-items: center;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-reset {
    text-decoration: none;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reset:hover {
    transform: rotate(-180deg);
    background: rgba(255, 255, 255, 0.1);
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.tab-group {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.tab-group.scrollable {
    overflow-x: auto;
    max-width: 100%;
}

.tab-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-item.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

.collapse-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.app-container.collapsed .collapse-btn {
    position: static;
    transform: rotate(180deg);
}

/* Input Panel Styles */
.input-panel {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

.input-panel h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #58a6ff, #bc8cff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-download {
    background: #f30;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 51, 0, 0.3);
}

.btn-download:hover {
    background: #ff451a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 0, 0.4);
}

.btn-download:active {
    transform: translateY(0);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.form-group h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.has-data h3 {
    color: #3fb950 !important;
    /* GitHub Green */
}

.has-data h3::before {
    content: '✓ ';
    font-weight: bold;
}

.section-header h3::after {
    content: ' ▼';
    font-size: 0.7rem;
    vertical-align: middle;
    opacity: 0.5;
    transition: transform 0.3s ease;
    display: inline-block;
}

.section-collapsed .section-header h3::after {
    transform: rotate(-90deg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input,
textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

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

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(88, 166, 255, 0.1);
}

.btn-icon {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent-color);
    color: white;
}

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

.dynamic-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 123, 114, 0.1);
    color: #ff7b72;
    border: 1px solid #ff7b72;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.btn-remove:hover {
    background: #ff7b72;
    color: white;
}

/* Output Panel Styles */
.output-panel {
    padding: 2rem;
    background: radial-gradient(circle at bottom left, rgba(88, 166, 255, 0.05), transparent);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    height: 100vh;
    overflow: hidden;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    box-shadow: var(--glass-shadow);
}

.avatar-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.code-container {
    flex: 1;
    min-height: 0;
    /* Important for flex child with overflow */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.language-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

#output-code {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e6edf3;
    padding: 1.5rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    width: 100%;
    min-height: 500px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#output-code::-webkit-scrollbar {
    width: 8px;
}

#output-code::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#copy-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

#copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Visual CV Styles */
.visual-container {
    background: #fff;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border: none;
    max-width: 900px;
    margin: 2rem auto;
    color: #333;
    font-family: 'Inter', sans-serif;
    padding: 4rem !important;
    border-radius: 0;
}

.v-cv {
    padding: 0;
}

.v-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 3px solid #1a1a1a;
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.v-name {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    color: #1a1a1a;
    letter-spacing: -2px;
}

.v-title {
    font-size: 1.5rem;
    color: var(--accent-color);
    font-weight: 500;
    margin-top: 0.5rem;
}

.v-contact {
    text-align: right;
    color: #666;
    font-size: 0.9rem;
}

.v-section {
    margin-bottom: 3rem;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

.v-section-title {
    font-size: 0.9rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-color);
}

.v-item {
    margin-bottom: 2.5rem;
}

.v-item-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.v-period {
    font-weight: 400;
    color: #999;
    font-size: 0.9rem;
}

.v-desc {
    line-height: 1.8;
    color: #444;
    font-size: 1rem;
    white-space: pre-line;
}

.v-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.v-skill {
    background: #1a1a1a;
    color: #fff;
    padding: 6px 14px;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media print {
    body {
        background: white !important;
        overflow: visible !important;
    }

    .app-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
    }

    .input-panel {
        display: none !important;
    }

    .output-panel {
        padding: 0 !important;
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Print & PDF Styles */
    @media print {
        @page {
            margin: 1.5cm;
            size: A4;
        }

        body {
            background: white !important;
            color: black !important;
            overflow: visible !important;
        }

        .output-panel {
            position: static !important;
            height: auto !important;
            width: 100% !important;
            padding: 0 !important;
            background: white !important;
        }

        .input-panel,
        .header-actions,
        .code-header,
        .format-selection,
        #copy-btn,
        #generate-btn,
        .collapse-btn,
        .btn-reset,
        .output-header {
            display: none !important;
        }

        .app-container {
            display: block !important;
            background: white !important;
            grid-template-columns: 1fr !important;
        }

        #output-code {
            border: none !important;
            background: white !important;
            color: black !important;
            font-family: 'Times New Roman', serif !important;
            font-size: 11pt !important;
            line-height: 1.5 !important;
            height: auto !important;
            min-height: auto !important;
            padding: 0 !important;
            white-space: pre-wrap !important;
            width: 100% !important;
            overflow: visible !important;
        }

        .code-container {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
            backdrop-filter: none !important;
            padding: 0 !important;
        }
    }


    .output-header {
        display: none !important;
    }

    .visual-container {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Modal Disclaimer */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}