/* Casa da Arvore — CDA Member Application Web Form Styles
 *
 * Forces light mode regardless of OS/browser dark mode preference.
 * Brand palette:
 *   Primary green:  #1E392A
 *   Warm off-white: #F5F5EF
 *   Gold/tan:       #DBCBB4
 *   Terracotta:     #966755
 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Montserrat:wght@300;400;500;600&display=swap');

/* ============================================================
   FORCE LIGHT MODE — override Frappe CSS variables + dark theme
   ============================================================ */

/* Reset Frappe's CSS custom properties to light-mode values.
   This is the nuclear option — overrides everything Frappe uses
   for theming, ensuring the web form always renders light. */
:root,
body,
[data-theme="dark"],
[data-theme="light"] {
    --bg-color: transparent !important;
    --fg-color: #ffffff !important;
    --text-color: #333333 !important;
    --text-light: #666666 !important;
    --text-muted: #966755 !important;
    --heading-color: #1E392A !important;
    --control-bg: #ffffff !important;
    --control-bg-on-gray: #f8f6f2 !important;
    --navbar-bg: #ffffff !important;
    --card-bg: #ffffff !important;
    --modal-bg: #ffffff !important;
    --border-color: #DBCBB4 !important;
    --dark-border-color: #c4ad91 !important;
    --gray-50: #faf8f5 !important;
    --gray-100: #f5f0ea !important;
    --gray-200: #DBCBB4 !important;
    --gray-300: #c4ad91 !important;
    --gray-400: #a89070 !important;
    --gray-500: #8a7560 !important;
    --gray-600: #6b5c4d !important;
    --gray-700: #4d4339 !important;
    --gray-800: #333333 !important;
    --gray-900: #1E392A !important;
    --subtle-accent: #faf8f5 !important;
    --subtle-fg: #f5f0ea !important;
    --disabled-text-color: #8a7560 !important;
    --disabled-control-bg: #faf8f5 !important;
    --highlight-color: #faf8f5 !important;
    --popover-bg: #ffffff !important;
    --toast-bg: #ffffff !important;
    --awesomebar-focus-bg: #ffffff !important;
    --fg-hover-color: #f5f0ea !important;
    --sidebar-select-color: #f5f0ea !important;
    --placeholder-color: #aaa !important;
    --btn-default-bg: #f5f0ea !important;
    --btn-default-hover-bg: #e8dfd2 !important;
    --scrollbar-thumb-color: #c4ad91 !important;
    --scrollbar-track-color: #DBCBB4 !important;
    color-scheme: light !important;
}

/* Force light on all page elements */
body,
.page-container,
.web-form-container,
.web-form-container *,
[data-web-form="cda-member-application"],
[data-web-form="cda-member-application"] * {
    color-scheme: light !important;
}

/* Page-level background: cannabis leaf image
   Use high-specificity selectors to beat Frappe's body { background: var(--bg-color) } */
html body,
html body.frappe-web,
html body[data-theme] {
    background: url('/files/bg.jpg') center/cover fixed no-repeat #1E392A !important;
    color: #333 !important;
}

/* All wrapper elements must be transparent so background shows */
.page-container,
.main-section,
.container,
.web-form-container,
form.web-form,
.web-form-wrapper,
.web-form-body,
.form-layout,
#page-inscricao,
[data-web-form],
.page_content,
.row {
    background-color: transparent !important;
    background: transparent !important;
}

/* ============================================================
   LAYOUT & TYPOGRAPHY
   ============================================================ */

/* Global container */
.web-form-container,
[data-web-form="cda-member-application"] {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 800px;
    margin: 0 auto;
}

