/* ============================================================
   THEME SETTINGS — EDIT EVERYTHING IMPORTANT HERE
   ============================================================ */
:root {
    /* Layout */
    --max-width: 1600px;
    --content-padding: 2rem;
    --header-height: 60px;

    /* Colors */
    --color-bg: #f2f2f2;
    --color-surface: #ffffff;
    --color1: #333; /* default body text */
    --color2: #666; /* muted */
    --color3: #0078ff; /* accent */
    --color4: #fff; /* inverse / light text */


    /* Buttons */
    --btn-primary-bg: #0078ff;
    --btn-primary-hover: #0069db;
    --btn-secondary-bg: #555;

    /* Header + Footer */
    --color-header-bg: #222;
    --color-header-text: #fff;
    --color-footer-bg: #222;
    --color-footer-text: #fff;
    --main-gap: 1rem;

    /* Borders + Shadows */
    --color-border: rgba(0,0,0,0.15);
    --color-shadow: rgba(0,0,0,0.08);
}

/* ============================================================
   BASE LAYOUT (Sticky Header + Sticky Footer)
   ============================================================ */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

/* Sticky header that NEVER disappears */
header {
    position: fixed;                 /* always on screen */
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;

    background: var(--color-header-bg);
    color: var(--color-header-text);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

/* Sticky footer (bottom of page OR screen) */
footer {
    flex-shrink: 0;
    text-align: center;
    padding: 1rem;
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
}

/* Main content area */
main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--max-width);
    min-width: 0;
    margin: calc(var(--header-height) + var(--main-gap)) auto var(--main-gap) auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px var(--color-shadow);
    box-sizing: border-box;
    overflow-x: hidden;
}

.content {
    padding: var(--content-padding);
    box-sizing: border-box;
}

/* ============================================================
   HEADER INNER LAYOUT
   ============================================================ */
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding h1 {
    margin: 0;
    font-size: 1.5rem;
}

.site-branding img {
    height: 40px;
    width: auto;
    display: block;
}

a,
a:visited {
    color: var(--color-accent);
}



/* ============================================================
   TEXT COLOR HANDLER
   ============================================================ */
.color1 { color: var(--color1); }
.color2 { color: var(--color2); }
.color3 { color: var(--color3); }
.color4 { color: var(--color4); }



/* ============================================================
   HERO SECTION (HOMEPAGE FORMATTING)
   ============================================================ */
.hero {
    text-align: center;
    max-width: 800px;
    padding: 3rem 1rem;
    margin: 0 auto;
}

/* ============================================================
   BUTTONS (Theme‑Driven)
   ============================================================ */
.primary-btn,
.secondary-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    color: white;
}

.primary-btn {
    background: var(--btn-primary-bg);
}

.primary-btn:hover {
    background: var(--btn-primary-hover);
}

.secondary-btn {
    background: var(--btn-secondary-bg);
}

.secondary-btn:hover {
    opacity: 0.85;
}



/* ============================================================
   FORM BUILDER
   ============================================================ */
/* Builder layout */
#builder {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 700px;
}

/* Field editor block */
.field-editor {
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  background: #f9f9f9;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Labels + inputs */
.field-editor label {
  font-weight: bold;
  margin-bottom: 4px;
}

.field-editor input,
.field-editor select {
  padding: 6px;
  width: 100%;
  box-sizing: border-box;
}

/* Options area */
.options-area {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Option rows */
.options-area div {
  display: flex;
  gap: 10px;
  align-items: center;
}

.options-area input {
  flex: 1;
}

/* Button rows */
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: #0078ff;
  color: white;
  cursor: pointer;
}

button:hover {
  background: #005fcc;
}

/* Danger button */
button.remove {
  background: #d9534f;
}

button.remove:hover {
  background: #c9302c;
}


.option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  word-wrap: break-word;
}



/* ============================================================
   FORMS
   ============================================================ */
button, input, select {
    padding: 0.5rem;
    margin: 0.5rem 0;
    width: 100%;
}


/* Form wrapper */
.generated-form {
    display: flex;
    flex-direction: column;
    gap: 16px; /* consistent spacing between fields */
    width: 100%;
}

