/* ==========================================================================
   Baldwin County Fair - shared look & feel layer
   Loaded by Root/base.html (staff) and Root/user_base.html (exhibitors).
   Complements the Tailwind CDN utilities used throughout the templates.
   ========================================================================== */

:root {
    --bcf-blue: #2563eb;
    --bcf-blue-dark: #1d4ed8;
    --bcf-green: #16a34a;
    --bcf-amber: #f59e0b;
    --bcf-ink: #1f2937;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background-color: #bfdbfe;
    color: #1e3a8a;
}

/* --- Brand accent bar across the very top of every page ------------------ */
.bcf-accent-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--bcf-blue) 0%, var(--bcf-green) 50%, var(--bcf-amber) 100%);
}

/* --- Links, buttons and interactive affordances -------------------------- */
a,
button {
    transition: color .15s ease, background-color .15s ease,
                border-color .15s ease, box-shadow .15s ease,
                transform .15s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--bcf-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Slight press feedback on solid buttons */
button:active,
a[class*="bg-"]:active {
    transform: translateY(1px);
}

/* --- Forms ---------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"],
select,
textarea {
    transition: border-color .15s ease, box-shadow .15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--bcf-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* --- Tables (list pages, reports) ----------------------------------------- */
table thead th {
    letter-spacing: .03em;
}

table tbody tr {
    transition: background-color .12s ease;
}

table tbody tr:hover {
    background-color: #eff6ff;
}

/* --- Cards ----------------------------------------------------------------- */
.bcf-card,
.shadow-lg.rounded-lg,
.rounded-lg.shadow-lg {
    transition: box-shadow .2s ease, transform .2s ease;
}

/* --- Navigation dropdowns (staff header) ----------------------------------- */
.nav-dropdown-content {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    display: block !important;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
    border: 1px solid #e5e7eb;
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}

/* --- Flash messages --------------------------------------------------------- */
.bcf-messages {
    position: relative;
    z-index: 30;
}

.bcf-alert {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .8rem 1rem;
    border-radius: .5rem;
    border: 1px solid transparent;
    font-size: .875rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    animation: bcf-slide-in .25s ease;
}

@keyframes bcf-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bcf-alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.bcf-alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.bcf-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.bcf-alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.bcf-alert button.bcf-alert-close {
    margin-left: auto;
    background: none;
    border: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: .5;
    color: inherit;
}

.bcf-alert button.bcf-alert-close:hover {
    opacity: 1;
}

/* --- Scrollbar (WebKit) ------------------------------------------------------ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid #f3f4f6;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Print: hide chrome so reports/sheets print cleanly ---------------------- */
@media print {
    header,
    footer,
    .bcf-accent-bar,
    .bcf-messages,
    .mobile-menu,
    .no-print,
    .bcf-assistant-launcher,
    .bcf-assistant-panel {
        display: none !important;
    }

    body {
        background: #fff !important;
    }
}

/* --- AI Assistant chat widget (staff pages) ---------------------------------- */
.bcf-assistant-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 60;
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    border: none;
    background: #2563eb;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.bcf-assistant-launcher:hover {
    background: #1d4ed8;
    transform: scale(1.06);
}

.bcf-assistant-panel {
    position: fixed;
    bottom: 88px;
    right: 20px;
    z-index: 60;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-size: 0.875rem;
}

.bcf-assistant-panel.open {
    display: flex;
}

.bcf-assistant-header {
    background: #1f2937;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.bcf-assistant-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.bcf-assistant-header .bcf-assistant-sub {
    font-size: 0.7rem;
    color: #9ca3af;
}

.bcf-assistant-header button {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 0.75rem;
}

.bcf-assistant-header button:hover {
    color: #fff;
}

.bcf-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f9fafb;
}

.bcf-assistant-msg {
    margin-bottom: 10px;
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: normal;
}

.bcf-assistant-msg.user {
    margin-left: auto;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bcf-assistant-msg.assistant {
    margin-right: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.bcf-assistant-msg.error {
    margin-right: auto;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.bcf-assistant-msg a {
    color: #2563eb;
    text-decoration: underline;
}

.bcf-assistant-msg.user a {
    color: #dbeafe;
}

.bcf-assistant-msg ul {
    list-style: disc;
    margin: 4px 0 4px 18px;
}

.bcf-assistant-msg ol {
    list-style: decimal;
    margin: 4px 0 4px 18px;
}

.bcf-assistant-msg code {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.8em;
}

.bcf-assistant-typing {
    display: inline-block;
    margin-right: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 14px;
}

.bcf-assistant-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 2px;
    border-radius: 50%;
    background: #9ca3af;
    animation: bcfAssistantBlink 1.2s infinite both;
}

.bcf-assistant-typing span:nth-child(2) { animation-delay: 0.2s; }
.bcf-assistant-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bcfAssistantBlink {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 1; }
}

.bcf-assistant-confirm {
    margin: 0 14px 10px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    border-radius: 10px;
    padding: 10px 12px;
    flex-shrink: 0;
}

.bcf-assistant-confirm p {
    margin: 0 0 4px;
    color: #92400e;
    font-weight: 600;
    font-size: 0.8rem;
}

.bcf-assistant-confirm ul {
    margin: 0 0 8px 16px;
    list-style: disc;
    color: #78350f;
}

.bcf-assistant-confirm .bcf-assistant-confirm-actions {
    display: flex;
    gap: 8px;
}

.bcf-assistant-confirm button {
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.bcf-assistant-confirm button.confirm {
    background: #16a34a;
    color: #fff;
}

.bcf-assistant-confirm button.confirm:hover {
    background: #15803d;
}

.bcf-assistant-confirm button.cancel {
    background: #e5e7eb;
    color: #374151;
}

.bcf-assistant-confirm button.cancel:hover {
    background: #d1d5db;
}

.bcf-assistant-inputbar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.bcf-assistant-inputbar textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.875rem;
    font-family: inherit;
    max-height: 90px;
}

.bcf-assistant-inputbar textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: transparent;
}

.bcf-assistant-inputbar button {
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 600;
    cursor: pointer;
}

.bcf-assistant-inputbar button:hover:not(:disabled) {
    background: #1d4ed8;
}

.bcf-assistant-inputbar button:disabled,
.bcf-assistant-inputbar textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick-action chips */
.bcf-assistant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px 0;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.bcf-assistant-chips button {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 9999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.bcf-assistant-chips button:hover {
    background: #dbeafe;
}

/* Embedded mode (dashboard section) */
.bcf-assistant-panel.bcf-embedded {
    position: static;
    display: flex;
    width: 100%;
    max-width: none;
    height: 520px;
    max-height: none;
    box-shadow: none;
    border-radius: 10px;
}

.bcf-assistant-panel.bcf-embedded .bcf-assistant-messages {
    font-size: 0.9rem;
}

.bcf-assistant-panel.bcf-embedded .bcf-assistant-msg {
    max-width: 75%;
}
