/* Glassmorphism utilities beyond what Tailwind provides out of the box */

.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.glass-light {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Theme transition for smooth dark/light switching */
*, *::before, *::after {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Animated gradient background */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-animated-gradient {
    background: linear-gradient(-45deg, #0f172a, #1e293b, #312e81, #1e1b4b);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

.bg-animated-gradient-light {
    background: linear-gradient(-45deg, #e0e7ff, #ddd6fe, #c7d2fe, #e0e7ff);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

/* Focus ring for form inputs */
.input-glass:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

/* ── Overvault Gradient (Blue→Magenta) ── */
.btn-overvault {
    background: linear-gradient(135deg, #5B8CFF 0%, #EC4899 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(91, 140, 255, 0.35), 0 2px 8px rgba(236, 72, 153, 0.2);
    transition: all 0.25s ease;
}
.btn-overvault:hover {
    box-shadow: 0 6px 28px rgba(91, 140, 255, 0.5), 0 4px 14px rgba(236, 72, 153, 0.35);
    transform: translateY(-1px);
    filter: brightness(1.05);
}
.btn-overvault:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(91, 140, 255, 0.3), 0 1px 4px rgba(236, 72, 153, 0.15);
}
.btn-overvault:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: none;
}

/* ── Giro Group brand ── */
.text-giro-gold {
    color: #FFD700;
}

/* ── Login background texture ── */
.login-bg-light {
    background: linear-gradient(135deg, #f0f4ff 0%, #fef3f2 50%, #f0f4ff 100%);
}
.login-bg-dark {
    background: linear-gradient(135deg, #0c1222 0%, #1a1035 50%, #0c1222 100%);
}

/* ── Mobile-friendly tables ──
   Every <table> inside <main> auto-wrapped by JS in base.html with
   .table-scroll, then this CSS keeps columns readable on narrow screens.

   Critical: <main> is flex-1 child. Without min-width:0 it cannot shrink
   below its content's min-width, so a table demanding 640px would push
   the entire page wider than viewport (causing the body-level horizontal
   overflow we saw on /dashboard, /requests, /treasury, etc.). */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}
main {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* breakout from page padding so the scroll edge sits on viewport edge */
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 640px) {
    .table-scroll {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }
}
main table {
    width: 100%;
}
@media (max-width: 767px) {
    main table {
        min-width: 640px;       /* keep columns from squashing */
        font-size: 0.8125rem;   /* slightly tighter on phones */
    }
    main table th,
    main table td {
        padding-left: 0.625rem;
        padding-right: 0.625rem;
    }
}

/* Subtle right-edge fade hint that the table is scrollable on mobile */
.table-scroll::after {
    content: "";
    position: sticky;
    right: 0;
    top: 0;
    width: 16px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(to left, rgba(15, 23, 42, 0.6), transparent);
    display: none;
}
@media (max-width: 767px) {
    .table-scroll[data-overflow="true"]::after {
        display: block;
    }
}

/* Cards/grids that bump into the viewport edge — give predictable padding on mobile */
@media (max-width: 640px) {
    main .card-neo {
        border-radius: 1rem;
    }
}

/* ── Light-theme readability fix ──
   Many templates (incl. portal/banking_queue/settings_bot/treasury) used
   Tailwind's text-slate-200 (#e2e8f0) and text-white (#ffffff) without a
   dark: counterpart, leaving content nearly invisible against the light-
   theme white background (modal titles, form input values, textareas).
   Override only in :not(.dark) so dark theme keeps its tone:
     • slate-200 / slate-300 → slate-500 (#64748b) — Roman 2026-05-07
     • white                 → slate-300 (#cbd5e1) — Roman 2026-05-07
   Buttons that legitimately need white text (btn-overvault, .btn-*) set
   their color via more-specific class rules and are unaffected. */
html:not(.dark) .text-slate-200,
html:not(.dark) .text-slate-300 {
    color: #64748b;
}
html:not(.dark) .text-white {
    color: #cbd5e1;
}

/* ── input-neo: form input with visible border + background, used across
   /legal, /requests, /ved, /chains form fields. Юля reported missing
   borders / fields blending with background. Define the class explicitly
   instead of relying on per-template Tailwind classes. */
.input-neo {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(15, 23, 42, 0.12);
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-neo::placeholder {
    color: rgba(15, 23, 42, 0.4);
}
.input-neo:hover {
    border-color: rgba(15, 23, 42, 0.2);
}
.input-neo:focus {
    border-color: rgba(59, 130, 246, 0.5);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.dark .input-neo {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(241, 245, 249, 0.95);
}
.dark .input-neo::placeholder {
    color: rgba(241, 245, 249, 0.4);
}
.dark .input-neo:hover {
    border-color: rgba(255, 255, 255, 0.18);
}
.dark .input-neo:focus {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* ── Date inputs — make the native calendar indicator visible & clickable ──
   Default Chrome/Safari render this glyph nearly invisible on dark themes; users
   resort to manual typing. Force a hand cursor and bump opacity. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.85;
    filter: invert(0);
    padding: 0 4px;
}
.dark input[type="date"]::-webkit-calendar-picker-indicator,
.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.dark input[type="time"]::-webkit-calendar-picker-indicator,
.dark input[type="month"]::-webkit-calendar-picker-indicator,
.dark input[type="week"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* ── Neo-brutalism card ── */
.card-neo {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}
.dark .card-neo {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}
