:root {
    --teal: #3ea39f;
    --teal-dark: #2e8f8c;
    --teal-soft: #e4f4f2;
    --gold: #efc55f;
    --gold-soft: #faedd0;
    --paper: #fffdf9;
    --stone: #e0d7cb;
    --stone-soft: #f2ede6;
    --ink: #665d56;
    --muted: #8f8781;
    --bg: linear-gradient(135deg, #f5fbfb 0%, #fff9ef 45%, #eef4f7 100%);
    --shadow: 0 20px 55px rgba(46, 76, 85, 0.14);
}

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

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: #22353f;
    font-family: "Cairo", sans-serif;
}

.shell-header {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    padding: 28px 22px 24px;
    background:
        linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%),
        linear-gradient(135deg, #44aaa5, #2f8c87);
    color: #fff;
    box-shadow: 0 12px 28px rgba(45, 91, 95, 0.18);
}

.shell-header__accent {
    position: absolute;
    inset: auto auto -46px -36px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
}

.shell-header__copy {
    position: relative;
    max-width: 1300px;
    margin: 0 auto;
}

.shell-header__content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
}

.shell-header__copy {
    flex: 1;
    max-width: none;
    margin: 0;
}

.shell-header__logo-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 108px;
    height: 108px;
    border-radius: 28px;
    background: rgb(255, 255, 255);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
}

.shell-header__logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(21, 58, 62, 0.18));
}

.shell-header__eyebrow {
    margin-bottom: 5px;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.shell-header h1 {
    font-size: clamp(1.4rem, 2vw, 2rem);
    font-weight: 800;
}

.shell-header p:last-child {
    max-width: 760px;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.94);
}

@media (max-width: 720px) {
    .shell-header__content {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .shell-header__logo-wrap {
        width: 88px;
        height: 88px;
        border-radius: 22px;
    }

    .shell-header__logo {
        width: 60px;
        height: 60px;
    }
}

.workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 22px;
}

.editor-panel,
.preview-panel {
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.editor-panel {
    flex: 1 1 430px;
    min-height: 0;
    height: 100%;
    padding: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    overflow-y: auto;
}

.panel-intro {
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid rgba(62, 163, 159, 0.12);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(62, 163, 159, 0.11), rgba(239, 197, 95, 0.08));
}

.panel-intro h2 {
    margin-bottom: 6px;
    color: var(--teal-dark);
    font-size: 1.15rem;
}

.panel-intro p {
    color: #5c747a;
    font-size: 0.94rem;
}

.form-block + .form-block {
    margin-top: 22px;
}

.form-block.is-hidden,
.experience-preview-block.is-hidden {
    display: none;
}

.form-block h3 {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(62, 163, 159, 0.16);
    color: var(--teal-dark);
    font-size: 1rem;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.experience-form-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.experience-row {
    margin: 0;
}

.experience-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 14px;
}

