:root {
    --ui-bg: #f5f5f5;
    --ui-surface: white;
    --ui-border: #03251f;
    --ui-text: #222;
    --ui-btn-primary-bg: #03251f;
    --ui-btn-primary-text: #F2E9A6;
    --ui-btn-primary-border: #03251f;
    --ui-btn-secondary-bg: transparent;
    --ui-btn-secondary-border: #0d1f16;
    --ui-btn-secondary-text: #0d1f16;
    --ui-danger-bg: #800000;
    --ui-danger-text: white;
    --ui-title-color: #03251f;

    --brand-main: #F2E9A6;
    --brand-bold: #D4AF37;
    --brand-accent: #D9FFB3; 
    --brand-slide-bg: #0d1f16;
    --font-title: 'Belleza', sans-serif;
    --font-body: 'Red Hat Display', sans-serif;
}

body { 
    font-family: var(--font-body);
    background-color: var(--ui-bg); 
    color: var(--ui-text); 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    padding: 20px; 
    transition: 0.5s; 
    scroll-behavior: smooth;
}

.container { 
    max-width: 1000px;
    width: 100%; 
}

#backToTop { 
    position: fixed;
    bottom: 30px; 
    right: 30px; 
    background: var(--ui-btn-primary-bg);
    color: var(--ui-btn-primary-text); 
    border: 2px solid var(--ui-border); 
    border-radius: 50%; 
    width: 50px; 
    height: 50px; 
    cursor: pointer;
    display: none; 
    z-index: 1000; 
    font-size: 24px;
    font-weight: bold; 
}

.brand-badge-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ui-surface);
    padding: 8px 24px;
    border-radius: 50px;
    border: 1px solid var(--ui-border);
    width: fit-content;
    margin: 0 auto 30px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.brand-badge-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}
.brand-badge-name {
    font-family: var(--font-title);
    font-weight: bold;
    font-size: 18px;
    color: var(--ui-title-color);
}

.editor-box { 
    background: var(--ui-surface);
    padding: 20px; 
    border-radius: 15px; 
    border: 1px solid var(--ui-border);
    margin-bottom: 20px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.engine-selector { 
    display: flex;
    gap: 10px; 
    margin-bottom: 15px; 
    background: rgba(0,0,0,0.05); 
    padding: 8px; 
    border-radius: 50px; 
    border: 1px solid var(--ui-border); 
    width: fit-content;
}
.engine-btn { 
    padding: 8px 20px;
    border-radius: 30px; 
    border: none; 
    cursor: pointer;
    font-weight: bold; 
    transition: 0.3s; 
    color: var(--ui-text); 
    background: transparent; 
    font-family: var(--font-body);
}
.engine-btn.active { 
    background: var(--ui-btn-primary-bg);
    color: var(--ui-btn-primary-text); 
}

textarea { 
    width: 100%;
    height: 500px; 
    background: var(--ui-surface); 
    border: 1px solid var(--ui-border); 
    color: var(--ui-text); 
    padding: 15px;
    border-radius: var(--ui-panel-radius); 
    margin-bottom: 10px; 
    box-sizing: border-box; 
    resize: vertical;
    line-height: 1.5; 
    font-family: var(--font-body); 
}
input[type="text"] { 
    font-family: var(--font-body);
    width: 100%; 
    padding: 12px; 
    background: var(--ui-surface); 
    color: var(--ui-text); 
    border: 1px solid var(--ui-border); 
    border-radius: var(--ui-panel-radius); 
    box-sizing: border-box;
}
#customPreHook { 
    margin-bottom: 10px;
    display: block; 
}

