/* Email input error styles */
.input-error-msg {
    color: #d00;
    font-size: 13px;
    margin-top: 4px;
    display: block;
}
.input-error {
    border-color: #d00 !important;
    background: #fff0f0;
}

/* Date validation error message */
.date-error-msg {
    background: #fee;
    border-left: 4px solid #d00;
    color: #c00;
    font-size: 14px;
    padding: 10px 12px;
    margin-top: 8px;
    border-radius: 4px;
    animation: slideInDown 0.3s ease-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Language validation error message */
.language-error-msg {
    background: #fee;
    border-left: 4px solid #d00;
    color: #c00;
    font-size: 13px;
    padding: 8px 10px;
    margin-top: 6px;
    border-radius: 4px;
    animation: slideInDown 0.3s ease-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

/* Disabled select options styling */
select option:disabled {
    color: #ccc;
    font-style: italic;
}

.cv-generator-container {
    display: flex;
    flex-direction: column; /* top bar + full-width content below */
    font-family: sans-serif;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
}

/* Top navigation bar (steps on left, login on right) */
.cv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: #0d2d5c;
    color: #fff;
    padding: 10px 16px;
    border-bottom: 1px solid #0b2346;
}
.cv-topbar-left { 
    min-width: 0; /* allow flex children to shrink for overflow */
    flex: 1;
}
.cv-topbar-right { 
    flex: 0 0 auto; 
    display: flex; 
    align-items: center; 
}
.cv-topbar .cv-steps ul {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.cv-topbar .step-item {
    margin-bottom: 0;
    background: transparent;
}
.cv-topbar .step-item:hover { background-color: #1a4a8a; }
.cv-topbar .step-item.active { background-color: #f0b400; color: #0d2d5c; }

/* User Account Button - Top Right Corner */
.cv-user-corner {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 100;
}

.btn-user-account {
    background: white;
    border: 2px solid #0d2d5c;
    border-radius: 30px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    color: #0d2d5c;
    font-weight: 600;
    white-space: nowrap;
}

.btn-user-account i {
    font-size: 20px;
}

.btn-user-account .user-btn-text {
    font-size: 14px;
}

.btn-user-account:hover {
    background: #0d2d5c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn-user-account.logged-in {
    background: #f4c430;
    border-color: #f4c430;
    color: #0d2d5c;
}

.btn-user-account.logged-in:hover {
    background: #d4a410;
    border-color: #d4a410;
    color: white;
}

/* legacy sidebar styles no longer used after moving steps to topbar */
.cv-sidebar { display: none; }

.cv-steps ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 10px 8px; /* tighter */
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 8px;
    transition: background-color 0.3s;
}

.step-item:hover {
    background-color: #1a4a8a;
}

.step-item.active {
    background-color: #f0b400;
    color: #0d2d5c;
    font-weight: bold;
}

.step-number {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background-color: white;
    color: #0d2d5c;
    margin-right: 10px;
    font-size: 13px;
}

.step-item.active .step-number {
     background-color: #0d2d5c;
     color: white;
}

.cv-main-content {
    flex-grow: 1;
    padding: 24px 40px;
    overflow: visible;
    position: relative;
}

/* Remove old preview area */
.cv-preview-area {
    display: none;
}

/* Preview button in sidebar */
.btn-plan-switch {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    color: #0d2d5c;
    border: 2px solid #f0b400;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.btn-plan-switch:hover { 
    background: #f0b400; 
    transform: translateY(-2px); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-plan-switch i {
    font-size: 14px;
}

/* Plan Gate Overlay */
.plan-gate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.plan-gate-overlay.open { display: flex; }
.plan-gate-dialog {
    background: #fff;
    border-radius: 12px;
    max-width: 980px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0 8px; }
.plan-card { border: 2px solid #e5e7eb; border-radius: 10px; padding: 16px; background: #fafafa; cursor: pointer; text-align: left; transition: all .2s; position: relative; }
.plan-card:hover { border-color: #0d2d5c; transform: translateY(-2px); }
.plan-card.active { border-color: #0d2d5c; box-shadow: 0 6px 16px rgba(13,45,92,.15); background: #fff; }
.plan-badge { position: absolute; top: -10px; right: -10px; background: #f0b400; color: #0d2d5c; font-weight: 700; padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.plan-title { font-size: 18px; font-weight: 700; color: #0d2d5c; }
.plan-price { font-size: 24px; font-weight: 800; margin: 6px 0 8px; }
.plan-features { margin: 0; padding-left: 18px; color: #333; }
.plan-features .muted { opacity: .65; }
.plan-templates { margin-top: 10px; }
.templates-header { font-weight: 700; margin-bottom: 8px; }
.template-grid.small { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.template-item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; background: #fff; cursor: pointer; transition: all .2s; position: relative; }
.template-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-2px); }
.template-item.selected { outline: 2px solid #0d2d5c; }
.template-badge { position: absolute; top: 8px; left: 8px; background: #e9ecef; color: #0d2d5c; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.template-badge.premium { background: #d63384; color: #fff; }
.template-preview.mini { height: 120px; border-radius: 6px; overflow: hidden; }
.plan-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.btn-start { background: #0d2d5c; color: #fff; border: none; border-radius: 8px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.btn-start[disabled] { opacity: .5; cursor: not-allowed; }
.btn-buy { background: #28a745; color: #fff; border-radius: 8px; padding: 10px 16px; text-decoration: none; font-weight: 700; }

/* Premium gating helpers */
.premium-only { display: none; }
.plan-premium .premium-only { display: block; }

/* Hide advanced tools on Free via CSS */
.plan-free .rte-toolbar [data-command="justifyLeft"],
.plan-free .rte-toolbar [data-command="justifyCenter"],
.plan-free .rte-toolbar [data-command="justifyRight"],
.plan-free .rte-toolbar [data-command="indent"],
.plan-free .rte-toolbar [data-command="outdent"],
.plan-free .rte-toolbar [data-command="strikeThrough"],
.plan-free .rte-toolbar .rte-color-group,
.plan-free .rte-toolbar .rte-highlight-group,
.plan-free .editor-tabs [data-tab="filters"],
.plan-free .tab-pane[data-tab="filters"] { display: none !important; }

/* Modal styles */
.cv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Ensure modal overlays any site header/menus */
    z-index: 2147483647; /* max 32-bit int to beat aggressive theme z-indexes */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px 20px;
    animation: fadeIn 0.2s ease-out;
    overflow-y: auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cv-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out;
    margin: auto;
    position: relative;
}

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

.cv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.cv-modal-header h3 {
    margin: 0;
    color: #0d2d5c;
    font-size: 1.4em;
}

.cv-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cv-modal-close:hover {
    background: rgba(255,0,0,0.1);
    color: #d00;
}

.cv-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Simple auth tabs inside modal */
.auth-tabs .tab-btn {
    cursor: pointer;
}
.auth-tabs .tab-btn.active {
    background: #0d2d5c !important;
    color: #fff !important;
}

.cv-modal-body .cv-a4-preview {
    max-width: 100%;
    margin: 0 auto;
}

/* Final preview on template selection step */
#cv-preview-final {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

#cv-preview-final h3 {
    color: #0d2d5c;
    margin-bottom: 20px;
}

#cv-preview-final .preview-container {
    display: flex;
    justify-content: center;
}

#cv-preview-final .cv-a4-preview {
    background: white;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1.414;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    overflow-y: auto;
    font-size: 12px;
    box-sizing: border-box;
}

/* Style dla podglądu CV */
.cv-a4-preview {
    background: white;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 210 / 297; /* Format A4: 210mm x 297mm */
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-y: auto;
    font-size: 12px;
    box-sizing: border-box;
    user-select: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Responsywny podgląd w step 8 - pełna szerokość środkowej kolumny */
.cv-preview-main .cv-a4-preview {
    max-width: 100%;
    width: 100%;
    height: auto;
    min-height: auto;
    overflow: visible;
    aspect-ratio: auto;
}

.template-right .cv-a4-preview {
    max-width: 100%;
    height: auto;
    min-height: 500px;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Force two-column layout for dates row and span full width */
.form-grid .dates-row {
    grid-column: 1 / -1;
}
.dates-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 640px) {
  .dates-row { grid-template-columns: 1fr; }
}

/* Style dla date picker i checkboxa "obecnie" */
.date-end-wrapper {
    position: relative;
}

.current-checkbox {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.current-checkbox label {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Style dla Flatpickr */
.flatpickr-input[disabled] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

/* Dodatkowe style dla disabled input */
input[disabled] {
    background-color: #f5f5f5;
    border-color: #ddd;
    color: #666;
    cursor: not-allowed;
}

/* Style dla alternatywnego inputa Flatpickr */
.flatpickr-input.flatpickr-alt-input {
    background-color: white;
}

/* Ensure only one date field is visible when flatpickr altInput is enabled */
input#birth-date.flatpickr-input { display: none !important; }

/* Customizacja kalendarz Flatpickr */
.flatpickr-calendar.material_blue {
    box-shadow: 0 3px 15px rgba(13,45,92,0.1);
    border-radius: 8px;
}

/* Style dla wyboru szablonu */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 20px 0;
}

/* Nowy layout dla Step 8 - personalizacja i podgląd */
.cv-customization-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    margin: 20px 0;
}

.cv-preview-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.preview-header-main h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.interactive-preview {
    position: relative;
    cursor: default;
}

.interactive-preview .editable-section {
    position: relative;
    transition: all 0.2s ease;
}

.interactive-preview .editable-section:hover {
    background: rgba(0, 123, 255, 0.05);
    outline: 2px solid rgba(0, 123, 255, 0.3);
    outline-offset: -2px;
}

.interactive-preview .editable-section:hover::after {
    content: '\f044'; /* Font Awesome pen icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cv-sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.customization-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.customization-panel > h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.custom-section:last-of-type {
    margin-bottom: 16px;
}

.custom-section > label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

/* Zakładki personalizacji */
.customization-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.custom-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.custom-tab:hover {
    color: #007bff;
    background: #f8f9fa;
}

.custom-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #f8f9ff;
}

.custom-tab i {
    font-size: 14px;
}

/* Zawartość zakładek */
.custom-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.custom-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid ze wszystkimi szablonami */
.all-templates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding: 4px;
}

.all-templates-grid::-webkit-scrollbar {
    width: 6px;
}

.all-templates-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.all-templates-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.all-templates-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.template-mini-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.mini-template-btn {
    aspect-ratio: 210 / 297;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
    /* Ensure the button fills the grid cell to establish a concrete width */
    display: block;
    width: 100%;
}

.mini-template-btn:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.mini-template-btn.active {
    border-color: #007bff;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.mini-template-preview {
    width: 100%;
    /* Give the preview its own stable aspect ratio to avoid 0-height on first paint */
    aspect-ratio: 210 / 297;
    height: auto;
    background: #f8f9fa;
    border-radius: 6px;
    /* Add subtle border and shadow outside of the scaled content for consistent thickness */
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: relative; /* required for absolute mini content centering */
    display: block;
    overflow: hidden;
}

/* Ensure the generated preview content fills the preview box nicely */
.mini-template-preview .mini-preview-content {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    pointer-events: none;
}

.mini-template-preview .template-name {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-align: center;
    padding: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    z-index: 10;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-btn.active {
    border-color: #333;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #007bff;
}

.color-btn.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#custom-color-picker {
    grid-column: span 2;
    height: 100%;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.custom-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.custom-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.slider-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s ease;
}

.slider-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.slider-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Modal dla pełnej galerii szablonów */
.cv-modal-large {
    max-width: 1000px;
    width: 90vw;
}

.template-gallery-modal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* Większa minimalna szerokość */
    gap: 24px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 4px;
}

/* Nowy layout dla Step 8 - dwukolumnowy z filtrami */
.template-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    margin: 20px 0;
}

.template-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-filters {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.template-filters input,
.template-filters select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.template-filters input:focus,
.template-filters select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    max-height: 600px;
    overflow-y: auto;
    padding: 4px;
}

.gallery-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px 0;
}

.template-right {
    position: sticky;
    top: 20px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border: 1px solid #e0e0e0;
    border-bottom: none;
}

.preview-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.template-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    border: 1px solid #e0e0e0;
    border-top: none;
}

.access-hint {
    font-size: 13px;
    color: #666;
    text-align: center;
}

.template-item {
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.template-item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.template-item.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.template-preview.mini {
    width: 100%;
    aspect-ratio: 210 / 297; /* Format A4 */
    border-radius: 4px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 8px;
}

.template-preview.mini svg {
    width: 100%;
    height: 100%;
    display: block;
}

.template-item {
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.template-item.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.template-preview {
    margin-bottom: 16px;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 210 / 297; /* Format A4 */
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-preview img,
.template-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

.template-info h4 {
    margin: 0 0 4px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.template-info small {
    font-size: 12px;
    color: #888;
    text-transform: capitalize;
}

.template-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}
    .inline-group {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: wrap;
    }

/* Style dla podglądu CV */
.cv-preview-area {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 8px;
    [data-hint] {
        position: relative;
        cursor: help;
    }
    [data-hint]:hover::after {
        content: attr(data-hint);
        position: absolute;
        left: 0;
        top: 100%;
        transform: translateY(6px);
        background: #1f2937;
        color: #fff;
        padding: 6px 8px;
        border-radius: 4px;
        font-size: 12px;
        line-height: 1.2;
        white-space: normal;
        width: max-content;
        max-width: 260px;
        z-index: 10;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    padding: 20px;
    margin: 20px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#cv-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#cv-preview > h3 {
    flex-shrink: 0;
    margin: 0 0 1rem 0;
}

/* Responsywność podglądu */
@media (max-width: 1200px) {
    .template-layout {
        grid-template-columns: 1fr;
    }
    
    .template-right {
        position: relative;
        top: 0;
    }
    
    .template-filters {
        grid-template-columns: 1fr;
    }
    
    .cv-customization-layout {
        grid-template-columns: 1fr;
    }
    
    .cv-sidebar-right {
        order: -1; /* Personalizacja nad podglądem na mobile */
    }
    
    .template-mini-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .cv-modal-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .cv-modal-body {
        padding: 16px;
    }

    .cv-user-corner {
        top: 10px;
        right: 10px;
    }

    .btn-user-account {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .btn-user-account i {
        font-size: 18px;
    }
    
    .btn-user-account .user-btn-text {
        font-size: 12px;
    }
}

/* Style dla szablonów CV */
.cv-template {
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

.cv-template-modern {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
}

.cv-template-creative {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group label {
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.btn-add {
    background-color: #0d2d5c;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

/* Prev/Next form navigation */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px 0;
    border-top: 1px solid #eee;
    z-index: 2;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-prev {
    background: #f1f3f5;
    color: #0d2d5c;
}

.btn-next {
    background: #0d2d5c;
    color: #fff;
}

.btn-clear-section {
    padding: 10px 20px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.btn-clear-section:hover {
    background: #c82333;
}

.btn-clear-section:active {
    background: #bd2130;
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-section {
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    overflow: visible;
}

/* Pretty checkbox groups */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding-top: 6px;
}

/* Rich Text Editor */
.rich-text-editor {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.rich-text-editor .rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}
.rich-text-editor .rte-separator {
    width: 1px;
    height: 22px;
    background: #e5e7eb;
    margin: 0 4px;
}
.rich-text-editor .rte-btn {
    border: 1px solid #dfe3e8;
    background: #ffffff;
    color: #0d2d5c;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
}
.rich-text-editor .rte-btn:hover { background: #f1f5f9; }
.rich-text-editor .rte-btn.active {
    background: #e8f0fe;
    border-color: #c7d2fe;
}
.rich-text-editor .rte-content {
    min-height: 120px;
    padding: 12px;
}
.rich-text-editor .rte-content:empty:before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

/* RTE color pickers */
.rte-color-group, .rte-highlight-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px; /* bring caret closer to its action */
}
.rte-caret-btn {
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rte-caret-btn::after {
    content: '\25BE';
    font-size: 12px; /* bigger, more visible */
    line-height: 1;
    color: #0d2d5c; /* ensure contrast */
}

.rte-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 8px 20px rgba(13,45,92,0.15);
    border-radius: 8px;
    padding: 8px;
    display: none;
    min-width: 180px;
}
.rte-dropdown.open { display: block; }
.rte-palette {
    display: grid;
    grid-template-columns: repeat(8, 18px);
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 8px;
}
.rte-swatch {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    cursor: pointer;
}
.rte-more-colors {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.rte-more-colors:hover { background: #eef2f7; }

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #333;
}

.checkbox-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Field hints */
.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #6c757d;
}

/* Make flatpickr altInput look like our inputs */
.flatpickr-input.flatpickr-alt-input {
    padding: 10px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    width: 100%;
    box-sizing: border-box;
}

/* Kontener na wrapper URL z ikoną */
.url-input-wrapper {
    position: relative;
}

.placeholder-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #0d2d5c;
    font-size: 18px;
    z-index: 10;
}

.url-input {
    width: 100%;
    padding: 8px 10px 8px 48px; /* more left padding for icon */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    box-sizing: border-box;
}

.url-input:focus {
    outline: none;
    border-color: #0d2d5c;
    box-shadow: 0 0 0 2px rgba(13,45,92,0.1);
}

/* Style dla social-link-item - pola pod sobą */
.social-link-item .form-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.social-link-item .form-group {
    width: 100%;
}

.social-link-item .url-group {
    margin-top: 0;
    animation: slideDown 0.3s ease-out;
}

.social-link-item .form-group label {
    margin-bottom: 5px;
    display: block;
    font-size: 14px;
    font-weight: 500;
}

.social-link-item input[type="text"],
.social-link-item input[type="url"] {
    padding: 8px 10px;
    font-size: 15px;
}

/* Ensure URL input leaves room for the icon inside */
.social-link-item .url-input[type="text"] {
    padding-left: 56px; /* override generic input padding to avoid overlap with icon */
}

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

/* Stylowanie inputa typu linku */
.link-type-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    color: #333;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.link-type-input:focus {
    outline: none;
    border-color: #0d2d5c;
    box-shadow: 0 0 0 2px rgba(13,45,92,0.1);
}

.social-link-item .link-type-input {
    padding: 10px;
    font-size: 16px;
}

/* Stylowanie elementów autouzupełniania dla linków */
.cv-autocomplete-item i {
    margin-right: 10px;
    opacity: 0.8;
    width: 20px;
    text-align: center;
}

/* Animacja dla ikon */
.placeholder-icon {
    transition: all 0.3s ease;
}

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

.section-header h3 {
    margin: 0;
    color: #0d2d5c;
    font-size: 1.1em;
}

.btn-remove {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: rgba(255,0,0,0.1);
    color: #d00;
}

.link-item {
    position: relative;
    padding-right: 40px;
}

.link-item .btn-remove {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.skill-tag {
    background-color: #e0e0e0;
    padding: 5px 12px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    background: #0d2d5c;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
}

.skill-tag:hover {
    background: #1a4a8a;
}

.remove-tag {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    margin-left: 8px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: all 0.2s ease;
}

.remove-tag:hover {
    color: #fff;
    transform: scale(1.1);
}

/* Skills suggestions panel */
.skills-suggestions-panel {
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.skills-suggestions-panel .sugg-header {
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
}

.skills-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-suggestion-chip {
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
}

.skill-suggestion-chip:hover:not(:disabled) {
    background: #0d2d5c;
    color: white;
    border-color: #0d2d5c;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(13, 45, 92, 0.2);
}

.skill-suggestion-chip.added {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #81c784;
    cursor: default;
    opacity: 0.7;
}

.skill-suggestion-chip.added::before {
    content: '✓ ';
    font-weight: bold;
}

.btn-add-small {
    background-color: #0d2d5c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.btn-add-small:hover {
    background-color: #1a4a8a;
}

/* Container dla inputa i przycisku */
.form-group:has(#skill-input) {
    display: flex;
    align-items: start;
    gap: 10px;
}

#skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    min-height: 35px;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Hide native datalist dropdown (we use custom autocomplete) */
datalist {
    display: none !important;
}

/* Custom autocomplete styles (replaces native datalist UI) */
.cv-autocomplete-container {
    position: absolute;
    z-index: 10000;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 6px 18px rgba(13,45,92,0.12);
    max-height: 220px;
    overflow-y: auto;
    min-width: 160px;
    border-radius: 6px;
    padding: 6px 4px;
}

.cv-autocomplete-container .cv-autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 15px;
    color: #0d2d5c;
}

.cv-autocomplete-container .cv-autocomplete-item:hover,
.cv-autocomplete-container .cv-autocomplete-item.selected {
    background: rgba(13,45,92,0.06);
}

/* Make sure long lists look nice on small screens */
@media (max-width: 480px) {
    .cv-autocomplete-container { max-height: 160px; }
}

/* Languages section styles */
.language-level-group {
    grid-column: 1 / -1;
}

/* Native language quick chips */
.lang-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.btn-chip {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    background: #f8f9fa;
    color: #0d2d5c;
    cursor: pointer;
    font-size: 13px;
}
.btn-chip:hover {
    background: #e9ecef;
}
.language-level-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.language-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
}

.language-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #0d2d5c;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s;
}

.language-slider::-webkit-slider-thumb:hover {
    background: #1a4a8a;
}

.language-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0d2d5c;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    transition: background 0.3s;
}

.language-slider::-moz-range-thumb:hover {
    background: #1a4a8a;
}

.level-label {
    min-width: 250px;
    font-weight: 600;
    color: #0d2d5c;
}

.level-description {
    margin-top: 8px;
    color: #6c757d;
}

.level-description small {
    font-size: 13px;
}


/* Certifications section styles */
.certification-item .form-grid {
    grid-template-columns: repeat(2, 1fr);
}

.certification-item .form-grid .form-group:first-child {
    grid-column: 1 / -1;
}

/* Skills library panel */
.skills-library {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    background: #fafafa;
}
.skills-library .library-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    color: #0d2d5c;
}
.skills-library .library-hint {
    font-size: 12px;
    color: #6c757d;
}
.skills-library .library-controls {
    margin-bottom: 10px;
}
.skills-library .library-search {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
.skills-library .library-list {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.skills-library .library-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    cursor: pointer;
}
.skills-library .library-item:hover {
    border-color: #cfe2ff;
    background: #f8fbff;
}
.skills-library .library-name {
    font-size: 14px;
    color: #0d2d5c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.skills-library .library-add {
    background: #0d2d5c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}
.skills-library .library-add:hover {
    background: #1a4a8a;
}
.skills-library .library-empty {
    color: #6c757d;
    padding: 8px 0;
}

@media (max-width: 600px) {
  .skills-library .library-list { grid-template-columns: 1fr; }
}

/* Checkbox groups */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px 0;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
}

.checkbox-inline input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    width: auto;
}

/* Driving license categories */
.dl-categories-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.dl-category-group {
    border-left: 3px solid #e0e0e0;
    padding-left: 12px;
}
.dl-category-label {
    display: block;
    color: #0d2d5c;
    font-size: 14px;
    margin-bottom: 6px;
}
.dl-extensions {
    border-left: 2px solid #dee2e6;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
}
.checkbox-inline small {
    color: #6c757d;
    font-size: 12px;
    margin-left: 2px;
}

/* Field hints */
.field-hint {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* Form sections */
.form-section {
    margin-bottom: 25px;
}

.form-section > h3 {
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

/* Photo upload UI */
.photo-upload-group {
    margin-bottom: 16px;
}

.photo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #e6eef8;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fb;
    position: relative;
    cursor: pointer;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-placeholder {
    color: #8aa3c7;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-edit-hint {
    position: absolute;
    inset: 0;
    background: rgba(13,45,92,0.6);
    color: #fff;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    line-height: 1.3;
    z-index: 2;
}

.photo-preview.has-image:hover .photo-edit-hint {
    display: flex;
}

.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.photo-actions input[type="file"] {
    padding: 8px 12px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    background: #fff;
    color: #0d2d5c;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.photo-actions input[type="file"]:hover {
    background: #f0f8ff;
    border-color: #005a87;
}

.photo-actions input[type="file"]::file-selector-button {
    padding: 6px 14px;
    margin-right: 10px;
    border: none;
    border-radius: 3px;
    background: #0073aa;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s ease;
}

.photo-actions input[type="file"]::file-selector-button:hover {
    background: #005a87;
}

.btn-remove-photo {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-remove-photo:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-remove-photo:active {
    background: #bd2130;
    transform: scale(0.98);
}

.btn-secondary {
    background: #f1f3f5;
    color: #0d2d5c;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Hide legacy inline photo editor controls (moved to modal) */
#photo-edit { display: none !important; }

/* Photo editor modal layout */
/* Photo editor modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 900px;
    max-height: 90vh;
    overflow: auto;
}

.photo-editor-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    padding: 20px;
}

.photo-editor-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    min-height: 400px;
}

#photo-editor-canvas {
    max-width: 100%;
    max-height: 500px;
    border: 2px solid #ddd;
    border-radius: 4px;
    touch-action: none;
}

.photo-editor-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    pointer-events: none;
}

/* Crop box handles */
.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #0073aa;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    /* Larger hit area for easier grabbing */
    padding: 8px;
    margin: -8px;
}

.crop-handle.nw { top: -10px; left: -10px; cursor: nw-resize; }
.crop-handle.ne { top: -10px; right: -10px; cursor: ne-resize; }
.crop-handle.sw { bottom: -10px; left: -10px; cursor: sw-resize; }
.crop-handle.se { bottom: -10px; right: -10px; cursor: se-resize; }

.crop-handle:hover {
    background: #0073aa;
    transform: scale(1.3);
    transition: all 0.2s;
    border-color: #005a87;
}

.crop-handle:active {
    transform: scale(1.4);
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
}

.photo-editor-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Editor Tabs */
.editor-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}

.editor-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    border-right: 1px solid #e0e0e0;
    position: relative;
}

.editor-tab:last-child {
    border-right: none;
}

.editor-tab:hover {
    background: #f0f0f0;
    color: #333;
}

.editor-tab.active {
    background: white;
    color: #0073aa;
    font-weight: 600;
}

.editor-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0073aa;
}

/* Tab Content */
.editor-tab-content {
    padding: 20px;
    background: white;
    max-height: 400px;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.photo-editor-controls h3 {
    margin: 0 0 10px 0;
}

.photo-editor-controls .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.photo-editor-controls label {
    font-weight: 600;
    font-size: 14px;
}

.photo-editor-controls input[type="range"] {
    width: 100%;
}

.photo-editor-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 20px;
}

.editor-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
}

.editor-actions button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    min-width: 120px;
}

.editor-actions .btn-secondary {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
}

.editor-actions .btn-secondary:hover {
    background: #c82333;
    border-color: #bd2130;
}

.photo-editor-actions .btn {
    flex: 1;
}

/* Contextual toggles (inline, compact) */
.contextual-toggle {
    margin-top: 0;
    font-size: 13px;
    color: #444;
}
.contextual-toggle .checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.photo-upload-group + .contextual-toggle {
    margin-top: 10px;
}

/* Place photo toggle next to the photo on wide screens */
@media (min-width: 768px) {
    .photo-upload {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 16px;
        align-items: center;
    }
    #toggle-show-photo {
        grid-column: 2 / 3;
    }
}
/* Crop presets */
.crop-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-preset {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-preset:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.btn-preset.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Rotation controls */
.rotation-controls {
    display: flex;
    gap: 10px;
}

.flip-controls {
    display: flex;
    gap: 10px;
}

.btn-icon {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.btn-icon.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Filter presets */
.filter-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.filter-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    text-align: center;
}

.filter-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.filter-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    font-weight: 600;
}

/* Advanced adjustments accordion */
.advanced-adjustments, .filters-accordion {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    background: #fafafa;
}

.advanced-adjustments summary, .filters-accordion summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.advanced-adjustments summary::-webkit-details-marker,
.filters-accordion summary::-webkit-details-marker {
    display: none;
}

.advanced-adjustments .form-group {
    margin-top: 10px;
}

.advanced-adjustments .filters-list {
    margin-bottom: 10px;
}

/* Filters list */
.filters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.filter-item {
    width: 100%;
}

.filter-btn-new {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.filter-btn-new:hover {
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.filter-btn-new.active {
    border-color: #0073aa;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

.filter-preview {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-info strong {
    font-size: 14px;
    color: #333;
}

.filter-info small {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.filter-btn-new.active .filter-info strong {
    color: #0073aa;
}

@media (max-width: 768px) {
    .photo-editor-layout {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 95vw;
    }
}

/* Accordion (details/summary) for sections */
.cv-accordion {
    border: 1px solid #e9e9e9;
    border-radius: 8px;
    background: #fff;
    margin: 16px 0;
}
.cv-accordion > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}
.cv-accordion > summary::-webkit-details-marker { display: none; }
.cv-accordion > summary h3 { margin: 0; font-size: 16px; }
.cv-accordion > summary::after {
    content: '+';
    margin-left: auto;
    font-weight: 700;
    color: #666;
}
.cv-accordion[open] > summary::after {
    content: '−';
}
.cv-accordion > .form-grid,
.cv-accordion > .photo-upload-group {
    padding: 12px 12px 16px 12px;
    border-top: 1px solid #f2f2f2;
}

/* RODO footer */
.cv-rodo {
    margin-top: 16px;
    color: #6b7280;
}
.cv-rodo small { font-size: 12px; line-height: 1.4; }

/* Education extras accordion */
.education-extras-accordion {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.education-extras-category {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.education-extras-category:last-child {
    margin-bottom: 0;
}

.education-extras-category summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.education-extras-category summary:hover {
    background: #f5f5f5;
}

.education-extras-category summary::-webkit-details-marker {
    display: none;
}

.education-extras-category summary::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.2s;
    font-size: 10px;
}

.education-extras-category[open] summary::before {
    transform: rotate(90deg);
}

.education-extras-items {
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #e0e0e0;
}

.education-extra-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.education-extra-btn:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Rich Text Editor */
.rich-text-editor {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    overflow: hidden;
}

.rte-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.rte-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rte-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.rte-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.rte-btn strong {
    font-weight: 700;
}

.rte-btn em {
    font-style: italic;
}

.rte-btn u {
    text-decoration: underline;
}

.rte-separator {
    width: 1px;
    background: #ddd;
    margin: 0 4px;
}

.rte-color-picker {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.rte-color-input, .rte-highlight-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rte-color-btn {
    font-weight: 700;
    font-size: 16px;
    position: relative;
}

.rte-color-btn::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

/* Highlight button uses CSS var to preview current highlight color */
.rte-highlight-btn {
    font-weight: 700;
    font-size: 16px;
    position: relative;
}

.rte-highlight-btn::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 6px;
    background: var(--hl, #ffeb3b);
    border-radius: 2px;
}

.rte-content {
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

.rte-content:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.rte-content:focus {
    background: #fafafa;
}

.rte-content ul,
.rte-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.rte-content li {
    margin: 4px 0;
}

.rte-content p {
    margin: 8px 0;
}

.rte-content strong {
    font-weight: 700;
}

.rte-content em {
    font-style: italic;
}

.rte-content u {
    text-decoration: underline;
}

/* Suggestions panel styling */
.responsibilities-suggestions {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.sugg-header {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.sugg-search {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
}

.sugg-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.sugg-insert-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}

.sugg-insert-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    transform: translateX(4px);
}

.sugg-insert-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    font-weight: 600;
}

.sugg-insert-btn.active::before {
    content: '✓';
    margin-right: 6px;
    font-weight: bold;
}

.sugg-insert-btn.active:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

.sugg-insert-btn.active:hover::before {
    content: '✗';
}

/* Account Modal Tabs */
.cv-account-modal .cv-modal-content {
    max-width: 800px;
    max-height: 90vh;
}

.account-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 20px 0 20px;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.account-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
    white-space: nowrap;
}

.account-tab:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.account-tab.active {
    background: white;
    color: #0d2d5c;
    font-weight: 600;
    border-bottom: 3px solid #f4c430;
}

.account-pane {
    animation: fadeIn 0.3s ease;
}

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

.account-pane h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #0d2d5c;
    font-size: 18px;
}

.account-pane h5 {
    margin: 15px 0 10px 0;
    color: #333;
    font-size: 15px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load {
    background: #0d2d5c;
    color: white;
}

.btn-load:hover {
    background: #0a1f3f;
}

.btn-del {
    background: #dc3545;
    color: white;
}

.btn-del:hover {
    background: #c82333;
}

.cv-modal-footer {
    text-align: center;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
}

@media (max-width: 768px) {
    .cv-account-modal .cv-modal-content {
        max-width: 95%;
        margin: 20px auto;
    }
    
    .account-tabs {
        padding: 8px 10px 0 10px;
    }
    
    .account-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .account-pane .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Template Gallery in Modal */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.template-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    background: white;
}

.template-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.template-preview-box {
    aspect-ratio: 210 / 297;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e0e0e0;
    overflow: hidden;
    height: 450px; /* Zwiększony rozmiar dla lepszej czytelności */
}

.template-preview-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 794px;
    height: 1123px;
    transform: scale(0.28); /* Zwiększona skala */
    transform-origin: top left;
    pointer-events: none;
    overflow: hidden;
}

.template-preview-content > div[class^="cv-"],
.template-preview-content .cv-a4-preview {
     width: 794px;
     height: 1123px;
    background: white;
    box-shadow: none;
     margin: 0;
     padding: 0;
     overflow: hidden;
}

.template-preview-content img {
    max-width: 100%;
    height: auto;
     display: block;
}

/* Force all CV templates to fit preview dimensions */
.template-preview-content .cv-modern,
.template-preview-content .cv-creative,
.template-preview-content .cv-minimal,
.template-preview-content .cv-bold,
.template-preview-content .cv-elegant,
.template-preview-content .cv-technical,
.template-preview-content .cv-executive,
.template-preview-content .cv-compact,
.template-preview-content .cv-timeline {
    width: 794px !important;
    min-height: 1123px !important;
    max-height: 1123px !important;
    overflow: hidden !important;
    margin: 0 !important;
}

.template-name-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(255,255,255,0.95);
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    color: #333;
    text-align: center;
    font-size: 12px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Main responsive preview (full view) */
.cv-responsive-frame {
    width: 100%;
    position: relative;
    overflow: hidden;
}
.cv-responsive-content {
    width: 794px;
    height: 1123px;
    transform-origin: top left;
}

.template-info {
    padding: 15px;
}

.template-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
}

.template-info p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.select-template-btn {
    width: 100%;
    padding: 8px 12px;
    background: #16a085;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.select-template-btn:hover {
    background: #138f75;
}

@media (max-width: 768px) {
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* Statistics Page Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-box {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

/* Preview watermark/guards */
.cv-a4-preview.watermarked { position: relative; }
.cv-a4-preview.watermarked::after {
        content: '';
        position: absolute;
        inset: 0;
        pointer-events: none;
        opacity: 0.18;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='200' viewBox='0 0 300 200'><defs><style>@font-face{font-family:Arial;}</style></defs><text x='0' y='50' font-size='28' font-family='Arial' fill='%230d2d5c' opacity='0.6' transform='rotate(-20 0 0)'>DEMO • PREVIEW • CV GENERATOR</text></svg>");
        background-repeat: repeat;
        background-size: 300px 200px;
}

/* Hide preview content when printing from browser */
@media print {
    #cv-output, .cv-a4-preview, .interactive-preview { display: none !important; }
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.stat-primary .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-success .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.stat-warning .stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0d2d5c;
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-box {
        padding: 20px;
    }
    
    .stat-icon {
        width: 56px;
        height: 56px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}

