:root { 
    --brand: #ff0000; 
    --accent-blue: #0056b3;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1c1e21;
    --sep: #e0e0e0;
    --news-font: 'Hind Madurai', 'Segoe UI', sans-serif;
}

body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    margin: 0; background: var(--bg); color: var(--text); 
    display: flex; height: 100vh; overflow: hidden;
}

/* Sidebar & Tabs */
.sidebar { 
    width: 400px; background: var(--card); display: flex; flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1); z-index: 20;
}
.brand-header { padding: 20px 20px 10px 20px; text-align: center; position: relative; }
.brand-header h1 { margin: 0; color: var(--brand); font-size: 24px; letter-spacing: 1px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.brand-header p { margin: 2px 0 0 0; font-size: 11px; text-transform: uppercase; color: #65676b; font-weight: bold; letter-spacing: 2px; }

.history-controls { display: flex; gap: 10px; padding: 0 20px 15px; border-bottom: 1px solid #eee; }
.btn-hist { 
    flex: 1; padding: 8px; font-size: 11px; background: #f0f2f5; 
    border: 1px solid #ddd; border-radius: 6px; cursor: pointer; 
    font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: all 0.2s;
}
.btn-hist:hover:not(:disabled) { background: #e4e6eb; }
.btn-hist:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-hist svg { width: 14px; height: 14px; fill: currentColor; }

.tabs { display: flex; border-bottom: 1px solid #ddd; background: #fcfcfc; }
.tab-btn { flex: 1; padding: 14px; border: none; background: none; cursor: pointer; font-weight: bold; color: #65676b; border-bottom: 3px solid transparent; transition: 0.3s; }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); background: white; }

.tab-content { padding: 20px; overflow-y: auto; flex-grow: 1; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Form Styling */
.section-title { font-size: 12px; color: var(--brand); text-transform: uppercase; font-weight: 800; margin-bottom: 15px; border-left: 3px solid var(--brand); padding-left: 8px; }
.input-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #444; }

.slider-card { background: #f8f9fa; padding: 15px; border-radius: 10px; border: 1px solid #eee; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; background: #dfe3e8; border-radius: 10px; outline: none; margin: 10px 0; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; background: var(--brand); border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* Preview Area */
.preview-pane { flex-grow: 1; display: flex; justify-content: center; align-items: center; background: #cbd5e0; padding: 20px; position: relative; overflow: hidden; touch-action: none; }
#scale-wrapper { transform-origin: center; transition: transform 0.05s linear; will-change: transform; display: flex; align-items: center; justify-content: center; }

#poster-canvas {
    width: 800px; height: 800px; background: #fff; position: relative; 
    overflow: hidden; box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    font-family: var(--news-font);
}

.paper-texture { position: absolute; inset: 0; opacity: 0.05; pointer-events: none; z-index: 2; background-image: url("https://www.transparenttextures.com/patterns/graphy.png"); }
#bg-layer { position: absolute; inset: 0; width: 800px; height: 800px; object-fit: fill; z-index: 1; }
.dot-design{ width: 10px; height: 10px; background-color: white; border-radius: 50%; position: absolute; top: 72px; left:250px; z-index: 1; }

.top-separator { position: absolute; top: 115px; left: 30px; right: 30px; height: 1px; background: var(--sep); z-index: 5; }
.meta-bar {
    position: absolute; top: 115px; left: 30px; right: 30px; height: 50px;
    display: flex; justify-content: space-between; align-items: center;
    z-index: 6; font-weight: 700; font-size: 20px; color: #222;
}
.meta-item { display: flex; align-items: center; gap: 8px; }
.meta-icon { width: 20px; height: 20px; fill: var(--brand); }

.blue-line { position: absolute; top: 155px; left: 30px; right: 30px; height: 2px; background: rgb(19, 36, 133); z-index: 6; }
.bottom-separator { position: absolute; bottom: 75px; left: 30px; right: 30px; height: 1px; background: var(--sep); z-index: 5; }

.content-frame {
    position: absolute; top: 165px; bottom: 90px; left: 30px; right: 30px;
    border: 1px solid rgba(0,0,0,0.08); border-radius: 8px; pointer-events: none; z-index: 3;
    background: rgba(255,255,255,0.2);
}

.main-content-area {
    position: absolute; top: 170px; width: 720px; height: 540px; left: 40px;
    display: flex; flex-direction: column; align-items: center; z-index: 4;
}

.dyn-img-box { width: 100%; overflow: hidden; cursor: grab; display: flex; justify-content: center; border-radius: 4px; touch-action: none; }
#view-img { position: relative; transform-origin: center; }
.divider-line { width: 95%; height: 2px; background: var(--brand); margin: 15px 0; display: none; }
.text-wrap { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; overflow: hidden; width: 100%; }
.dyn-text { font-weight: 700; color: #000; width: 100%; word-wrap: break-word; letter-spacing: -0.5px; outline: none; border: 1px dashed transparent; font-size: 32px; }
.dyn-text:focus { border-color: #ccc; background: rgba(0,0,0,0.02); }

.footer-container { 
    position: absolute; bottom: 0; width: 100%; height: 75px; 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 45px; box-sizing: border-box; z-index: 5; 
}
.footer-left, .footer-right { color: white; font-weight: 700; font-size: 19px; width: 35%; text-align: center; line-height: 1.2; outline: none; }

.btn-stack { padding: 20px; background: white; border-top: 1px solid #eee; display: flex; gap: 10px; }
.btn { flex: 1; padding: 10px; border-radius: 12px; border: none; font-weight: 700; cursor: pointer; transition: 0.2s; font-size: 13px; }
.btn-save { background: var(--brand); color: white; box-shadow: 0 4px 12px rgba(255,0,0,0.2); }
.btn-reset { background: #f0f2f5; color: #444; }
.btn:active { transform: scale(0.98); }

[contenteditable="true"] { pointer-events: auto !important; cursor: text; }

/* Mobile Responsiveness Updates */
@media (max-width: 900px) {
    body { flex-direction: column; overflow: hidden; height: 100vh; }
    
    /* Fixed Header for Mobile */
    .brand-header { 
        position: fixed; top: 0; left: 0; right: 0; height: 60px; 
        background: white; z-index: 100; display: flex; align-items: center; 
        justify-content: space-between; padding: 0 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .brand-header img { width: 140px !important; margin: 0; }
    .brand-header p { display: none; }

    /* Horizontal History + Download in Header */
    .sidebar .history-controls { display: none; }
    .mobile-header-controls {
        display: flex !important; align-items: center; gap: 8px;
    }
    .mobile-header-controls .btn-hist { padding: 6px; width: 35px; height: 35px; min-width: 35px; flex: none; border-radius: 50%; }
    .mobile-header-controls .btn-hist span { display: none; }
    .mobile-header-controls .btn-save-mini { 
        background: var(--brand); color: white; border: none; border-radius: 50%; 
        width: 35px; height: 35px; display: flex; align-items: center; justify-content: center;
        cursor: pointer;
    }
    .mobile-header-controls svg { width: 18px; height: 18px; fill: currentColor; }

    /* Sticky Preview Panel - FIXED SIZE AS REQUESTED */
    .preview-pane { 
        position: fixed; top: 60px; left: 0; right: 0; height: 40vh; 
        background: #2d3436; z-index: 90; padding: 0; 
        overflow: hidden; 
    }

    /* Scrollable Sidebar/Editor Area */
    .sidebar { 
        position: fixed; top: calc(40vh + 60px); bottom: 0; left: 0; right: 0; 
        width: 100%; height: auto; overflow-y: auto; background: white; 
        z-index: 80; display: block;
    }
    .tab-content { overflow-y: visible; padding-bottom: 20px; }

    /* Hide Bottom Buttons */
    .btn-stack { display: none !important; }
}


.mobile-header-controls { display: none; }
