/* ============================================
   Flexible Form Builder — Custom Theme
   Logo palette: Navy, Red, White
   Each component uses one solid color; no gradients.
   ============================================ */

:root {
    /* Brand */
    --ffb-navy:       #27357A;
    --ffb-navy-dark:  #1D285D;
    --ffb-red:        #E31B23;
    --ffb-red-dark:   #BD141B;
    --ffb-white:      #FFFFFF;

    /* Bootstrap primary uses the logo red; links use logo navy. */
    --bs-primary:     var(--ffb-red);
    --bs-primary-rgb: 227, 27, 35;
    --bs-link-color:  var(--ffb-navy);
    --bs-link-hover-color: var(--ffb-navy-dark);

    /* Body & heading colors */
    --bs-body-color:        #000000;
    --bs-body-color-rgb:    0, 0, 0;
    --bs-heading-color:     #000000;
    --bs-emphasis-color:    #000000;
    --bs-secondary-color:   #444444;
    --bs-tertiary-color:    #555555;
    --bs-body-bg:           #FFFFFF;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Sarabun", "Noto Sans Thai", sans-serif;
    background: #F5F7FA;
    color: #000;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: #000;
    font-weight: 700;
}

p, label, .form-label, .form-text, .text-body, .card, .table, .list-group-item {
    color: #000;
}

.text-muted {
    color: #555 !important;
}

a {
    color: var(--ffb-navy);
    font-weight: 500;
}

code, pre {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.875em;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.card {
    border: 1px solid rgba(0,0,0,.075);
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #6c757d;
}
.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}

/* Focus state for a11y */
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible {
    outline: 2px solid var(--ffb-navy);
    outline-offset: 2px;
}

/* ============== Navbar ============== */
.navbar {
    background: #ffffff !important;
    border-bottom: 3px solid var(--ffb-red);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.navbar .navbar-brand,
.navbar .nav-link,
.navbar .navbar-toggler {
    color: #000 !important;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: var(--ffb-red) !important;
}
.navbar .nav-link.active {
    color: var(--ffb-red) !important;
    font-weight: 600;
}
.navbar .navbar-toggler {
    border-color: #000;
}
.navbar .dropdown-menu {
    border-color: rgba(0,0,0,.1);
}
.navbar .dropdown-item {
    color: #000;
}
.navbar .dropdown-item:hover {
    background: var(--ffb-white);
    color: var(--ffb-navy);
}
.navbar .badge.bg-secondary {
    background-color: var(--ffb-navy) !important;
}

/* ============== Brand mark (logo) ============== */
.ffb-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: #000 !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}
.ffb-brand img {
    height: 40px;
    width: 40px;
    background: #fff;
    border-radius: 4px;
    padding: 2px;
}

/* ============== Buttons ============== */
.btn-primary {
    --bs-btn-bg: var(--ffb-red);
    --bs-btn-border-color: var(--ffb-red);
    --bs-btn-hover-bg: var(--ffb-red-dark);
    --bs-btn-hover-border-color: var(--ffb-red-dark);
    --bs-btn-active-bg: var(--ffb-red-dark);
    --bs-btn-active-border-color: var(--ffb-red-dark);
}
.btn-outline-primary {
    --bs-btn-color: var(--ffb-navy);
    --bs-btn-border-color: var(--ffb-navy);
    --bs-btn-hover-bg: var(--ffb-navy);
    --bs-btn-hover-border-color: var(--ffb-navy);
    --bs-btn-active-bg: var(--ffb-navy);
}
.btn-blue {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--ffb-navy);
    --bs-btn-border-color: var(--ffb-navy);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ffb-navy-dark);
    --bs-btn-hover-border-color: var(--ffb-navy-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ffb-navy-dark);
}

/* ============== Cards (dashboard counters) ============== */
.card.text-bg-primary,
.card.text-bg-secondary,
.card.text-bg-warning {
    background: var(--ffb-red) !important;
    color: #fff !important;
}
.card.text-bg-info,
.card.text-bg-success {
    background: var(--ffb-navy) !important;
    color: #fff !important;
}

/* ============== Badges ============== */
.badge.bg-primary { background-color: var(--ffb-red) !important; }
.badge.bg-blue { background-color: var(--ffb-navy) !important; }