.btn-group { 
    display: flex;
    gap: 10px; 
    flex-wrap: wrap;
}
.btn { 
    padding: 15px;
    border-radius: 8px; 
    border: none; 
    font-weight: bold; 
    cursor: pointer;
    flex: 1; 
    min-width: 200px; 
    transition: 0.3s;
}
.btn:hover { 
    opacity: 0.9;
}
.btn-ai { 
    background: var(--ui-btn-secondary-bg);
    border: 1px solid var(--ui-btn-secondary-border); 
    color: var(--ui-btn-secondary-text);
}
.btn-gen { 
    background: var(--ui-btn-primary-bg);
    color: var(--ui-btn-primary-text);
    border: 1px solid var(--ui-btn-primary-border);
}
.btn-fb { 
    background: #1877F2;
    color: white;
}
.btn-img-gen { 
    background: var(--ui-btn-primary-bg);
    color: var(--ui-btn-primary-text); 
    border: none; 
    margin-left: 10px;
    padding: 15px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold;
} 
.btn-zip { 
    background: transparent;
    border: 2px dashed var(--ui-btn-primary-bg); 
    color: var(--ui-btn-primary-bg); 
    margin-top: 15px; 
    width: 100%; 
    font-size: 16px;
}
.btn-zip:hover { 
    background: rgba(0,0,0,0.02);
}

.btn-scale-img {
    background-color: var(--ui-danger-bg);
    color: var(--ui-danger-text);
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    margin-right: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: 0.2s;
}
.btn-scale-img:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.idea-card { 
    background: var(--ui-surface);
    border: 1px solid var(--ui-border); 
    padding: 15px; 
    border-radius: 10px; 
    margin-bottom: 12px; 
    text-align: left;
}
#ideationBox { 
    border: 2px solid var(--ui-border);
}
.idea-hook { 
    font-family: var(--font-title);
    font-size: 20px; 
    color: var(--ui-title-color); 
    margin-bottom: 8px; 
    line-height: 1.2;
}
.idea-direction { 
    font-size: 14px;
    color: var(--ui-text); 
    margin-bottom: 12px; 
    line-height: 1.4;
    opacity: 0.85;
}
.btn-use-idea { 
    background: var(--ui-btn-primary-bg);
    color: var(--ui-btn-primary-text); 
    border: none; 
    padding: 8px 15px;
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold; 
    font-family: var(--font-body); 
    transition: 0.2s;
}
.btn-use-idea:hover { 
    transform: scale(1.02);
}

.slide { 
    width: 500px;
    height: 625px; 
    background-size: cover; 
    background-position: center; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    padding: 45px; 
    box-sizing: border-box; 
    margin-bottom: 15px; 
    overflow: hidden;
}

.logo-wrapper { 
    position: absolute;
    top: 25px; 
    right: 25px;
    z-index: 20; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}
.logo-img { 
    width: 140px;
    height: auto; 
}

.slide-title { 
    font-family: var(--font-title);
    color: var(--brand-main); 
    font-size: 28px; 
    line-height: 1.3; 
    z-index: 5;
    width: 96%; 
    box-sizing: border-box; 
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.slide-body { 
    font-family: var(--font-body);
    color: var(--brand-accent); 
    font-size: 17px;
    line-height: 1.4; 
    white-space: pre-wrap; 
    z-index: 5;
    width: 84%; 
}

.generated-image-placeholder { 
    display: flex;
    align-items: center; 
    justify-content: center; 
    width: 100%; 
    border: 2px dashed rgba(255,255,255,0.3); 
    border-radius: 15px; 
    color: rgba(255,255,255,0.5); 
    font-style: italic; 
    z-index: 1; 
    text-align: center;
    padding: 10px; 
    box-sizing: border-box; 
}
.generated-image-result { 
    display: block;
    margin: 0 auto;
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
    z-index: 1; 
    transition: transform 0.2s; 
    transform-origin: bottom center;
    transform: scale(0.6);
}

.slide-number { 
    position: absolute;
    bottom: 30px; 
    right: 30px; 
    font-family: var(--font-title); 
    color: var(--brand-bold);
    font-size: 18px; 
    z-index: 20;
}
b { 
    color: var(--brand-bold) !important;
    font-weight: bold; 
}

.fb-post-preview { 
    width: 1080px;
    height: 1080px; 
    background-size: 100% 100%; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; 
    text-align: center; 
    box-sizing: border-box;
    padding: 0 80px; 
}
.fb-pre-hook { 
    font-family: var(--font-body);
    color: var(--brand-accent); 
    font-size: 45px;
    font-style: italic; 
    margin-top: 180px; 
    margin-bottom: 5px; 
    width: 950px;
}
.fb-hook-text { 
    font-family: var(--font-title);
    color: var(--brand-main); 
    font-size: 95px; 
    line-height: 1.1; 
    margin-top: 40px;
    width: 920px; 
    transition: 0.3s;
}
.fb-scale-wrapper { 
    transform: scale(0.45);
    transform-origin: top center;
    height: 500px; 
    width: 1080px; 
    margin: 0 auto;
}
.fb-text-box {
    width: 100%;
    max-width: 2000px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    padding: 25px;
    border-radius: 12px;
    white-space: pre-wrap;
    margin-top: 40px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    color: var(--ui-text);
}
#render-temp { 
    position: absolute;
    left: -9999px; 
    top: 0;
}

