/*
Theme Name:   SiCRED Divi Child
Theme URI:    https://sicred.com.al
Description:  Custom Divi 5 child theme for the SiCRED website (life & health insurance, Tirana). Keeps custom code safe across Divi updates.
Author:       Tech Fly Studio
Author URI:   https://www.tech-fly.com
Template:     Divi
Version:      1.4.2
Requires at least: 6.9
Requires PHP: 8.0
License:      GNU General Public License v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  sicred-child
*/

/* -----------------------------------------------------------------
   Keep this file small. Layout, colors, fonts and spacing are set
   with Divi 5 global colors, variables and presets, not here.
   Use it only for things Divi cannot style natively.
   Blocks 4, 5, 6 and 7 are the ONLY custom code the owner approved
   (7 Oct 2026). Each one can be deleted on its own.
   Notes: work/exceptions-notes.md in the project folder.
   ----------------------------------------------------------------- */

/* 1. WPML language switcher (header) */


/* 2. Agile Store Locator (hospital network map / list) */


/* 3. Other small fixes */


/* 4. Scroll progress bar ---------------------------------------------
   A thin brand-red line at the very top that fills while the page is
   scrolled (v2, 7 Oct 2026: every visitor now gets it).
   - The bar is body::before, 0 wide at rest, scaled up to full width.
   - Browsers WITH scroll timelines (Chrome, Edge, Safari 26+): the
     @supports part drives it in CSS alone, no JavaScript runs.
   - Browsers WITHOUT them (Firefox, older Safari / iPhones): a few
     lines of script printed by functions.php add one style rule
     with this same selector and keep its "transform" up to date.
   - Shown under "reduced motion" too: the bar moves only while the
     visitor scrolls, it is not an animation that plays by itself.
   - A page that does not scroll shows no bar (the scale stays 0).
   - not on staff cards (class "sicred-no-progress", added by
     functions.php) and not inside the Divi Visual Builder ("et-fb").
   - position:fixed + transform only: no layout shift; pointer-events
     none: it can never take a tap from the header under it.
   - Solid brand red only. The header's own top lines at this place
     are navy (tools/header_build.php, $TOPLINE) so the red bar shows.
   To remove: delete this block.                                       */