/* Form card — transparent wrapper, sections get their own glass */
.web-form-container .web-form-body {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Section headings */
.web-form-container .section-head,
.web-form-container .web-form-body h6,
.web-form-container .form-section .section-head {
    font-family: 'Playfair Display', serif !important;
    color: #1E392A !important;
    font-size: 1.3em;
    font-weight: 600;
    border-bottom: 2px solid #DBCBB4;
    padding-bottom: 8px;
    margin-top: 28px;
    margin-bottom: 18px;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */

/* Field labels */
.web-form-container .frappe-control .control-label,
.web-form-container label {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 500;
    color: #1E392A !important;
    font-size: 0.9em;
    margin-bottom: 4px;
}

/* Input fields */
.web-form-container .frappe-control input[type="text"],
.web-form-container .frappe-control input[type="email"],
.web-form-container .frappe-control input[type="date"],
.web-form-container .frappe-control input[type="number"],
.web-form-container .frappe-control select,
.web-form-container .frappe-control textarea,
.web-form-container .form-control {
    border: 1px solid #DBCBB4 !important;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95em;
    color: #333 !important;
    background: #fff !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus state */
.web-form-container .frappe-control input:focus,
.web-form-container .frappe-control select:focus,
.web-form-container .frappe-control textarea:focus,
.web-form-container .form-control:focus {
    border-color: #1E392A !important;
    box-shadow: 0 0 0 3px rgba(30, 57, 42, 0.12) !important;
    outline: none;
}

/* Placeholder text */
.web-form-container .form-control::placeholder {
    color: #aaa !important;
}

/* Select dropdowns */
.web-form-container .frappe-control select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231E392A' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-color: #fff !important;
    padding-right: 35px;
}

/* Selected value in dropdowns must be clearly visible */
.web-form-container .frappe-control select,
.web-form-container select.form-control,
.web-form-container select.input-with-feedback {
    color: #1E392A !important;
    font-weight: 500;
}

/* Placeholder state — when no value selected */
.web-form-container .frappe-control select.placeholder-active,
.web-form-container select.placeholder-active {
    color: #aaa !important;
    font-weight: 400;
}

/* Option items inside dropdown */
.web-form-container select option {
    color: #333 !important;
    background: #fff !important;
    font-weight: 400;
}

/* First empty option as placeholder */
.web-form-container select option[value=""] {
    color: #aaa !important;
}

/* ============================================================
   CHECKBOX & RADIO
   ============================================================ */

.web-form-container .frappe-control.check .label-area,
.web-form-container .checkbox label {
    font-family: 'Montserrat', sans-serif !important;
    color: #555 !important;
    font-size: 0.9em;
}

.web-form-container .frappe-control input[type="checkbox"] {
    accent-color: #1E392A;
    width: 18px;
    height: 18px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

/* Submit / primary button */
.web-form-container .btn-primary,
.web-form-container .btn-primary-dark,
.web-form-container button[type="submit"],
.web-form-container .web-form-actions .btn-primary {
    background-color: #1E392A !important;
    border-color: #1E392A !important;
    color: #F5F5EF !important;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.05em;
    padding: 12px 40px;
    border-radius: 6px;
    text-transform: none;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.web-form-container .btn-primary:hover,
.web-form-container button[type="submit"]:hover,
.web-form-container .web-form-actions .btn-primary:hover {
    background-color: #2a5240 !important;
    border-color: #2a5240 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 57, 42, 0.3);
}

.web-form-container .btn-primary:active,
.web-form-container button[type="submit"]:active {
    transform: translateY(0);
}

/* Attach button */
.web-form-container .btn-default,
.web-form-container .btn-sm {
    background-color: #f8f6f2 !important;
    border-color: #DBCBB4 !important;
    color: #1E392A !important;
}

.web-form-container .btn-default:hover,
.web-form-container .btn-sm:hover {
    background-color: #efe9df !important;
}

/* ============================================================
   HELP TEXT, ERRORS, REQUIRED
   ============================================================ */

/* Field description / help text */
.web-form-container .help-block,
.web-form-container .frappe-control .help,
.web-form-container .text-muted {
    color: #966755 !important;
    font-size: 0.82em;
    font-family: 'Montserrat', sans-serif;
}

/* Required field asterisk */
.web-form-container .reqd .control-label::after,
.web-form-container .has-error .control-label {
    color: #c0392b !important;
}

/* Error state */
.web-form-container .has-error .form-control {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1) !important;
}

/* ============================================================
   INTRODUCTION / HEADER
   ============================================================ */

.web-form-container .introduction {
    margin-bottom: 0;
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */

/* Attachment / file upload area */
.web-form-container .attached-file,
.web-form-container .file-upload-area {
    border: 2px dashed #DBCBB4;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #faf8f5 !important;
    transition: border-color 0.2s;
}

.web-form-container .file-upload-area:hover {
    border-color: #1E392A;
}

/* Upload dialog — hide confusing options for public users */
.file-uploader .config-area {
    display: none !important;
}
.file-uploader .btn-crop {
    display: none !important;
}
.modal-dialog .modal-footer .btn-secondary-dark,
.modal-dialog .modal-footer .btn-modal-secondary,
.modal-dialog .modal-footer .btn-secondary {
    display: none !important;
}

/* Upload dialog — force light background */
.modal-content {
    background: #fff !important;
    color: #333 !important;
}

.modal-header,
.modal-footer {
    background: #fff !important;
    border-color: #e8e2d9 !important;
}

.modal-title {
    color: #1E392A !important;
}

/* ============================================================
   FOOTER
   ============================================================ */

.web-form-container .web-footer {
    font-family: 'Montserrat', sans-serif;
    color: #966755 !important;
    font-size: 0.8em;
    text-align: center;
    margin-top: 30px;
}

/* ============================================================
   FRAPPE UI OVERRIDES — catch dark theme remnants
   ============================================================ */

/* Ensure any Frappe dark theme classes don't leak through */
.web-form-container .frappe-control,
.web-form-container .form-group {
    background: transparent !important;
    color: #333 !important;
}

.web-form-container .like-disabled-input,
.web-form-container .control-value {
    color: #333 !important;
    background: #f8f6f2 !important;
}

/* Page title — white on the dark glass header */
.web-form-container h1,
.web-form-container .page-header h1 {
    color: #F5F5EF !important;
    font-family: 'Montserrat', sans-serif !important;
}

/* Links */
.web-form-container a {
    color: #1E392A !important;
}

.web-form-container a:hover {
    color: #2a5240 !important;
}

/* ============================================================
   HIDE NAVBAR — client-facing form, no login/home/menu needed
   ============================================================ */

.navbar,
.web-footer,
footer {
    display: none !important;
}

/* Remove the top padding that the navbar would have occupied */
body.frappe-web {
    padding-top: 0 !important;
}

/* ============================================================
   HEADER — dark green glass panel over background image
   ============================================================ */

.web-form-header {
    background: rgba(30, 57, 42, 0.88) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    padding: 36px 32px !important;
    margin-bottom: 20px !important;
}

.web-form-header *,
.web-form-header h1,
.web-form-header .ellipsis,
.web-form-head *,
.web-form-header .introduction *,
.web-form-header p {
    color: #F5F5EF !important;
}

/* Center the title */
.web-form-head,
.web-form-head h1,
.web-form-header h1,
.web-form-head .ellipsis,
.web-form-head > div {
    text-align: center !important;
    justify-content: center !important;
    display: block !important;
    width: 100% !important;
}

/* Hide the actions pill inside the header (admin-only, looks bad) */
.web-form-header .web-form-actions {
    display: none !important;
}

/* Hide the "Not Saved" indicator */
.web-form-header .indicator-pill {
    display: none !important;
}

/* ============================================================
   FORM SECTIONS — white glass cards over background image
   ============================================================ */

.web-form-container .form-section {
    background: rgba(255, 255, 255, 0.93) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    padding: 28px 24px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* Submit button area — white glass card */
form.web-form > .web-form-actions {
    background: rgba(255, 255, 255, 0.93) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    padding: 20px 24px !important;
}

/* ============================================================
   UNIFORM INPUT HEIGHT — match all inputs to select height
   ============================================================ */

.web-form-container .frappe-control input[type="text"],
.web-form-container .frappe-control input[type="email"],
.web-form-container .frappe-control input[type="date"],
.web-form-container .frappe-control input[type="number"],
.web-form-container .frappe-control textarea,
.web-form-container .form-control {
    height: auto !important;
    min-height: 40px !important;
    line-height: 1.5 !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ============================================================
   NUCLEAR SELECT FIX — ensure selected values are always visible
   Frappe may apply --placeholder-color or other variables that
   make select text invisible. This overrides EVERYTHING.
   ============================================================ */

/* Every select on the page */
select,
select.form-control,
select.input-with-feedback,
.frappe-control select,
.frappe-control[data-fieldtype="Select"] select,
.frappe-control[data-fieldtype="Select"] .form-control,
.web-form-container select,
[data-web-form] select {
    color: #1E392A !important;
    -webkit-text-fill-color: #1E392A !important;
    opacity: 1 !important;
    font-weight: 500 !important;
    overflow: visible !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    height: auto !important;
    min-height: 40px !important;
    line-height: 1.5 !important;
    padding: 8px 35px 8px 12px !important;
    box-sizing: border-box !important;
    font-size: 0.95em !important;
}

/* When no value is selected (empty first option) */
select.placeholder-active,
.frappe-control select.placeholder-active {
    color: #aaa !important;
    -webkit-text-fill-color: #aaa !important;
    font-weight: 400 !important;
}

/* The container must not clip the text */
.frappe-control[data-fieldtype="Select"],
.frappe-control[data-fieldtype="Select"] .control-input-wrapper,
.frappe-control[data-fieldtype="Select"] .control-input {
    overflow: visible !important;
}

@media (max-width: 768px) {
    .web-form-container .web-form-body {
        padding: 20px 16px;
        border-radius: 8px;
    }

    .web-form-container .cda-form-header h1,
    .web-form-container .introduction h1 {
        font-size: 1.5em !important;
    }

    .web-form-container .btn-primary,
    .web-form-container button[type="submit"] {
        width: 100%;
        padding: 14px;
    }
}