#fb-final-image {
    display: block !important;
    padding: 40px 40px !important;
    height: 1080px !important;
    text-align: center !important;
    position: relative !important;
    overflow: hidden !important;
    padding-bottom: 250px !important;
}

#fbHookContent {
    font-family: var(--font-title) !important;
    font-size: 75px !important;
    color: var(--brand-main) !important;
    background-color: var(--brand-slide-bg) !important;
    border-radius: 8px !important;
    padding: 30px !important;
    margin: 150px auto 20px auto !important;
    line-height: 1.1 !important;
    position: relative !important;
    display: inline-block !important;
    z-index: 99 !important;
    width: 85% !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#fb-unified-scaling-box img {
    transition: transform 0.2s;
    transform-origin: bottom center;
}
#password-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    z-index: 99999;
}
.login-banner {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}
#login-logo {
    height: 50px;
    width: auto;
}
.login-box {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}
.login-heading {
    font-family: var(--font-title);
    color: var(--ui-title-color);
    margin-bottom: 30px;
    font-size: 22px !important;
    text-align: center;
    background-color: #ffffff;
    border: 1px solid var(--ui-title-color);
    border-radius: 50px;
    padding: 15px 40px;
}
#password-input {
    padding: 15px 25px;
    border: 1px solid var(--ui-border);
    border-radius: 50px;
    width: 300px;
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    background: #ffffff; 
    color: #000000; 
}
#btn-login {
    width: 300px !important;
    height: 55px !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer;
    font-family: var(--font-title);
    font-weight: bold;
    font-size: 18px;
    margin: 0 !important;   
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s, opacity 0.2s;
}
#btn-login:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: #ffffff;
    color: #333333;
    border: 2px solid var(--ui-btn-primary-bg);
    padding: 20px 40px;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    text-align: center;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.error {
    border: 2px solid var(--ui-danger-bg);
}

/* Stylistyka Premium dla Archiwum Lokalnego */
.archive-section {
    margin-top: 60px;
    width: 100%;
    background: var(--ui-surface);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--ui-border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    text-align: center;
    box-sizing: border-box;
}
.archive-title {
    font-family: var(--font-title);
    color: var(--ui-title-color);
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 25px;
}
.archive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}
.archive-card {
    background-color: var(--brand-slide-bg);
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.archive-card:hover {
    transform: translateY(-2px);
}
.archive-card-title {
    font-family: var(--font-title);
    color: var(--brand-main);
    font-size: 19px;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 12px;
    word-break: break-word;
}
.archive-card-meta {
    font-family: var(--font-body);
    color: var(--brand-accent);
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 20px;
}
.btn-archive-download {
    background: transparent;
    border: 1px solid var(--brand-bold);
    color: var(--brand-bold);
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-family: var(--font-body);
    font-size: 14px;
    text-align: center;
    transition: 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.btn-archive-download:hover {
    background: var(--brand-bold);
    color: var(--brand-slide-bg);
}

/* PRZYCISK USUWANIA Z ARCHIWUM */
.btn-archive-delete {
    background: var(--ui-danger-bg);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: bold;
    font-family: var(--font-body);
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}
.btn-archive-delete:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }
}
/* --- KOREKTA ODSTĘPÓW GRAFIK --- */
[id^="content-flow-"] > img[id^="slide-img-"]:first-child,
[id^="content-flow-"] > div[id^="img-wrapper-"]:first-child {
    margin-bottom: -15px !important;
}

[id^="content-flow-"] > img[id^="slide-img-"]:last-child,
[id^="content-flow-"] > div[id^="img-wrapper-"]:last-child {
    margin-top: auto !important;
    max-height: 380px !important;
}
