/* FERROFLEX Corporate Survey Theme
   Brand red: #E31536 | Charcoal: #231F20
   Built as a child theme of fruity_twentythree for LimeSurvey 6/7. */

:root {
    --ff-red: #e31536;
    --ff-red-dark: #b90f2a;
    --ff-red-soft: #fff1f4;
    --ff-charcoal: #231f20;
    --ff-charcoal-soft: #3a3637;
    --ff-gray-50: #fafafa;
    --ff-gray-100: #f4f4f5;
    --ff-gray-200: #e5e5e7;
    --ff-gray-300: #d2d2d5;
    --ff-gray-500: #737176;
    --ff-white: #ffffff;
    --ff-success: #18794e;
    --ff-success-soft: #edf8f2;
    --ff-warning: #9a6700;
    --ff-warning-soft: #fff8e6;
    --ff-info: #245b8a;
    --ff-info-soft: #eef6fd;
    --ff-radius: 6px;
    --ff-shadow: 0 8px 24px rgba(35, 31, 32, 0.08);
    --ff-focus: 0 0 0 3px rgba(227, 21, 54, 0.22);
}

html { scroll-behavior: smooth; }

body,
body.ff-corporate-theme {
    color: var(--ff-charcoal);
    background: var(--ff-gray-100);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
    accent-color: var(--ff-red);
}

body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 5px;
    background: var(--ff-red);
    z-index: 9999;
}

::selection { background: rgba(227, 21, 54, 0.18); color: var(--ff-charcoal); }

a { color: var(--ff-red-dark); text-underline-offset: 2px; }
a:hover, a:focus { color: var(--ff-red); }

/* Header and logo */
.top-container,
.navbar,
.navbar-default,
.navbar-fixed-top {
    background: var(--ff-white) !important;
    border: 0 !important;
    box-shadow: 0 2px 14px rgba(35, 31, 32, 0.08);
}

.top-container { padding-top: 5px; }
.ff-footer__inner { align-items: center; }

.logo,
.navbar-brand .logo,
.top-container img.logo {
    width: auto;
    max-width: 250px;
    max-height: 54px;
    object-fit: contain;
    margin: 10px 0 12px;
}

/* Survey frame */
body > article,
#outerframeContainer,
.outerframe,
#survey-container {
    width: 100%;
}

#outerframeContainer,
.outerframe {
    max-width: 1180px;
    margin-inline: auto;
}

.survey-name,
.survey-title,
h1, h2, h3, h4, h5, h6 {
    color: var(--ff-charcoal);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.survey-name,
.survey-title {
    font-size: clamp(1.75rem, 3vw, 2.6rem);
    margin-bottom: 0.75rem;
}

.survey-description,
.survey-welcome,
.group-description {
    color: var(--ff-charcoal-soft);
}

/* Cards, groups and questions */
.group-container,
.question-container,
.question-wrapper,
.welcome-container,
.privacy-container,
.submit-wrapper,
.completed-wrapper,
.token-form,
.register-form,
.save-form,
.load-form {
    background: var(--ff-white);
    border: 1px solid var(--ff-gray-200) !important;
    border-radius: var(--ff-radius) !important;
    box-shadow: var(--ff-shadow);
}

.group-container { overflow: hidden; }

.group-title,
.group-name {
    position: relative;
    padding-bottom: 0.75rem;
}

.group-title::after,
.group-name::after {
    content: "";
    display: block;
    width: 54px;
    height: 4px;
    margin-top: 0.7rem;
    background: var(--ff-red);
}

.question-container {
    padding: clamp(1.1rem, 2.5vw, 2rem) !important;
    margin-bottom: 1.25rem !important;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.question-container:hover {
    border-color: var(--ff-gray-300) !important;
    box-shadow: 0 10px 28px rgba(35, 31, 32, 0.11);
}

.question-title-container,
.question-text {
    color: var(--ff-charcoal);
    font-weight: 700;
}

.question-code { color: var(--ff-gray-500); font-weight: 600; }
.asterisk, .mandatory, .text-danger { color: var(--ff-red) !important; }
.question-help-container, .questionhelp, .help-block { color: var(--ff-gray-500); }

/* Form fields */
.form-control,
.form-select,
textarea,
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="password"], input[type="date"], input[type="time"], input[type="url"],
select {
    min-height: 46px;
    border: 1px solid var(--ff-gray-300) !important;
    border-radius: 4px !important;
    background-color: var(--ff-white) !important;
    color: var(--ff-charcoal) !important;
    box-shadow: none !important;
}

textarea.form-control, textarea { min-height: 120px; }

.form-control:hover,
.form-select:hover,
textarea:hover,
input:hover,
select:hover { border-color: #a8a6aa !important; }

.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
    border-color: var(--ff-red) !important;
    box-shadow: var(--ff-focus) !important;
    outline: none !important;
}

.form-check-input,
input[type="checkbox"],
input[type="radio"] {
    border-color: #969398;
}

.form-check-input:checked,
input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: var(--ff-red) !important;
    border-color: var(--ff-red) !important;
}

.form-check-label,
.answer-item label { cursor: pointer; }

/* Matrix and tables */
.table,
table {
    color: var(--ff-charcoal);
    border-color: var(--ff-gray-200);
}

.table thead th,
table thead th {
    background: var(--ff-charcoal);
    color: var(--ff-white);
    border-color: var(--ff-charcoal);
    font-weight: 700;
}

.table-striped > tbody > tr:nth-of-type(odd) > *,
table tbody tr:nth-child(odd) { background-color: var(--ff-gray-50); }

