/* ── Portal Tech — Custom styles ──
   Overrides and additions specific to the technician portal.
   Loaded after app.min.css to override where needed.
*/

/* ── Color variables ── */
:root {
  --portal-primary: #1B3A8C;
  --portal-accent: #2ECC71;
  --portal-danger: #E74C3C;
  --portal-warning: #F39C12;
  --portal-bg: #F5F7FA;
  --portal-card-bg: #FFFFFF;
}

/* ── Base ── */
body {
  background: var(--portal-bg);
}

/* ── Portal navbar (dark blue, used for both desktop nav and mobile header) ── */
.portal-navbar {
  background: var(--portal-primary);
  color: #fff;
}

/* ── Portal layout: override ERP sidebar margin ── */
.content-page {
  margin-left: 0 !important;
  width: 100% !important;
  padding: 0 !important;
}

.wrapper {
  padding: 0;
}

/* ── Mobile: add bottom padding for fixed nav ── */
@media (max-width: 767.98px) {
  .content-page {
    padding-bottom: 70px !important;
  }
}

/* ── Section labels (stats, legend, detail panels) ── */
.portal-section-label {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.675rem;
  color: var(--bs-secondary-color);
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

/* ── Mobile bottom navigation ── */
.portal-mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: white;
  border-top: 1px solid #E8ECF0;
  display: flex;
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
}

.portal-nav-item {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 9px;
  color: #999;
  padding: 4px 0;
}

.portal-nav-item .ti {
  font-size: 20px;
  color: #bbb;
}

.portal-nav-item.active .ti {
  color: var(--portal-accent);
}

.portal-nav-item.active span {
  color: var(--portal-primary);
  font-weight: 600;
}

/* ── Desktop navigation items ── */
.portal-desktop-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.portal-desktop-nav-item .ti {
  font-size: 20px;
  margin-bottom: 2px;
}

.portal-desktop-nav-item:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
}

.portal-desktop-nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.portal-desktop-nav-item.active .ti {
  color: var(--portal-accent);
}

/* ── Nav badge (action counter on icon — all .ti icons are 20px so position is stable) ── */
.portal-nav-badge {
  position: absolute;
  top: 0;
  right: 13px;
  font-size: .55rem;
  font-weight: 700;
  line-height: 1;
  min-width: 14px;
  padding: 2px 4px;
  border-radius: 999px;
  background: var(--portal-danger);
  color: #fff;
  text-align: center;
  pointer-events: none;
}

/* ── Hide border on empty containers (action form not yet loaded) ── */
.empty-hidden:empty { display: none; }

/* ── Text color helpers ── */
.text-portal-primary { color: var(--portal-primary); }

/* ── Appointment card ── */
.appointment-card {
  background: var(--portal-card-bg);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border-left: 4px solid var(--portal-primary);
  position: relative;
}