/* Label spacing */
.generated-form label {
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

/* Inputs, selects, textarea */
.generated-form input[type="text"],
.generated-form input[type="email"],
.generated-form input[type="number"],
.generated-form input[type="tel"],
.generated-form input[type="date"],
.generated-form input[type="time"],
.generated-form select,
.generated-form textarea {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* Textarea sizing */
.generated-form textarea {
    min-height: 100px;
    resize: vertical;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 4px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Override global input rule ONLY for checkboxes */
.checkbox-row input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
}

/* Submit button */
.generated-form button[type="submit"] {
    width: auto;
    padding: 0.6rem 1rem;
    align-self: flex-start;
}


.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.option-label,
.option-value {
  width: 100%;
  padding: 6px;
  box-sizing: border-box;
  word-wrap: break-word;
}



/* ============================
   UNIVERSAL VIEWER STYLES
   ============================ */

.entry {
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 15px;
  overflow: hidden;
}

.entry-header {
  background: #f5f5f5;
  padding: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.entry-header:hover {
  background: #e9e9e9;
}

.entry-content {
  padding: 10px 15px;
}

.entry-table {
  width: 100%;
  border-collapse: collapse;
}

.entry-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #eee;
}



/* ============================================================
   IMAGE + TEXT ROW
   ============================================================ */
.image-row {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    align-items: center;
}

.image-row img {
    width: 200px;
    height: auto;
    border-radius: 6px;
}

.image-row p {
    flex: 1;
}



/* ============================================================
   IMAGE SIZE UTILITIES
   ============================================================ */
.img-small { width: 150px; }
.img-medium { width: 300px; }
.img-large { width: 500px; }
.img-full { width: 100%; }

.img-small,
.img-medium,
.img-large,
.img-full {
    margin: 0.5rem;
    display: inline-block;
    vertical-align: top;
}




/* ============================================================
   IMAGE GRIDS
   ============================================================ */
.image-grid-2,
.image-grid-3 {
    display: grid;
    gap: 1rem;
    width: 100%;
}

.image-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.image-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.image-grid-2 img,
.image-grid-3 img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.img-col {
    text-align: center;
}

.image-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    width: 100%;
}

.image-grid-4 img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.img-caption {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--color2);
}




/* ============================================================
   VIDEOS
   ============================================================ */

/* Local video files */
.video {
    width: 100%;
    max-width: 1600px;
    border-radius: 8px;
    margin: 1rem 0;
    display: block;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}



/* ============================================================
   VIDEO SIZE UTILITIES
   ============================================================ */

.video-small {
    width: 200px;
    max-width: 100%;
}

.video-medium {
    width: 400px;
    max-width: 100%;
}

.video-large {
    width: 800px;
    max-width: 100%;
}

.video-full {
    width: 100%;
    max-width: 1600px;
}



/* ============================================================
   TABLES
   ============================================================ */
.table-scroll {
    width: 100%;
    overflow-x: auto;   /* enables horizontal scroll */
    overflow-y: hidden; /* optional: prevents vertical scrollbars */
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.styled-table th,
.styled-table td {
    border: 1px solid var(--color-border);
    padding: 0.6rem;
    text-align: left;
}

.styled-table th {
    background: #eee;
}



/* =========================
   HEADER
   ========================= */
/* Base header layout */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-header-bg);
    color: var(--color-header-text);
    display: flex;
    align-items: center;
    z-index: 9999;
}

.header-inner {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.header-username {
    margin-left: auto;
    margin-right: 3rem;
    white-space: nowrap;
}

/* Right side */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Desktop nav */
nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: var(--color-header-text);
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

/* Hide checkbox always */
.nav-toggle {
    display: none;
}

/* Hide hamburger on desktop */
.hamburger {
    display: none;
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 800px) {

    .header-inner {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }

    .header-left {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .header-username {
        margin-left: auto;
        margin-right: 1rem;
        font-size: 0.9rem;
    }

    /* Show hamburger on mobile */
    .hamburger {
        display: block;
        font-size: 2rem;
        cursor: pointer;
        user-select: none;
        color: var(--color-header-text);
    }

    /* Mobile nav: hidden by default, full-width dropdown */
    nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--color-header-bg);
        border-top: 1px solid var(--color-border);
        padding: 1rem;
        display: none;
        flex-direction: column;
        gap: 0.5rem;
    }

    nav a {
        width: 100%;
    }

    /* KEY: this is the correct selector for your HTML */
    .nav-toggle:checked + .hamburger + nav {
        display: flex;
    }
}



/* ============================================================
   RESPONSIVE FOOTER FIX
   ============================================================ */

footer {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    padding: 1rem 0.5rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
