/*
 * deboTrack theme — inspired by deboistech.in: black, white and one green accent.
 * Loaded on every admin page (after Krayin's CSS and public/debotrack/neutral.css) by
 * resources/views/debotrack/layout/head.blade.php.
 *
 *   Light: #FFFFFF / #F5F5F5 surfaces, #0A0A0A text, accent #1F7A3A
 *   Dark:  #0A0A0A / #171717 surfaces, #FAFAFA text, accent #4AAE5E (with black text on it)
 */

:root {
    --brand-color: #1F7A3A;
    --dt-accent-ink: #FFFFFF;              /* text on accent */
    --dt-accent-tint: rgba(31, 122, 58, 0.10);
    --dt-ink: #0A0A0A;
    --dt-muted: #737373;
}

html.dark {
    --brand-color: #4AAE5E;
    --dt-accent-ink: #0A0A0A;
    --dt-accent-tint: rgba(74, 174, 94, 0.15);
    --dt-ink: #FAFAFA;
    --dt-muted: #A3A3A3;
}

/* ---------- Typography: Manrope, as on deboistech.in ---------- */
body, .font-inter, button, input, select, textarea {
    font-family: 'Manrope', 'Inter', ui-sans-serif, system-ui, sans-serif !important;
}

/* ---------- Pill buttons ---------- */
.primary-button, .secondary-button, .transparent-button {
    border-radius: 9999px !important;
}

.primary-button {
    color: var(--dt-accent-ink) !important;
}

.secondary-button {
    border-color: var(--dt-ink) !important;
    color: var(--dt-ink) !important;
    background: transparent !important;
}

.secondary-button:hover {
    background: var(--dt-accent-tint) !important;
}

/* Text sitting on the accent colour: white in light mode, black in dark mode (like the site). */
html.dark .bg-brandColor,
html.dark .bg-brandColor *,
html.dark .dark\:bg-brandColor,
html.dark .dark\:bg-brandColor * {
    color: #0A0A0A !important;
}

/* ---------- Remaining hard-coded blue accents → green ---------- */
.text-blue-600, .text-sky-600, .hover\:text-sky-600:hover { color: var(--brand-color) !important; }
.bg-sky-600, .peer:checked ~ .peer-checked\:bg-blue-600 { background-color: var(--brand-color) !important; }
.border-blue-600 { border-color: var(--brand-color) !important; }
.bg-sky-100, .hover\:bg-blue-100:hover { background-color: var(--dt-accent-tint) !important; }
.focus\:ring-blue-300:focus { --tw-ring-color: var(--dt-accent-tint) !important; }