.field-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.field-group-v {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-grid--single {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.form-grid--three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.mt-10 {
    margin-top: 24px;
}

.field-group.field--wide {
    grid-column: 1 / -1;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.field span {
    color: #475569;
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 2px;
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid rgba(128, 148, 156, 0.3);
    border-radius: 14px;
    background: #fff;
    color: #1f3238;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select {
    appearance: none;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, #6d8d92 50%),
        linear-gradient(135deg, #6d8d92 50%, transparent 50%);
    background-position:
        calc(14px) calc(50% - 1px),
        calc(8px) calc(50% - 1px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(62, 163, 159, 0.15);
}

.field input::placeholder {
    color: #97a3a9;
}

.field--file input {
    padding: 7px 8px;
    background: linear-gradient(180deg, #fff, #fbfcfd);
    color: #52656d;
    cursor: pointer;
}

.field--file input::file-selector-button {
    margin-inline-end: 10px;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--teal-soft), #d2ece9);
    color: var(--teal-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.skills-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.skills-picker label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(62, 163, 159, 0.16);
    border-radius: 16px;
    background: #fff;
    color: #465d66;
    font-size: 0.93rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.skills-picker label:hover {
    transform: translateY(-1px);
    border-color: rgba(62, 163, 159, 0.35);
    box-shadow: 0 10px 22px rgba(62, 163, 159, 0.08);
}

.skills-picker input {
    margin-top: 4px;
    accent-color: var(--teal);
}

.skill-option {
    justify-content: space-between;
    min-height: 74px;
}

.skill-option input {
    flex: 0 0 auto;
    margin-top: 2px;
}

.skill-option__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    text-align: right;
}

.skill-option__ar {
    color: #4a6169;
    font-size: 0.93rem;
    font-weight: 800;
    line-height: 1.35;
}

.skill-option__en {
    color: #8a969c;
    direction: ltr;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
}

.experience-row {
    position: relative;
    padding-inline-end: 45px;
    margin-bottom: 12px;
}

.experience-row.is-hidden {
    display: none;
}

.remove-experience-row {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: #fff0f0;
    color: #e63946;
    border: 1px solid rgba(230, 57, 70, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.remove-experience-row:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.secondary-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gold-soft);
    color: #856404;
    border: 1px solid rgba(239, 197, 95, 0.4);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: var(--gold);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 197, 95, 0.25);
}

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

.experience-table td div {
    font-size: 11px;
    line-height: 1.2;
}

.experience-table td div[id$="_ar"] {
    font-weight: 700;
    color: var(--brand-dark);
}

.experience-table td div[id$="_en"] {
    color: #666;
    text-transform: uppercase;
}

.form-actions-grid {
    position: sticky;
    bottom: -24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 18px;
    margin-top: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 35%);
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 12px;
    border: none;
    border-radius: 14px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn--pdf {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: #fff;
    box-shadow: 0 10px 20px rgba(46, 143, 140, 0.2);
}

.download-btn--png,
.download-btn--jpg {
    background: #fff;
    color: var(--teal-dark);
    border: 1px solid rgba(62, 163, 159, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.download-btn--pdf:hover {
    filter: saturate(1.1);
    box-shadow: 0 14px 28px rgba(46, 143, 140, 0.22);
}

.download-btn i {
    font-size: 1.1rem;
}

.preview-panel {
    flex: 1 1 660px;
    min-height: 0;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.88)),
        linear-gradient(135deg, #dbe8ea, #f7f1e3);
    overflow-y: auto;
}

.cv-stage {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.cv-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    width: 210mm;
    height: 297mm;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(45, 60, 76, 0.16);
    overflow: hidden;
    transform: translateX(-50%) scale(1);
    transform-origin: top center;
}

.cv-document {
    position: relative;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family: Arial, "Cairo", sans-serif;
}

.pdf-export-host {
    position: fixed;
    top: 0;
    left: -100000px;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: var(--paper);
    pointer-events: none;
}

.pdf-export-host .cv-document {
    width: 210mm;
    height: 297mm;
    border-radius: 0;
    box-shadow: none;
}

.cv-top-strip {
    height: 7mm;
    background: linear-gradient(90deg, var(--teal) 0 87%, var(--gold) 87% 100%);
}

.cv-watermark {
    position: absolute;
    inset: 8mm 3mm 6mm;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 10mm 8mm;
    opacity: 0.07;
    pointer-events: none;
}

.watermark-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3mm;
    color: var(--teal);
}

.watermark-tile img {
    width: 10mm;
    height: 10mm;
    object-fit: contain;
}

.watermark-tile span {
    font-size: 7mm;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.watermark-tile small {
    color: var(--gold);
    font-family: "Cairo", sans-serif;
    font-size: 3mm;
    font-weight: 800;
}

.cv-page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 7mm);
    padding: 5.5mm 5.5mm 3.5mm;
}

.cv-main-layout {
    display: grid;
    grid-template-columns: 52mm 1fr;
    gap: 3.4mm;
    align-items: start;
}

.cv-side-column {
    display: flex;
    flex-direction: column;
    gap: 4mm;
}

.qr-card {
    width: 29mm;
    height: 29mm;
    margin-inline-start: 10mm;
    border: 0.6mm solid rgba(58, 152, 149, 0.25);
    background: rgba(255, 255, 255, 0.95);
}

.qr-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-panel {
    position: relative;
    height: 170mm;
    border-radius: 3mm;
    background: linear-gradient(180deg, #5aa9a7 0%, #52a6a2 42%, #4b9d99 100%);
    box-shadow: inset 0 0 0 0.4mm rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.photo-panel__frame {
    position: absolute;
    inset: 1.2mm;
    border: 0.35mm dashed rgba(255, 255, 255, 0.42);
    border-radius: 2.4mm;
}

.photo-panel__band {
    position: absolute;
    top: 58mm;
    left: 1.4mm;
    right: 1.4mm;
    z-index: 4;
    padding: 1.8mm 0;
    border-radius: 0.6mm;
    background: rgba(242, 242, 242, 0.96);
    color: #8f8f94;
    text-align: center;
    font-size: 4.2mm;
    box-shadow: 0 0.6mm 1.2mm rgba(55, 82, 88, 0.1);
}

.photo-panel__personal {
    position: absolute;
    top: 4mm;
    left: 0;
    right: 0;
    height: 50mm;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5mm 6mm 6mm;
}

.photo-panel__sample-box {
    position: relative;
    z-index: 2;
    width: 30mm;
    height: 39mm;
    padding: 10mm 0 0;
    border: 1.1mm solid rgba(255, 255, 255, 0.88);
    border-radius: 1.4mm;
    background: #dbdbdd;
    color: #8f8f92;
    text-align: center;
    font-size: 4mm;
    line-height: 1.15;
    letter-spacing: 0.24em;
    box-shadow: 0 1.2mm 2.5mm rgba(47, 79, 83, 0.16);
    text-transform: lowercase;
}

.photo-panel__personal-image {
    position: relative;
    z-index: 3;
    width: 30mm;
    height: 39mm;
    border: 1.1mm solid rgba(255, 255, 255, 0.88);
    border-radius: 1.4mm;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 1.2mm 2.5mm rgba(47, 79, 83, 0.16);
    object-fit: cover;
    object-position: center top;
}

.photo-panel__full {
    position: absolute;
    top: 65mm;
    left: 4mm;
    right: 4mm;
    bottom: 4mm;
    z-index: 2;
    border-radius: 2mm;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    overflow: hidden;
}

.photo-panel__full-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
}

.photo-panel__placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    border: 0.35mm solid rgba(255, 255, 255, 0.16);
    border-radius: 2mm;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
}

.is-hidden {
    display: none !important;
}

.cv-primary-column {
    display: flex;
    flex-direction: column;
}

.brand-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4mm;
}

.brand-copy {
    padding-top: 3mm;
}

.brand-copy h1 {
    color: var(--teal);
    font-size: 9.2mm;
    font-weight: 800;
    line-height: 1;
}

.brand-copy p {
    margin-top: 1.2mm;
    color: #8c8c91;
    font-size: 5mm;
    font-weight: 700;
}

.brand-logo {
    width: 19mm;
    height: 19mm;
    object-fit: contain;
}

.resume-heading {
    margin: 1.5mm 0 2mm;
    text-align: center;
    line-height: 1.05;
}

.resume-heading strong {
    display: block;
    color: var(--teal);
    font-family: "Cairo", sans-serif;
    font-size: 6.5mm;
    font-weight: 800;
}

.resume-heading span {
    display: block;
    color: #efbf55;
    font-size: 6mm;
    font-weight: 800;
}

.meta-table,
.mini-table,
.details-table,
.experience-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: rgba(255, 253, 249, 0.95);
}

.meta-table {
    margin-top: 0.5mm;
}

.meta-table th,
.experience-table th {
    padding: 1.8mm 1.4mm 1.3mm;
    border: 0.3mm solid #cfc6b9;
    background: var(--teal);
    color: #fff;
    font-size: 2.9mm;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
}

.meta-table th span,
.experience-table th span {
    display: block;
    margin-top: 0.4mm;
    font-family: "Cairo", sans-serif;
    font-size: 2.55mm;
}

.meta-table td,
.experience-table td {
    height: 6.1mm;
    border: 0.3mm solid #cfc6b9;
    color: #635a54;
    font-size: 3.05mm;
    font-weight: 700;
    text-align: center;
}

.mini-table {
    margin-top: 1mm;
}

.split-tables-container {
    display: flex;
    gap: 3.4mm;
    margin-top: 1mm;
}

.split-side {
    flex: 1;
}

.details-table td {
    height: 5.55mm;
    border: 0.3mm solid #d4ccbf;
}

.split-side--en .label-cell {
    width: 55%;
}
.split-side--en .value-cell {
    width: 45%;
}

.split-side--ar .label-cell {
    width: 55%;
}
.split-side--ar .value-cell {
    width: 45%;
    text-align: center;
}
.split-side--ar .arabic-cell {
    width: 55%;
}

.label-cell {
    padding: 0 1.4mm;
    background: var(--stone-soft);
    color: #7a726b;
    font-size: 2.5mm; /* Slightly smaller for split view */
    font-weight: 800;
}

.value-cell {
    padding: 0 2mm;
    color: #635952;
    font-size: 2.8mm;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.arabic-cell {
    padding: 0 1.6mm;
    background: var(--stone-soft);
    color: #756a64;
    direction: rtl;
    text-align: right;
    font-family: "Cairo", sans-serif;
    font-size: 2.7mm;
    font-weight: 800;
}

.section-bar {
    height: 4.4mm;
    margin: 2mm 0 1.2mm;
    background: var(--teal);
}

.experience-table {
    margin-top: 2.2mm;
}

.skills-section {
    margin-top: auto;
    padding-top: 5mm;
}

.skills-row {
    display: grid;
    gap: 1.2mm;
}

.skills-row + .skills-row {
    margin-top: 1.4mm;
}

.skills-row--top {
    grid-template-columns: repeat(4, 1fr);
}

.skills-row--bottom {
    grid-template-columns: repeat(5, 1fr);
}

.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 24.6mm;
    padding: 2.2mm 1.4mm 1.6mm;
    border: 0.3mm solid #ebe4d8;
    background: rgba(241, 239, 236, 0.95);
    text-align: center;
}

.skill-icon {
    color: #32a0a0;
    font-size: 5.2mm;
}

.skill-ar {
    min-height: 8mm;
    margin-top: 1.2mm;
    color: #6b635d;
    direction: rtl;
    font-family: "Cairo", sans-serif;
    font-size: 2.7mm;
    font-weight: 800;
    line-height: 1.08;
}

.skill-en {
    min-height: 5.4mm;
    margin-top: 0.6mm;
    color: #8d837d;
    font-size: 2.25mm;
    font-weight: 700;
    line-height: 1.08;
}

.skill-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 8.4mm;
    height: 8.4mm;
    margin-top: auto;
    border: 0.4mm solid #efc55f;
    background: #fff;
    color: var(--teal);
    font-size: 3.8mm;
    font-weight: 800;
}

.cv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2mm;
    padding-top: 2.4mm;
    margin-top: 2.2mm;
    color: #59a8aa;
    font-size: 1.9mm;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .editor-panel,
    .preview-panel {
        height: 100%;
    }
}

@media (max-width: 920px) {
    body {
        height: auto;
        overflow: auto;
    }

    .workspace {
        flex: 0 0 auto;
        min-height: auto;
        padding: 16px;
        width: 100%;
    }

    .form-grid--two,
    .form-grid--three,
    .skills-picker {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        height: auto;
        padding: 12px;
    }

    .editor-panel {
        height: auto;
    }

    .cv-stage {
        min-width: 340px;
    }

    .cv-wrapper {
        left: 0;
        transform: scale(1);
        transform-origin: top left;
    }
}

@media print {
    body {
        background: #fff;
    }

    body * {
        visibility: hidden;
    }

    .cv-wrapper,
    .cv-wrapper * {
        visibility: visible;
    }

    .cv-wrapper {
        position: absolute;
        inset: 0;
        width: 210mm;
        height: 297mm;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .cv-document,
    .cv-document * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
