/* ** THE FIX: Using your self-hosted Mehr Nastaliq font ** */
@font-face {
    font-family: 'Mehr Nastaliq Web';
    src: url('https://srv1491-files.hstgr.io/aad553525a8180a7/files/public_html/Mehr_Nastaliq_Web%20v.2.0.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- Base & Modern UI Styles --- */
:root {
    --primary-green: #004d40;
    --darker-green: #00382e;
    --background-color: #f4f7f9;
    --card-background: #ffffff;
    --text-color: #333;
    --border-color: #dde2e7;
}

body {
    font-family: sans-serif; /* A basic default font */
    background-color: var(--background-color);
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.app-container {
    display: flex; flex-direction: column; gap: 30px; width: 100%;
    max-width: 1500px; margin: 0 auto;
}

/* --- Controls Panel Styling --- */
.controls {
    background-color: var(--card-background); padding: 25px 30px; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); border: 1px solid var(--border-color);
}
.controls h1 { margin-top: 0; color: var(--primary-green); font-size: 28px; }
.controls p { margin-bottom: 30px; color: #666; }
.control-group { margin-bottom: 25px; }
.control-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-color); }
.control-group input, .control-group textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px;
    box-sizing: border-box; font-size: 16px; transition: box-shadow 0.2s, border-color 0.2s;
}
.control-group input:focus, .control-group textarea:focus {
    outline: none; border-color: var(--primary-green); box-shadow: 0 0 0 3px rgba(0, 77, 64, 0.1);
}
.control-group textarea { 
    /* Use the new font */
    font-family: 'Mehr Nastaliq Web', serif; 
    font-size: 22px; 
    direction: rtl; 
}
#generateBtn {
    width: 100%; padding: 15px; background-color: var(--primary-green); color: white; border: none;
    border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}
#generateBtn:hover { background-color: var(--darker-green); transform: translateY(-2px); }

/* --- Preview Area --- */
.preview-area {
    display: flex; justify-content: center; align-items: flex-start;
}
#post-preview-wrapper {
    width: 100%; max-width: 800px; aspect-ratio: 1 / 1;
}
#post-preview {
    width: 1080px; height: 1080px; transform-origin: top left;
    background-color: white; display: flex; flex-direction: column;
}

/* --- POST STYLES --- */
.header-section {
    background-color: var(--primary-green); padding: 40px 60px; display: flex;
    justify-content: space-between; align-items: center; flex-shrink: 0;
}
.press-release-tag, .date-placeholder {
    font-family: sans-serif; /* Basic sans-serif for these elements */
    background-color: white; color: var(--primary-green);
    font-weight: 700; padding: 12px 30px; border-radius: 30px; font-size: 24px;
}
.press-release-tag { padding: 12px 24px; font-size: 22px; }

.main-content {
    flex-grow: 1; padding: 0 80px; background: linear-gradient(to bottom, var(--primary-green) 16%, white 16%);
    overflow: hidden; display: grid; grid-template-rows: 432px 1fr; 
    gap: 45px; padding-bottom: 25px;
}
.image-placeholder {
    width: 100%; height: 100%; box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.4); position: relative;
}
.image-placeholder::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 25px;
    background-image: linear-gradient(45deg, white 50%, transparent 50%), 
                      linear-gradient(-45deg, white 50%, transparent 50%);
    background-size: 20px 20px; background-repeat: repeat-x; background-position: 0 100%;
}
#uploaded-image-preview {
    width: 100%; height: 100%; object-fit: cover; object-position: center;
    border: 4px solid white; box-sizing: border-box;
}
.text-placeholder {
    /* Use the new font */
    font-family: 'Mehr Nastaliq Web', serif; 
    color: #333; direction: rtl; line-height: 1.7; text-align: right;
    display: flex; align-items: center; overflow: hidden;
}
#main-text-preview { width: 100%; }
.footer-section {
    flex-shrink: 0; padding: 0 80px 40px 80px;
}
.footer-section img { width: 100%; display: block; }

/* --- Loader Styles --- */
#loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    color: white; font-size: 20px;
    transition: opacity 0.3s;
}
#loader.loader-hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3); border-top: 4px solid white;
    border-radius: 50%; width: 40px; height: 40px;
    animation: spin 1s linear infinite; margin: 0 auto 15px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Responsive Desktop Layout --- */
@media (min-width: 992px) {
    .app-container { flex-direction: row; align-items: flex-start; }
    .controls { flex: 1; max-width: 400px; position: sticky; top: 20px; }
    .preview-area { flex: 2; }
}