/* Keep Krayin's own dark-mode colours winning over the remaps above */
html.dark .dark\:text-white { color: #FAFAFA !important; }
html.dark .dark\:bg-white { background-color: #FAFAFA !important; }
html.dark .dark\:bg-brandColor { background-color: var(--brand-color) !important; }

/* ---------- Surfaces ---------- */
html.dark body { background-color: #0A0A0A; }

/* ---------- Logo: black text in light mode, white text in dark mode ---------- */
html.dark img[src*="debotrack-logo.png"] {
    content: url("/storage/configuration/debotrack-logo-dark.png");
}

/* =====================================================================
   Mobile & tablet
   ===================================================================== */

/* Lead page: the stage bar (8 stages) wraps at every screen width instead of forcing a very wide page. */
div.flex.w-full.max-w-full:has(> .stage) { flex-wrap: wrap; row-gap: 6px; }

@media (max-width: 767px) {
    /* Page headers (Leads, Quotes, …): title on one row, actions on the next. */
    .scroll-reactive-sticky.flex.justify-between { flex-wrap: wrap; gap: 10px; position: static; }
    .scroll-reactive-sticky.flex.justify-between > div:last-child { flex-wrap: wrap; gap: 8px; }

    /* deboTrack's Import / Export buttons in the Leads header. */
    div[style*="margin-left:auto"]:has(> a[href*="/leads/csv/"]) { margin: 0 !important; }

    /* Smaller buttons so headers fit; still ≥ 36px tall for touch. */
    .primary-button, .secondary-button, .transparent-button { padding: 7px 14px !important; font-size: 13px; min-height: 36px; }

    /* Leads/quotes phone cards: hide rows with no value (hidden columns render empty). */
    .grid.gap-2 > div.flex.flex-wrap.items-baseline:has(> span.break-words:empty) { display: none; }
    .grid.gap-2 > div.flex.flex-wrap.items-baseline { align-items: center; }
    select.dt-status { width: auto !important; min-width: 150px; font-size: 13px; padding: 5px 8px; }

    /* Create / Edit Lead: one field per row. */
    #lead-details .grid.grid-cols-2 { grid-template-columns: minmax(0, 1fr) !important; }

    /* iOS Safari zooms into inputs under 16px — keep form text at 16px on phones. */
    input.w-full, select.w-full, textarea.w-full, .dt-input, input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], select, textarea { font-size: 16px !important; }

    /* deboTrack pages (Programs, Import/Export): batch tables scroll sideways inside their card. */
    .dt-program .dt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dt-program .dt-table { min-width: 680px; }
    .dt-program-head .dt-actions { width: 100%; justify-content: flex-start; }
    .dt-meta { gap: 6px 14px; }
    .dt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .dt-card { padding: 12px; }

    /* Status modal & toast fit small screens. */
    .dt-modal { padding: 16px; }
    .dt-toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
}


/* =====================================================================
   Lead page — theme colours for the stage bar, action tiles and timeline
   ===================================================================== */

/* Stage bar: reached stages in the brand green (was a bright green), "Not Interested" in neutral grey. */
[class*="!bg-green-500"] { background-color: var(--brand-color) !important; color: var(--dt-accent-ink) !important; }
[class*="after:bg-green-500"]::after, [class*="before:bg-green-500"]::before { background-color: var(--brand-color) !important; }
[class*="!bg-red-500"] { background-color: #737373 !important; color: #FFFFFF !important; }
[class*="after:bg-red-500"]::after, [class*="before:bg-red-500"]::before { background-color: #737373 !important; }
html.dark [class*="!bg-red-500"] { color: #0A0A0A !important; }

/* Mail / File / Note / Activity tiles: neutral outline tiles with a green icon (were four pastel colours). */
[class*="h-[74px]"][class*="w-[84px]"] {
    background: transparent !important;
    color: var(--dt-ink) !important;
    border: 1px solid #D4D4D4 !important;
    width: 80px !important;   /* four tiles (File / Note / Activity / Enquiry) fit on one row of the 394px side panel */
}
[class*="h-[74px]"][class*="w-[84px]"]:hover { border-color: var(--brand-color) !important; background: var(--dt-accent-tint) !important; }
[class*="h-[74px]"][class*="w-[84px]"] span[class*="icon-"] { color: var(--brand-color) !important; }
html.dark [class*="h-[74px]"][class*="w-[84px]"] { border-color: #404040 !important; }

/* Activity timeline icons: one brand-tinted style for every activity type (were yellow / cyan / orange / blue). */
[class*="min-h-9"][class*="min-w-9"][class*="rounded-full"] {
    background-color: var(--dt-accent-tint) !important;
    color: var(--brand-color) !important;
}

/* Empty values in "About Lead" show a dash on the same line as the label (inside Krayin's inline-edit box). */
[data-dt-empty] > .group > .flex::after { content: "-"; color: #A3A3A3; font-weight: 400; order: -1; }

/* Student avatars (initials): brand tint instead of random pastel colours. */
[class*="min-w-9"][class*="text-xs"][class*="rounded-full"]:not([class*="min-h-9"]) {
    background-color: var(--dt-accent-tint) !important;
    color: var(--brand-color) !important;
    font-weight: 600;
}

/* =====================================================================
   Sidebar pop-out submenu (Students → Students / Schools & Colleges)
   A compact card right beside the sidebar, in both the expanded and the
   collapsed (icons only) states. Was a full-height panel fixed 200px from
   the left, which left a gap next to the collapsed sidebar and hid the page.
   ===================================================================== */
.sidebar-rounded[class*="min-w-[140px]"] {
    top: var(--dt-fly-top, 72px) !important;
    left: 202px;
    height: auto !important;
    max-height: calc(100vh - 140px);
    min-width: 210px !important;
    padding: 8px 0 !important;
    border: 1px solid #E5E5E5 !important;
    border-radius: 12px !important;
    background: #FFFFFF;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
    overflow: hidden;
}
.sidebar-rounded[class*="min-w-[140px]"]::before,
.sidebar-rounded[class*="min-w-[140px]"]::after { display: none !important; }
.sidebar-rounded[class*="min-w-[140px]"] .journal-scroll { height: auto !important; max-height: calc(100vh - 170px); }
.sidebar-collapsed .sidebar-rounded[class*="min-w-[140px]"] { left: 72px; }
html.dark .sidebar-rounded[class*="min-w-[140px]"] {
    background: #171717;
    border-color: #262626 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}

/* ---------------------------------------------------------------------------
   Footer message bar + sidebar collapse button
   Both are fixed to the bottom. They used to differ in height (so their top
   borders didn't line up) and the bar ran underneath the sidebar. Now they are
   the same height, and on desktop the bar starts where the sidebar ends
   (200px, or 70px when collapsed), giving one continuous line.
   --------------------------------------------------------------------------- */
:root { --dt-footer-h: 52px; }

div.fixed.bottom-0.left-0.right-0 > div {
    box-sizing: border-box;
    height: var(--dt-footer-h);
    padding: 0 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

div.fixed.bottom-0[class*="max-w-[200px]"] { height: var(--dt-footer-h); display: flex; align-items: center; box-sizing: border-box; }
div.fixed.bottom-0[class*="max-w-[200px]"] > div { padding-top: 0; padding-bottom: 0; }

@media (min-width: 1024px) {
    div.fixed.bottom-0.left-0.right-0 { left: 200px !important; transition: left .3s; }
    .sidebar-collapsed div.fixed.bottom-0.left-0.right-0 { left: 70px !important; }
}

/* Lead page, left side: the title/actions stay put while the Student card and the Lead Details card scroll
   together as one list (desktop; on small screens the page simply scrolls). */
@media (min-width: 1024px) {
    #dt-lead-panel { max-height: calc(100vh - 73px - 64px); }
    #dt-lead-panel > div:first-child { flex-shrink: 0; }
    #dt-lead-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
    #dt-lead-scroll > div:last-child { border-bottom: 0; }
}

/* Import / Export / Create buttons look the same on every list page: Krayin's own "Export" toggle (a
   transparent button) is drawn like the secondary (outlined) buttons next to it. */
.transparent-button:has(> .icon-export) {
    border-color: var(--dt-ink) !important;
    color: var(--dt-ink) !important;
    background: transparent !important;
}
.transparent-button:has(> .icon-export):hover { background: var(--dt-accent-tint) !important; }
.transparent-button:has(> .icon-export) > .icon-export { color: inherit !important; }
.transparent-button:has(> .icon-export) > .icon-export::before { content: "\e948" !important; }

/* ---------- Create / edit forms ----------
   The lead form's columns were squeezed into half the page; give them room, and tidy spacing, labels and
   errors on every form page. */
#lead-details > div:last-child,
#contact-person > div:last-child { width: 100% !important; max-width: 760px; }

#lead-details textarea[name="description"] { min-height: 96px; }

form label.required::after, form label[class*="required"]::after { color: #dc2626; }
form [class*="text-red-600"][class*="text-xs"], form .text-red-600 { font-size: 12.5px; margin-top: 4px; }
form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
form select { min-height: 40px; }

/* ---------- Clock, lower right corner (sits on the footer bar) ---------- */
#dt-clock {
    position: fixed; right: 16px; bottom: 0; height: var(--dt-footer-h, 52px); z-index: 60;
    display: flex; align-items: center; gap: 10px; pointer-events: none;
    font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--dt-ink);
}
#dt-clock .dt-clock-date { color: var(--dt-muted); font-weight: 500; }
@media (max-width: 767px) { #dt-clock .dt-clock-date { display: none; } #dt-clock { right: 10px; } }