/* ============== Landing page ============== */
.ffb-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ffb-white);
}
.ffb-home-header {
    background: var(--ffb-white);
    border-bottom: 3px solid var(--ffb-red);
    padding: .75rem 0;
}
.ffb-home-login {
    padding: .45rem 1rem;
    font-weight: 600;
}
.ffb-home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem 1rem;
    text-align: center;
}
.ffb-home-logo {
    width: 140px;
    height: 140px;
    object-fit: contain;
}
.ffb-home-main h1 {
    margin: 0;
    color: var(--ffb-navy);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
}
.ffb-home-footer {
    background: var(--ffb-navy);
    color: var(--ffb-white);
    padding: 1.25rem;
    text-align: center;
    font-size: .9rem;
}

.ffb-landing-nav {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.ffb-landing-nav .ffb-brand { font-size: 1.1rem; }
.ffb-landing-nav .ffb-brand img { height: 32px; width: 32px; }

.ffb-hero {
    padding: 4rem 0 3rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.ffb-hero-logo {
    height: 72px;
    width: 72px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 1.5rem;
}
.ffb-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #000;
    margin-bottom: .75rem;
    letter-spacing: -1px;
}
.ffb-hero .lead {
    font-size: 1.15rem;
    color: #444;
    max-width: 640px;
    margin: 0 auto 1.5rem;
}
.ffb-hero .ffb-brand-mark {
    color: var(--ffb-red);
    font-weight: 800;
}

.ffb-cta-btn {
    padding: .7rem 1.75rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(227,27,35,.20);
}
.ffb-cta-btn.btn-blue {
    box-shadow: 0 2px 8px rgba(39,53,122,.20);
}

.ffb-section {
    padding: 4rem 0;
}
.ffb-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #000;
    margin-bottom: .5rem;
    text-align: center;
}
.ffb-section-sub {
    color: #555;
    text-align: center;
    margin-bottom: 3rem;
}

.ffb-feature {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    height: 100%;
    transition: all .2s;
}
.ffb-feature:hover {
    border-color: var(--ffb-navy);
    box-shadow: 0 4px 16px rgba(39,53,122,.10);
    transform: translateY(-2px);
}
.ffb-feature .feature-icon {
    width: 48px;
    height: 48px;
    background: var(--ffb-red);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}
.ffb-section .row > div:nth-child(even) .feature-icon {
    background: var(--ffb-navy);
}
.ffb-feature h5 {
    font-weight: 700;
    color: #000;
    margin-bottom: .5rem;
}
.ffb-feature p {
    color: #555;
    margin: 0;
    font-size: .95rem;
    line-height: 1.5;
}

.ffb-status-strip {
    background: var(--ffb-navy);
    color: #fff;
    padding: 2rem 0;
    text-align: center;
}
.ffb-status-strip h2 { color: #fff; font-weight: 800; }
.ffb-status-strip p { color: rgba(255,255,255,.9); margin: 0; }

.ffb-cta-strip {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 3rem 0;
    text-align: center;
}
.ffb-cta-strip h3 { color: #000; font-weight: 700; }

.ffb-landing-footer {
    background: var(--ffb-navy-dark);
    color: rgba(255,255,255,.75);
    padding: 1.5rem 0;
    text-align: center;
    font-size: .85rem;
}

/* ============== Form Builder (Phase 2+) ============== */
.ffb-field-palette .ffb-field-type {
    cursor: grab;
    user-select: none;
}
.ffb-field-palette .ffb-field-type:active {
    cursor: grabbing;
}
.ffb-canvas .ffb-field-item {
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: .75rem;
    margin-bottom: .5rem;
    background: #fff;
    position: relative;
    transition: box-shadow .15s;
}
.ffb-canvas .ffb-field-item:hover {
    box-shadow: 0 0 0 2px rgba(39,53,122,.14);
}
.ffb-canvas .ffb-field-item.is-selected {
    border-color: var(--ffb-navy);
    box-shadow: 0 0 0 3px rgba(39,53,122,.14);
}
.ffb-canvas .ffb-field-item .ffb-field-handle {
    cursor: grab;
    color: #adb5bd;
}
.ffb-canvas .ffb-field-item .ffb-field-actions {
    position: absolute;
    top: .5rem;
    right: .5rem;
    display: none;
    gap: .25rem;
}
.ffb-canvas .ffb-field-item:hover .ffb-field-actions,
.ffb-canvas .ffb-field-item.is-selected .ffb-field-actions {
    display: flex;
}

.admin-user-edit-popup {
    background-color: #ffffff !important;
}

/* ============== Print ============== */
@media print {
    .navbar, footer, .no-print { display: none !important; }
}