.table-hover > tbody > tr:hover > * { background-color: var(--ff-red-soft); }

/* Buttons */
.btn {
    min-height: 44px;
    border-radius: 4px !important;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary,
.btn-primary:active,
.btn-check:checked + .btn-primary,
.ls-move-next-btn,
.ls-move-submit-btn {
    background: var(--ff-red) !important;
    border-color: var(--ff-red) !important;
    color: var(--ff-white) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.ls-move-next-btn:hover,
.ls-move-submit-btn:hover {
    background: var(--ff-red-dark) !important;
    border-color: var(--ff-red-dark) !important;
    box-shadow: 0 6px 16px rgba(227, 21, 54, 0.22) !important;
}

.btn-secondary,
.btn-outline-secondary,
.ls-move-previous-btn {
    background: var(--ff-white) !important;
    border-color: var(--ff-charcoal) !important;
    color: var(--ff-charcoal) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.ls-move-previous-btn:hover {
    background: var(--ff-charcoal) !important;
    color: var(--ff-white) !important;
}

.btn-danger { background: var(--ff-red) !important; border-color: var(--ff-red) !important; }

/* Progress */
.progress {
    height: 8px;
    background: var(--ff-gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    background: var(--ff-red) !important;
    border-radius: 999px;
}

.progress-bar-container { color: var(--ff-gray-500); font-size: 0.92rem; }

/* Messages and validation */
.alert {
    border: 0 !important;
    border-left: 5px solid currentColor !important;
    border-radius: 4px !important;
    padding: 1rem 1.2rem !important;
    box-shadow: 0 4px 14px rgba(35, 31, 32, 0.07);
}

.alert-danger,
.alert-error,
.error-container,
.emtip.error,
.invalid-feedback,
.validation-error {
    color: #981b2f !important;
    background: var(--ff-red-soft) !important;
    border-color: var(--ff-red) !important;
}

.alert-warning { color: var(--ff-warning) !important; background: var(--ff-warning-soft) !important; }
.alert-success { color: var(--ff-success) !important; background: var(--ff-success-soft) !important; }
.alert-info { color: var(--ff-info) !important; background: var(--ff-info-soft) !important; }

.has-error .form-control,
.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--ff-red) !important;
    background-image: none !important;
}

.has-error .form-control:focus,
.form-control.is-invalid:focus { box-shadow: var(--ff-focus) !important; }

.emtip.error,
.invalid-feedback,
.validation-error {
    display: block;
    margin-top: 0.55rem;
    padding: 0.7rem 0.85rem;
    border-left: 4px solid var(--ff-red);
    border-radius: 3px;
    font-weight: 600;
}

/* Privacy, tokens, registration, completion */
.privacy-container,
.token-form,
.register-form,
.save-form,
.load-form,
.completed-wrapper,
.submit-wrapper {
    padding: clamp(1.25rem, 3vw, 2.5rem);
}

.completed-wrapper::before,
.submit-wrapper::before {
    content: "✓";
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: var(--ff-success-soft);
    color: var(--ff-success);
    font-size: 1.8rem;
    font-weight: 800;
}

/* Dropdowns and survey options */
.dropdown-menu {
    border: 1px solid var(--ff-gray-200);
    border-radius: 4px;
    box-shadow: var(--ff-shadow);
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active {
    background: var(--ff-red-soft);
    color: var(--ff-charcoal);
}

/* Footer */
.ff-footer {
    margin-top: auto;
    padding: 1.25rem 1rem;
    background: var(--ff-charcoal);
    color: rgba(255,255,255,0.84);
    font-size: 0.9rem;
}

.ff-footer__inner {
    width: min(1120px, 100%);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ff-footer a { color: var(--ff-white); font-weight: 700; }

/* Blocking error page */
body.error-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    background: var(--ff-gray-100);
}

.ff-error-header {
    background: var(--ff-white);
    border-top: 5px solid var(--ff-red);
    box-shadow: 0 2px 14px rgba(35,31,32,.08);
}

.ff-error-header__inner,
.ff-error-main {
    width: min(1080px, calc(100% - 2rem));
    margin-inline: auto;
}

.ff-error-header__inner { padding: 1rem 0; }
.ff-error-header img { width: 245px; max-width: 72vw; height: auto; }

.ff-error-main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 3rem 0;
}

.ff-error-card {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr);
    gap: 2rem;
    align-items: center;
    padding: clamp(1.5rem, 4vw, 3.2rem);
    background: var(--ff-white);
    border: 1px solid var(--ff-gray-200);
    border-top: 6px solid var(--ff-red);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
}

.ff-error-kicker {
    margin: 0 0 .4rem;
    color: var(--ff-red);
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.ff-error-title { margin: 0 0 1rem; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.ff-error-content { color: var(--ff-charcoal-soft); }
.ff-error-content pre { overflow: auto; padding: 1rem; background: var(--ff-gray-100); border-radius: 4px; }
.ff-error-visual img { width: 100%; max-width: 320px; height: auto; }
.ff-error-contact { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--ff-gray-200); }

/* Mobile */
@media (max-width: 767px) {
    .logo,
    .navbar-brand .logo,
    .top-container img.logo { max-width: 190px; max-height: 52px; }

    .question-container { padding: 1.1rem !important; }
    .ff-error-card { grid-template-columns: 1fr; }
    .ff-error-visual { order: -1; text-align: center; }
    .ff-error-visual img { max-width: 180px; }
    .ff-footer__inner { justify-content: center; text-align: center; }
    .ls-move-next-btn, .ls-move-previous-btn, .ls-move-submit-btn { width: 100%; margin-bottom: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