body:not(.sicred-no-progress):not(.et-fb)::before {
	content: "";
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 99990; /* above the sticky header (9990) and the phone capsule (9995) */
	background: var(--gcid-sicred-red, #c52b1b);
	transform: scaleX(0);
	transform-origin: 0 50%;
	pointer-events: none;
}
body.admin-bar:not(.sicred-no-progress):not(.et-fb)::before {
	top: 32px; /* logged-in editors: below the WordPress toolbar */
}
@media (max-width: 782px) {
	body.admin-bar:not(.sicred-no-progress):not(.et-fb)::before {
		top: 46px;
	}
}
@supports (animation-timeline: scroll()) {
	body:not(.sicred-no-progress):not(.et-fb)::before {
		animation: sicred-progress linear both;
		animation-timeline: scroll(root block); /* must come after "animation" */
	}
	@keyframes sicred-progress {
		from {
			transform: scaleX(0);
		}
		to {
			transform: scaleX(1);
		}
	}
}

/* 5. Contact form messages -------------------------------------------
   Divi prints its "please fill in…" / error / thank-you message in the
   page text colour, ABOVE the form: unreadable on the navy form panels
   and out of sight on a phone. The form container is a flex column, so
   "order" moves the message under the Send button, where the visitor
   is looking; the message becomes its own white card (navy text on
   white, about 17:1), readable on any panel colour, light or navy.
   The red edge of a text field with an error is nudged to #ff3b30, 2px:
   at least 3:1 against both white and the navy panels (Divi's pure red
   on the navy fields is just under 3:1).
   To remove: delete this block.                                       */
.et_pb_contact_form_container .et-pb-contact-message {
	order: 2;
}
.et_pb_contact_form_container .et-pb-contact-message:not(:empty) {
	margin-top: 16px;
	padding: 14px 18px;
	border-left: 4px solid #c52b1b;
	border-radius: 8px;
	background: #fff;
	color: #0a1a2f;
	font-size: 15px;
	line-height: 1.55;
}
.et_pb_contact_form_container .et-pb-contact-message p,
.et_pb_contact_form_container .et-pb-contact-message li {
	color: inherit;
	padding-bottom: 0;
}
.et_pb_contact_form_container .et-pb-contact-message p {
	font-weight: 700;
}
.et_pb_contact_form_container .et-pb-contact-message ul {
	padding: 6px 0 0 18px;
	list-style: disc;
}
.et_pb_contact_form_container .et-pb-contact-message ul:empty {
	display: none;
}
.et_pb_contact_form_container .et_pb_contact_form .input.et_contact_error {
	border: 2px solid #ff3b30 !important;
}
/* A tick box / choice that was left empty: Divi turns its text pure red
   (under 4.5:1 on navy and on white). Same idea as the message: the row
   becomes a white chip with dark red text (#b3261e on white = 6.5:1).  */
.et_pb_contact_form_container .et_pb_contact_field.et_contact_error .et_pb_contact_field_options_list {
	display: block;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fff;
}
.et_pb_contact_form_container .et_pb_contact .et_pb_contact_form .et_pb_contact_field.et_contact_error input[type="checkbox"] + label,
.et_pb_contact_form_container .et_pb_contact .et_pb_contact_form .et_pb_contact_field.et_contact_error input[type="radio"] + label {
	color: #b3261e !important;
}
.et_pb_contact_form_container .et_pb_contact .et_pb_contact_form .et_pb_contact_field.et_contact_error input[type="checkbox"] + label i,
.et_pb_contact_form_container .et_pb_contact .et_pb_contact_form .et_pb_contact_field.et_contact_error input[type="radio"] + label i {
	border: 2px solid #b3261e !important;
}

/* 6. Logo preloader: removed on 3 Nov 2026 (owner's choice, page speed). */

/* 7. AI chatbot (AI Engine) -------------------------------------------
   Owner-approved exception (7 Oct 2026), scoped to the chatbot only:
   brand link colour, serif name, readable privacy line. Same rules for
   the desktop popup and the phone sheet (both are ".mwai-chat").
   - links in answers and in the privacy line: navy, underlined
     (9.8:1 on white, 8.6:1 on the answer bubble #eef2f7);
   - links inside the VISITOR's own bubble (navy): white, underlined;
   - bot name in the heading serif;
   - privacy line in slate at full strength (7:1 on white; the plugin
     prints it at 50% opacity).
   The selectors repeat the plugin's own nesting (.mwai-text, .mwai-footer,
   doubled class) only to outrank its theme files, which load later.
   Nothing else of the chatbot is styled here. To remove: delete this block. */
.mwai-chat .mwai-reply .mwai-text a,
.mwai-chat .mwai-compliance a {
	color: var(--gcid-sicred-navy, #154577);
	text-decoration: underline;
}
.mwai-chat .mwai-conversation .mwai-reply.mwai-user .mwai-text a {
	color: #fff;
}
.mwai-chat .mwai-header .mwai-name {
	font-family: 'Fraunces', serif;
	color: #fff;
}
.mwai-chat.mwai-chat .mwai-compliance,
.mwai-chat.mwai-chat .mwai-footer .mwai-compliance {
	color: var(--gcid-sicred-slate, #4a5b6f);
	opacity: 1;
}

/* 8. Store locator (Agile Store Locator) ------------------------------
   Owner-approved exception (7 Oct 2026), two plugin-stylesheet faults:
   - the open filter lists (city, type) had a fixed height of 125px from
     768px up, so only one city showed at a time. The list now takes its
     own height, up to 380px (or 60% of the screen), and scrolls beyond;
   - the closed control printed its text with text-transform: capitalize
     ("Të Gjitha Qytetet"); it now shows the label as written.
   To remove: delete this block. */
@media (min-width: 768px) {
	#asl-storelocator.asl-cont.asl-template-0 .asl-wrapper .asl-ddl-filters .asl-filter-cntrl .btn-group .adropdown-menu {
		height: auto;
		max-height: min(380px, 60vh) !important;
	}
}
#asl-storelocator.asl-cont .asl-wrapper .asl-ddl-filters .asl-filter-cntrl .btn-group button.adropdown-toggle .multiselect-selected-text {
	text-transform: none;
}

/* 9. Evolutive Life calculator ([sicred_calculator]) ------------------
   Owner-approved exception 6 (6 Nov 2026): styles for the premium
   calculator printed by the SICRED-CALCULATOR block in functions.php.
   Scoped to .sicred-calc. To remove: delete this block and that block. */
.sicred-calc { --sc-navy: #154577; --sc-red: #c52b1b; --sc-ink: #0a1a2f; --sc-slate: #4a5b6f; --sc-line: #d5deea; --sc-tint: #f3f6fa;
	font-family: 'Manrope', Helvetica, Arial, sans-serif; color: var(--sc-ink); background: #fff; border: 1px solid var(--sc-line); border-radius: 8px; padding: 32px; max-width: 760px; margin: 0 auto; box-shadow: 0 12px 32px rgba(10, 26, 47, .06); text-align: left; }
.sicred-calc p { text-align: left; }
.sicred-calc *, .sicred-calc *::before, .sicred-calc *::after { box-sizing: border-box; }
.sicred-calc [hidden] { display: none !important; }
.sicred-calc__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.sicred-calc__wide { grid-column: 1 / -1; }
.sicred-calc__field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.sicred-calc__field > label, .sicred-calc__field > legend { font-weight: 700; font-size: 15px; line-height: 1.4; color: var(--sc-ink); padding: 0; margin: 0 0 6px; }
.sicred-calc input[type=date], .sicred-calc input[type=text], .sicred-calc input[type=number], .sicred-calc input[type=email], .sicred-calc input[type=tel], .sicred-calc select, .sicred-calc textarea {
	width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--sc-ink); background: #fff; border: 1px solid #b9c6d6; border-radius: 8px; appearance: auto; }
.sicred-calc input:focus-visible, .sicred-calc select:focus-visible, .sicred-calc__seg input:focus-visible + span, .sicred-calc__btn:focus-visible { outline: 3px solid var(--sc-navy); outline-offset: 2px; }
.sicred-calc [aria-invalid=true] { border-color: var(--sc-red); }
.sicred-calc small { font-size: 13px; color: var(--sc-slate); line-height: 1.4; }
.sicred-calc__err { font-size: 14px; color: var(--sc-red); font-weight: 600; line-height: 1.4; }
.sicred-calc__err:empty { display: none; }
.sicred-calc__seg { display: flex; gap: 8px; flex-wrap: wrap; }
.sicred-calc__seg label { flex: 1 1 0; min-width: 72px; position: relative; cursor: pointer; }
.sicred-calc__seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sicred-calc__seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 12px; border: 1px solid #b9c6d6; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--sc-ink); background: #fff; transition: background-color .15s, border-color .15s, color .15s; }
.sicred-calc__seg input:checked + span { background: var(--sc-navy); border-color: var(--sc-navy); color: #fff; }
.sicred-calc__risk { background: var(--sc-tint); border-left: 3px solid var(--sc-red); border-radius: 8px; padding: 18px 20px; }
.sicred-calc__risk p { margin: 0 0 10px; padding: 0; line-height: 1.6; }
.sicred-calc__risk p:last-child { margin-bottom: 0; }
.sicred-calc__links a { display: inline-flex; align-items: center; min-height: 44px; margin-right: 18px; color: var(--sc-navy); font-weight: 700; text-decoration: underline; }
.sicred-calc__submit { margin: 24px 0 0; padding: 0; }
.sicred-calc__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 26px; border: 2px solid var(--sc-red); border-radius: 8px; background: var(--sc-red); color: #fff !important; font: inherit; font-weight: 700; font-size: 16px; text-decoration: none !important; cursor: pointer; transition: background-color .15s, border-color .15s; }
.sicred-calc__btn:hover { background: #a82314; border-color: #a82314; }
.sicred-calc__btn--line { background: transparent; color: var(--sc-navy) !important; border-color: var(--sc-navy); }
.sicred-calc__btn--line:hover { background: var(--sc-navy); border-color: var(--sc-navy); color: #fff !important; }
.sicred-calc__result { margin-top: 28px; padding: 24px; border-radius: 8px; background: var(--sc-tint); border-top: 3px solid var(--sc-red); }
.sicred-calc__result p { margin: 0; padding: 0; }
.sicred-calc__res-label { font-weight: 700; font-size: 15px; color: var(--sc-slate); }
.sicred-calc__res-value { font-family: 'Fraunces', Georgia, serif; font-size: clamp(34px, 6vw, 48px); line-height: 1.15; color: var(--sc-navy); margin: 6px 0 4px !important; font-variant-numeric: tabular-nums; }
.sicred-calc__res-for { font-size: 15px; color: var(--sc-ink); }
.sicred-calc__res-note { font-size: 13px; color: var(--sc-slate); margin-top: 12px !important; line-height: 1.5; }
.sicred-calc__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px !important; }
@media (max-width: 767px) {
	.sicred-calc { padding: 20px 16px; }
	.sicred-calc__grid { grid-template-columns: 1fr; gap: 18px; }
	.sicred-calc__submit .sicred-calc__btn { width: 100%; }
	.sicred-calc__actions { flex-wrap: nowrap; gap: 8px; }
	.sicred-calc__actions .sicred-calc__btn { flex: 1 1 0; padding: 12px 8px; font-size: 15px; white-space: nowrap; }
}
/* birth date: day / month / year */
.sicred-calc__date { display: grid; grid-template-columns: 1fr 1.7fr 1.2fr; gap: 8px; }
.sicred-calc__date select { padding-left: 10px; padding-right: 6px; }
.sicred-calc textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.sicred-calc__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sicred-calc__privacy { font-size: 13px; color: var(--sc-slate); margin: 10px 0 0; padding: 0; }
.sicred-calc__status { margin: 12px 0 0; padding: 0; font-weight: 600; line-height: 1.5; }
.sicred-calc__status:empty { display: none; }
.sicred-calc__status.is-ok { color: #1f6b3a; background: #eaf5ee; border-radius: 8px; padding: 14px 16px; }
.sicred-calc__status.is-err { color: var(--sc-red); background: #fbeceb; border-radius: 8px; padding: 14px 16px; }
.sicred-calc__btn[disabled] { opacity: .7; cursor: wait; }
@media (prefers-reduced-motion: reduce) { .sicred-calc * { transition: none !important; } }
