/* ==========================================================================
   WIZUALNY EDYTOR CV - DEDYKOWANE STYLE CSS (VANILLA CSS)
   ========================================================================== */

:root {
    /* UI Dark Theme Variables */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-hover: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-indigo: #6366f1;
    --accent-emerald: #10b981;
    --danger-red: #ef4444;

    /* Dynamic CV Colors (updated via JS) */
    --cv-glowny: #1A365D;
    --cv-akcent: #2B6CB0;
    --cv-tekst-ciemny: #2D3748;
    --cv-tekst-jasny: #FFFFFF;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   HEADER BAR
   ========================================================================== */
.app-header {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.brand-icon {
    font-size: 1.8rem;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
    padding: 0.6rem;
    border-radius: 10px;
}

.brand h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand h1 span {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

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

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #475569;
    border-color: #64748b;
}

.btn-danger-soft {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-soft:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-add {
    width: 100%;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border: 1px dashed var(--accent-blue);
    padding: 0.6rem;
    margin-top: 0.5rem;
}

.btn-add:hover {
    background: rgba(59, 130, 246, 0.2);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
}

/* ==========================================================================
   MAIN LAYOUT (SPLIT VIEW)
   ========================================================================== */
.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 65px);
    overflow: hidden;
}

/* LEWY PANEL - FORMULARZE */
.editor-sidebar {
    width: 480px;
    min-width: 420px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.5);
}

.editor-tab {
    flex: 1;
    padding: 0.9rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.editor-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    background: var(--bg-card);
}

.tab-pane {
    display: none;
    padding: 1.2rem;
    flex-direction: column;
    gap: 0.8rem;
}

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

/* ACCORDION COMPONENTS */
.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.4);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.accordion-item:hover {
    border-color: var(--border-hover);
}

.accordion-header {
    padding: 0.9rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

.accordion-header span i {
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

.acc-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.accordion-item.expanded .acc-icon {
    transform: rotate(180deg);
}

.accordion-body {
    display: none;
    padding: 1.1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.accordion-item.expanded .accordion-body {
    display: block;
}

/* FORM ELEMENTS */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: flex;
    gap: 0.8rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* DYNAMIC ENTRY CARDS (DOŚWIADCZENIE / EDUKACJA) */
.dynamic-item-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem;
    margin-bottom: 0.8rem;
    position: relative;
}

.btn-remove-item {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.btn-remove-item:hover {
    color: var(--danger-red);
}

/* SKILLS TAGS */
.skills-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.skill-tag {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.skill-tag i {
    cursor: pointer;
}

.skill-tag i:hover {
    color: var(--danger-red);
}

.skills-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

/* PHOTO UPLOAD */
.photo-upload-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.photo-preview-box {
    width: 80px;
    height: 95px;
    border-radius: 6px;
    border: 2px dashed var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    flex-shrink: 0;
}

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

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.photo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.help-text {
    font-size: 0.73rem;
    color: var(--text-muted);
}

/* THEMES & COLORS TAB */
.style-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.style-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.theme-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.theme-preset {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.6rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-preset:hover {
    border-color: var(--accent-blue);
}

.theme-preset.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.theme-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-picker-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
}

.color-picker-group label {
    font-size: 0.84rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* ==========================================================================
   PRAWA STRONA - STAGE PODGLĄDU NA ŻYWO (LIVE PREVIEW)
   ========================================================================== */
.preview-stage {
    flex: 1;
    background: #090d16;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem;
    align-items: center;
}

.preview-toolbar {
    width: 100%;
    max-width: 760px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.preview-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.blink {
    font-size: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.cv-sheet-wrapper {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

/* KARTA CV ODZWIERCIEDLAJĄCA PLIK A4 (595px x 842px) */
.cv-sheet {
    width: 595px;
    min-height: 842px;
    background: #ffffff;
    display: flex;
    position: relative;
    box-sizing: border-box;
    color: var(--cv-tekst-ciemny);
    font-size: 11px;
    line-height: 1.4;
}

/* LEWY PASEK CV */
.cv-sidebar {
    width: 190px;
    background-color: var(--cv-glowny);
    color: var(--cv-tekst-jasny);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
}

.cv-photo-area {
    width: 120px;
    height: 140px;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-photo-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv-left-title {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.3rem;
    color: var(--cv-tekst-jasny);
}

.cv-contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 10px;
    word-break: break-word;
}

.cv-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.cv-contact-item i {
    width: 12px;
    font-size: 10px;
    margin-top: 2px;
    opacity: 0.8;
}

.cv-left-skills {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 10px;
}

.cv-left-skills li {
    position: relative;
    padding-left: 0.8rem;
}

.cv-left-skills li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--cv-akcent);
}

/* PRAWY KONTENT GŁÓWNY CV */
.cv-main {
    flex: 1;
    padding: 2.2rem 1.8rem 1.8rem 1.8rem;
    display: flex;
    flex-direction: column;
}

.cv-header-group h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--cv-glowny);
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.cv-job-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--cv-akcent);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.cv-divider {
    height: 1px;
    background-color: var(--cv-akcent);
    margin: 10px 0 16px 0;
}

.cv-section {
    margin-bottom: 14px;
}

.cv-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--cv-glowny);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.cv-text {
    font-size: 10px;
    color: var(--cv-tekst-ciemny);
    white-space: pre-line;
}

.cv-item {
    margin-bottom: 10px;
}

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.cv-item-title {
    font-weight: 700;
    font-size: 10.5px;
    color: var(--cv-tekst-ciemny);
}

.cv-item-date {
    font-style: italic;
    font-size: 9.5px;
    color: #64748b;
}

.cv-item-subtitle {
    font-size: 9.5px;
    color: #475569;
    margin-bottom: 2px;
}

.cv-item-desc {
    font-size: 9.5px;
    color: var(--cv-tekst-ciemny);
    white-space: pre-line;
    line-height: 1.35;
}

.cv-rodo-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.cv-rodo-footer p {
    font-size: 7.5px;
    color: #718096;
    line-height: 1.2;
}

/* TOAST NOTIFICATION */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    color: var(--text-primary);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-size: 0.88rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
