@import url('https://fonts.googleapis.com/css2?family=David+Libre:wght@700&display=swap');

:root {
    --bg-color-desktop: rgba(193, 210, 224, 1);
    --bg-color-mobile: #CBE7DC;
    --font-main: 'David Libre', serif;
}

body {
    background-color: var(--bg-color-desktop);
    font-family: var(--font-main);
    color: black;
    margin: 0;
    padding: 20px;
    direction: rtl;
    /* Hebrew default */
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    /* Sidebar and Main Content side-by-side */
    gap: 30px;
    align-items: stretch;
    /* Stretch columns to full height */
}

/* Mobile Background */
@media (max-width: 768px) {
    body {
        background-color: var(--bg-color-mobile);
        padding: 10px;
        flex-direction: column;
        /* Stack vertically on mobile */
    }

    .sidebar {
        width: 100% !important;
        /* Full width on mobile */
        margin-top: 10px !important;
        /* Reset top margin (Back button is static) */
        max-width: none !important;
    }

    .main-content {
        width: 100% !important;
        margin-top: 20px;
    }
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-main);
    font-weight: 700;
    color: black;
    margin-bottom: 1em;
    text-shadow: none !important;
    /* Remove dropshadow as requested */
}

/* Layout Containers */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.6);
    /* Semi-transparent white to show bg */
    border: 2px solid black;
    padding: 30px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
}

.sidebar {
    background: #FBFBFB !important;
    border: 2px solid black !important;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2) !important;
    font-family: var(--font-main) !important;
    padding: 25px !important;
    /* Uniform padding */
    margin-top: 70px !important;
    /* Push down to clear the Back Button */
}

.main-content {
    font-family: var(--font-main) !important;
    flex-grow: 1;
    /* Allow expansion */
    width: auto;
    height: auto;
    min-height: 500px;
    /* Minimum height for preview */
    display: flex;
    flex-direction: column;
}

.main-content iframe {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    min-height: 600px;
    /* Ensure tall preview */
    background: white;
    border: 2px solid black;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
}

/* Buttons & Inputs (Building Style) */
button,
.action-btn,
.file-input-label,
select,
input[type="text"],
input[type="number"],
input[type="file"] {
    font-family: var(--font-main) !important;
    background: #FBFBFB;
    border: 1.5px solid black;
    color: black;
    font-size: 18px;
    padding: 12px 15px !important;
    /* Consistent padding for all inputs */
    box-shadow: 2px 3px 0px rgba(0, 0, 0, 0.49);
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s;
    outline: none;
    border-radius: 0 !important;
    /* Sharp edges for raw building look, or keep slight radius if preferred */
    text-shadow: none !important;
    /* Ensure no shadow on button text */
    box-sizing: border-box;
}

button:hover,
.action-btn:hover {
    transform: scale(1.02);
    background-color: #fdfde0;
}

/* Helper for initially hidden buttons (like Download) */
.download-btn {
    display: none;
    /* Hidden by default, shown via JS */
    background-color: #e8f5e9;
    /* Optional: light green tint for download */
    margin-top: 15px;
    /* Ensure uniform spacing when visible */
}

input:focus,
select:focus {
    background-color: #fff;
    border-color: #333;
}

/* Back Button */
.back-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    /* Moved back to RIGHT */
    left: auto;
    background: #FBFBFB;
    border: 1.5px solid black;
    color: black;
    text-decoration: none;
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 18px;
    box-shadow: 2px 3px 0px rgba(0, 0, 0, 0.49);
    z-index: 1000;
}

.back-btn:hover {
    transform: scale(1.02);
    background-color: #fdfde0;
}

@media (max-width: 768px) {
    .back-btn {
        position: static;
        display: inline-block;
        margin-bottom: 20px;
    }

    .container {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* --- Help / Instructions Feature --- */

/* Help Button (?) */
.help-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    /* Positioned Top-Left */
    width: 40px;
    height: 40px;
    background: #FBFBFB;
    border: 1.5px solid black;
    border-radius: 50% !important;
    /* Circle */
    font-family: var(--font-main);
    font-size: 20px;
    font-weight: bold;
    color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 2px 3px 0px rgba(0, 0, 0, 0.49);
    z-index: 1000;
    transition: transform 0.1s ease, background-color 0.2s;
    outline: none;
    padding: 0 !important;
    /* Reset padding for circle */
}

.help-btn:hover {
    transform: scale(1.1);
    background-color: #fdfde0;
}

/* Modal Overlay */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

/* Modal Content Card */
.modal-content {
    background-color: #FBFBFB;
    margin: auto;
    padding: 30px;
    border: 2px solid black;
    width: 90%;
    max-width: 600px;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.4);
    position: relative;
    direction: rtl;
    text-align: right;
    font-family: var(--font-main);
}

/* Modal Close Button (X) */
.close-modal {
    color: #aaa;
    float: left;
    /* Left side for RTL */
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h3 {
    margin-top: 0;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
}

.modal-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: bold;
}

.modal-content ul {
    list-style-type: disc;
    padding-right: 20px;
}

.modal-content li {
    margin-bottom: 5px;
}