.appointment-card--technical-visit { border-left-color: var(--portal-primary); }
.appointment-card--installation { border-left-color: var(--portal-accent); }
.appointment-card--after-sales { border-left-color: var(--portal-danger); }
.appointment-card--reminder { border-left-color: var(--portal-warning); }
.appointment-card--personal-block { border-left-color: #AAA; background: #F9F9F9; }
.appointment-card--blocked { border-left-color: #AAA; background: #F9F9F9; }

.appointment-card__time .badge {
  font-size: 9px;
}

.appointment-card__type {
  font-size: 10px;
}

.appointment-card__address {
  font-size: 11px;
}

/* ── Badge styles ── */
.badge-new {
  position: absolute; top: 8px; right: 8px;
  background: var(--portal-accent); color: white;
  font-size: 9px; padding: 2px 6px; border-radius: 10px; font-weight: 700;
}

.badge-urgent {
  position: absolute; top: 8px; right: 8px;
  background: var(--portal-danger); color: white;
  font-size: 9px; padding: 2px 6px; border-radius: 10px; font-weight: 700;
}

/* ── FAB (Floating Action Button) ── */
.portal-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px; height: 52px;
  background: var(--portal-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.5);
  z-index: 1020;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

/* ── Date nav arrows ── */
.portal-nav-arrow {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.portal-nav-arrow:hover {
  background: rgba(255, 255, 255, 0.3);
}

.portal-nav-arrow.portal-nav-today {
  width: auto;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Desktop variant (light background context) */
.bg-white .portal-nav-arrow {
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
}

.bg-white .portal-nav-arrow:hover {
  background: #e0e0e0;
}

/* ── Week strip ── */
.week-strip {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  background: var(--portal-primary);
}

.day-pill {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  text-decoration: none;
}

.day-pill.active {
  background: var(--portal-accent);
  color: var(--portal-primary);
}

.day-pill .day-num {
  font-size: 14px;
  font-weight: 700;
  color: white;
}

.day-pill.active .day-num {
  color: var(--portal-primary);
}

/* ── Action buttons on cards ── */
.rdv-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.rdv-btn {
  flex: 1;
  padding: 6px;
  border-radius: 7px;
  border: none;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  text-align: center;
}

.rdv-btn--gps { background: #E8F0FE; color: var(--portal-primary); }
.rdv-btn--call { background: #E8F8F0; color: #27AE60; }
.rdv-btn--sms { background: #FEF9E7; color: #D4AC0D; }
.rdv-btn--done { background: var(--portal-primary); color: white; }
.rdv-btn--danger { background: var(--portal-danger); color: white; }

/* ── Detail view card ── */
.portal-detail-card {
  border-left: 4px solid var(--portal-primary);
  border-radius: 12px;
}

/* ── Detail sidebar (desktop) accent border ── */
.portal-detail-sidebar {
  border-left-width: 3px;
  border-left-style: solid;
}

/* ── Notes block ── */
.portal-notes {
  background: var(--portal-bg);
  border-radius: 8px;
}

/* ── Installation link block ── */
.portal-installation-link {
  background: #E8F0FE;
  border-radius: 8px;
}

/* ── Offcanvas bottom sheet (mobile create form) ── */
.offcanvas.portal-bottom-sheet {
  height: auto;
  max-height: 85vh;
  border-radius: 16px 16px 0 0;
}

/* ── Legend color dots ── */
.portal-legend-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
}

/* ── FullCalendar event cards (desktop) ── */
.fc-event {
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer;
}

.fc-event__inner {
  padding: 2px 4px;
  overflow: hidden;
}

.fc-event__time {
  font-size: 9px;
  opacity: 0.8;
}

.fc-event__name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.fc-event__type {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.8;
}

/* Ensure inner elements inherit the type color, no double borders */
.fc-event .fc-event-main {
  color: inherit !important;
  background: transparent !important;
  border: none !important;
}

/* Type-specific colors: subtle bg + left border + text color (on outer .fc-event only) */
.fc-event--technical-visit {
  background: #E8F0FE !important;
  border-left: 3px solid var(--portal-primary) !important;
  color: var(--portal-primary) !important;
}

.fc-event--installation {
  background: #E8F8F0 !important;
  border-left: 3px solid var(--portal-accent) !important;
  color: #27AE60 !important;
}

.fc-event--after-sales {
  background: #FDE8E8 !important;
  border-left: 3px solid var(--portal-danger) !important;
  color: #C0392B !important;
}

.fc-event--reminder {
  background: #FEF9E7 !important;
  border-left: 3px solid var(--portal-warning) !important;
  color: #D4AC0D !important;
}

.fc-event--personal-block,
.fc-event--blocked {
  background: #F5F5F5 !important;
  border-left: 3px solid #AAA !important;
  color: #888 !important;
}

/* ── FullCalendar slot cursor (desktop) ── */
.fc-timegrid-slot {
  cursor: cell;
}

/* ── FullCalendar non-business hours (auto from businessHours config) ── */
.fc-non-business {
  background: var(--bs-secondary-bg-subtle, #f0f0f0) !important;
}

/* ── FullCalendar blocked periods (background events) ── */
.fc-blocked-period {
  background: repeating-linear-gradient(
    45deg,
    var(--bs-dark-bg-subtle, #dee2e6),
    var(--bs-dark-bg-subtle, #dee2e6) 4px,
    var(--bs-secondary-bg-subtle, #e9ecef) 4px,
    var(--bs-secondary-bg-subtle, #e9ecef) 8px
  ) !important;
  cursor: not-allowed;
}

/* ── FullCalendar lunch break (background event) ── */
.fc-lunch-break {
  background: var(--bs-warning-bg-subtle, #fff3cd) !important;
  opacity: 0.6;
}

/* ── FullCalendar past day columns (full past days get a subtle grey overlay) ── */
.fc-col--past {
  background: var(--bs-dark-bg-subtle, #dee2e6) !important;
}

/* Today's column: past slot-lane rows get greyed (via .fc-slot--past on the row) */
.fc-col--today .fc-slot--past {
  /* Not directly possible — today uses the now-indicator line instead */
}

/* ── FullCalendar drag/select state ── */

/* Future columns: light green available highlight */
body.fc-dragging .fc-col--future,
body.fc-dragging .fc-col--today {
  background: var(--bs-success-bg-subtle, #d1f5e0) !important;
  transition: background 0.15s;
}

/* Past columns: dark grey blocked */
body.fc-dragging .fc-col--past {
  background: var(--bs-dark-bg-subtle, #c0c0c0) !important;
  cursor: not-allowed;
}

/* Non-business stays greyed during drag */
body.fc-dragging .fc-non-business {
  background: var(--bs-secondary-bg-subtle, #e0e0e0) !important;
}

/* Existing events become translucent during drag */
body.fc-dragging .fc-timegrid-event {
  opacity: 0.5;
  transition: opacity 0.15s;
}

/* ── FullCalendar day header (desktop) ── */
.fc-dayheader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
}

.fc-dayheader__name {
  font-size: 10px;
  font-weight: 600;
  color: #999;
}

.fc-dayheader__num {
  font-size: 14px;
  font-weight: 700;
  color: var(--portal-primary);
  margin-top: 2px;
}

.fc-dayheader__num--today {
  background: var(--portal-primary);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Desktop agenda layout ── */
.portal-desktop-agenda {
  height: calc(100vh - 60px);
}

.portal-sidebar-left {
  width: 240px;
}

.portal-sidebar-right {
  width: 350px;
}

/* ── Mini calendar ── */
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  text-align: center;
}
.mini-cal-grid .mc-header {
  font-size: 9px;
  font-weight: 600;
  color: var(--bs-secondary);
  padding: 2px 0;
}
.mini-cal-grid .mc-day {
  font-size: 11px;
  padding: 3px 0;
  border-radius: 4px;
  cursor: pointer;
  color: var(--bs-body-color);
  position: relative;
  line-height: 1.3;
}
.mini-cal-grid .mc-day:hover {
  background: var(--bs-primary-bg-subtle);
}
.mini-cal-grid .mc-day.mc-today {
  background: var(--portal-primary);
  color: white;
  border-radius: 50%;
  font-weight: 700;
}
.mini-cal-grid .mc-day.mc-selected {
  outline: 2px solid var(--portal-primary);
  border-radius: 50%;
}
.mini-cal-grid .mc-day.mc-other {
  color: var(--bs-tertiary-color);
}
.mini-cal-grid .mc-day.mc-has-rdv {
  color: var(--portal-accent);
  font-weight: 700;
}

/* ── Form labels ── */
.portal-form-label {
  font-size: 12px;
}

/* ── Google Places autocomplete dropdown: above modals/offcanvas ── */
.pac-container {
  z-index: 10000 !important;
}

/* ── Mobile: ensure time input shows full value (e.g. "13:00") ── */
@media (max-width: 767.98px) {
  input[type="time"].form-control-sm {
    min-width: 0;
    padding-left: 6px;
    padding-right: 2px;
    font-size: 13px;
  }
}

/* ── Audit info ── */
.portal-audit {
  font-size: 10px;
  color: #AAA;
}

/* ── Submit button ── */
.portal-btn-submit {
  background: var(--portal-primary);
  color: white;
  border-radius: 10px;
  padding: 12px;
}

.portal-btn-submit:hover {
  background: #152e6e;
  color: white;
}

/* ── Progress bar thin ── */
.portal-progress-thin {
  height: 8px;
}
