/**
 * InstallaCRM Custom Styles (fixes.css)
 * ======================================
 * Custom CSS classes and overrides for the InstallaCRM application.
 * This file supplements the Bootstrap/Falcon theme with app-specific styles.
 *
 * Table of Contents:
 * 0. Layout Stability (CLS Prevention)
 * 1. Navigation Styles
 * 2. Typography (Font Sizes)
 * 3. Page Background
 * 4. Form Helpers
 * 5. Utility Classes
 * 6. Card Variants (Glass/Clear)
 * 7. Text Colors for Cards
 * 8. Button Overrides for Glass Cards
 * 9. Form Input Adjustments
 * 10. Card Header/Body/Footer Contrast
 * 11. Table Styles
 * 12. Development Helpers
 * 13. User Badge Component
 * 14. Content Editable Styles
 * 15. Noteboard Component
 * 16. Address/Map Styles
 * 17. Form Help Blocks
 * 18. Cursor Utilities
 */


/* ==========================================================================
   0. LAYOUT STABILITY (CLS Prevention)
   ========================================================================== */

/**
 * Alpine.js x-cloak - hide elements until Alpine initializes
 * Prevents flash of unstyled/unhidden content
 */
[x-cloak] {
  display: none !important;
}

/**
 * Aspect ratio utilities for preventing layout shift on images
 * Usage: <div class="aspect-ratio-16x9"><img src="..." /></div>
 */
.aspect-ratio-1x1 { aspect-ratio: 1 / 1; }
.aspect-ratio-4x3 { aspect-ratio: 4 / 3; }
.aspect-ratio-16x9 { aspect-ratio: 16 / 9; }
.aspect-ratio-21x9 { aspect-ratio: 21 / 9; }

/**
 * Image containers - ensure images don't cause layout shift
 * Images inside these containers will fill and maintain aspect ratio
 */
.img-container {
  position: relative;
  overflow: hidden;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/**
 * Avatar sizing - explicit dimensions to prevent reflow
 * Used in navigation and user displays
 */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-xl {
  width: 40px;
  height: 40px;
}

.avatar-l {
  width: 36px;
  height: 36px;
}

.avatar-m {
  width: 32px;
  height: 32px;
}

.avatar-s {
  width: 24px;
  height: 24px;
}

/**
 * Reserve space for sidebar to prevent content shift
 * The sidebar width is known, so we reserve space immediately
 */
.navbar-vertical.navbar-expand-xl {
  min-width: 250px;
}

.navbar-vertical.navbar-expand-xl.navbar-vertical-collapsed {
  min-width: 56px;
}

/**
 * Skeleton loader placeholder - use for async content
 * Prevents layout shift by reserving space
 */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/**
 * Content stability - prevent font-loading shifts
 * Apply to text areas that might shift when fonts load
 */
.content-stable {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/**
 * Card and photo thumbnail consistent heights
 */
.thumb-square {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.thumb-landscape {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb-wide {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}


/* ==========================================================================
   1. NAVIGATION STYLES
   ========================================================================== */

/** Glass effect for vertical navbar */
.navbar-glass-shadow {
  background-color: rgba(59, 130, 211, 0.95);
}

.navbar-vertical-collapsed-hover .navbar-glass .navbar-vertical-content {
  background-color: rgba(59, 130, 211, 0.95);
}

/** Hamburger menu button hover/focus states */
.navbar-toggler-humburger-icon.offcanvas-toggle:hover,
.navbar-toggler-humburger-icon.offcanvas-toggle:focus {
  background-color: rgba(255, 255, 255, 0.2) !important;

}

.navbar-toggler-humburger-icon.offcanvas-toggle:hover {
  outline: 1px solid white;
}

.navbar-vertical .navbar-nav .nav-item .navbar-vertical-label {
  color: var(--installa-info);
}

.navbar-vertical-content .nav-link.active .nav-link-text,
.navbar-vertical-content .nav-link.active .nav-link-icon {
  color: var(--installa-warning)
}

.navbar-vertical-content .nav-link.active .nav-link-text,
.navbar-vertical-content .nav-link.active .nav-link-icon {
  color: var(--installa-warning);
  font-weight: bold;
}

.navbar-toggle-icon .toggle-line,
.navbar-toggle-icon::before,
.navbar-toggle-icon::after {
  background-color: var(--installa-gray-500);
}



/* ==========================================================================
   2. TYPOGRAPHY - Extended Font Sizes
   ========================================================================== */

/**
 * Extended Bootstrap font-size scale (fs-7 through fs-11)
 * Uses 1.2x ratio scale similar to Bootstrap's default
 * Usage: class="fs-8" for 1.2rem text
 */
.fs-11 {
  font-size: 0.6944444444rem !important;
}

.fs-10 {
  font-size: 0.8333333333rem !important;
}

.fs-9 {
  font-size: 1rem !important;
}

.fs-8 {
  font-size: 1.2rem !important;
}

.fs-7 {
  font-size: 1.44rem !important;
}

.fs-6 {
  font-size: 1.728rem !important;
}

.fs-5 {
  font-size: 2.0736rem !important;
}

.fs-4 {
  font-size: 2.48832rem !important;
}

.fs-3 {
  font-size: 2.985984rem !important;
}

.fs-2 {
  font-size: 3.5831808rem !important;
}

.fs-1 {
  font-size: 4.29981696rem !important;
}


/* ==========================================================================
   3. PAGE BACKGROUND
   ========================================================================== */

/** Blue gradient background - brand color scheme */
body {
  background: rgb(69, 155, 226);
  background: linear-gradient(90deg, rgba(59, 130, 211, 1) 0%, rgba(71, 145, 230, 1) 35%, rgba(49, 114, 197, 1) 100%);
}


/* ==========================================================================
   4. FORM HELPERS
   ========================================================================== */

/** Hide help text until hover for cleaner forms */
.form-group small.text-muted {
  visibility: hidden;
}

.form-group:hover small.text-muted {
  visibility: visible;
}


/* ==========================================================================
   5. UTILITY CLASSES
   ========================================================================== */

/** Large icon for empty states and hero sections */
.icon-giant {
  font-size: 5em;
}

/** Report container styling */
.report {
  padding: 1em;
  border: 1px solid #ccc;
  border-radius: 0.5em;
}

/** Code block styling (dark theme) */
pre:has(> code) {
  padding: 1em;
  background-color: rgba(0, 0, 0, 0.9);
  color: #f7f7f7;
}

/** Right-aligned action bar */
.actionbar {
  text-align: right;
}


/** Fixed height image for consistent card layouts */
.fixed-height-img {
  height: 240px;
  object-fit: cover;
  width: 100%;
}


/* ==========================================================================
   6. CARD VARIANTS
   ========================================================================== */

/** Comment card: Remove bottom margin from last paragraph */
.comment .card-body p:last-child {
  margin-bottom: 0;
}

/** Google Map container within supermap component */
.supermap .googlemap {
  width: 100%;
  height: 600px;
}

/** Summary card backgrounds - white with subtle gradients */
.summary-inner {
  background: rgb(255, 255, 255);
}

/** Customer summary card - blue gradient accent */
.summary-customer .summary-inner {
  background: linear-gradient(115deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 70%, rgba(245, 250, 255, 1) 85%, rgba(187, 222, 255, 1) 100%);
}

/** Overdue customer summary - orange gradient accent */
.summary-customer .overdue {
  background: linear-gradient(115deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 70%, rgba(255, 253, 245, 1) 85%, rgba(255, 213, 187, 1) 100%);
}

/** Lead score badge styling */
.badge.score {
  font-size: 150%;
  color: white;
  margin-left: 3px;
}

/** Triage badge for priority indicators */
.badge.triage {
  color: white;
}

.badge.triage:has(span) {
  padding-right: 0px;
}

/**
 * Card Clear Variant
 * Semi-transparent white background for glass-like appearance
 * Usage: <div class="card card-clear">
 */
.card.card-clear {
  background-color: rgba(255, 255, 255, 0.25);
}

.card-header {
  padding: 0.75rem 0.75rem;
}

.project-tabs {
  padding: 0;
}

.project-tabs .nav-tabs {
  background-color: var(--installa-primary);
  color: var(--installa-gray-700);
}

.project-tabs .nav-tabs .nav-link {
  padding: 0.75rem 0.75rem;
  border-right: 1px solid var(--installa-info) !important;
}


/* ==========================================================================
   7. TEXT COLORS FOR CARDS
   ========================================================================== */

/**
 * Dark text for light-background containers
 * Ensures readability on white/light card backgrounds
 */
.card-body,
.card-footer,
.modal-body,
.modal-footer,
.table,
.list-group-item,
.accordion-body,
.alert,
label {
  color: #344050;
}

/**
 * Keep inherited text color for glass/transparent cards
 * These cards have dark backgrounds, so text should stay light
 */
.card-glass .card-body,
.card-glass .card-footer,
.card-glass .list-group-item,
.card-clear .card-body,
.card-clear .card-footer {
  color: inherit;
}

/**
 * Adjust .text-mid for better visibility on glass backgrounds
 * Darker than normal to contrast with translucent backgrounds
 */
.card-glass .text-mid,
.card-clear .text-mid {
  color: rgba(60, 60, 60, 0.7) !important;
}


/* ==========================================================================
   8. BUTTON OVERRIDES 
   ========================================================================== */

/**
 * Outline buttons need solid-ish backgrounds
 * to be visible against translucent card backgrounds and other dark backgrounds
 */
.btn-outline-primary {
  background-color: rgba(13, 110, 253, 0.5);
  border-color: #0d6efd;
  color: #fff;
}

.btn-outline-secondary {
  background-color: rgba(108, 117, 125, 0.5);
  border-color: #6c757d;
  color: #fff;
}

.btn-outline-success {
  background-color: rgba(25, 135, 84, 0.5);
  border-color: #198754;
  color: #fff;
}

.btn-outline-info {
  background-color: rgba(13, 202, 240, 0.5);
  border-color: #0dcaf0;
  color: #fff;
}

.btn-outline-warning {
  background-color: rgba(255, 193, 7, 0.5);
  border-color: #ffc107;
  color: #000;
}

.btn-outline-danger {
  background-color: rgba(220, 53, 69, 0.5);
  border-color: #dc3545;
  color: #fff;
}

.btn-outline-light {
  background-color: rgba(225, 225, 225, 0.2);
  border-color: rgba(225, 225, 225, 0.5);
  color: #777;
}


/* ==========================================================================
   9. FORM INPUT ADJUSTMENTS
   ========================================================================== */

/** More vertical, less horizontal padding for inputs */
.form-control,
.form-select {
  padding: 0.5rem 0.5rem;
  border: 1px solid #ccc;
}


/* ==========================================================================
   10. CARD HEADER/BODY/FOOTER CONTRAST
   ========================================================================== */

.card.card-glass {
  background-color: rgba(255, 255, 255, 0.80);
}

/** Standard cards: white header, light gray body/footer */
.card:not(.card-glass):not(.card-clear)>.card-header {
  background-color: rgba(255, 255, 255, 1);
}

.card:not(.card-glass):not(.card-clear)>.card-body {
  background-color: rgba(248, 249, 250, 1);
}

.card:not(.card-glass):not(.card-clear)>.card-footer {
  background-color: rgba(248, 249, 250, 1);
}

/** Glass cards: subtle transparent backgrounds */
.card-glass>.card-header {
  background-color: rgba(255, 255, 255, 0.15);
}

.card-glass>.card-body {
  background-color: rgba(0, 0, 0, 0.03);
}

.card-glass>.card-footer {
  background-color: rgba(0, 0, 0, 0.05);
}


/* ==========================================================================
   11. TABLE STYLES
   ========================================================================== */

/** Large row variant for emphasis */
tr.bigrow {
  font-size: 150%;
}


/* ==========================================================================
   12. DEVELOPMENT HELPERS
   ========================================================================== */

/**
 * Visual indicator for work-in-progress features
 * Usage: <div class="card development-placeholder">
 */
.development-placeholder {
  opacity: 0.9;
  outline: 1px dashed red;
  box-shadow: inset 0 0 10px 10px rgba(255, 0, 0, 0.5);
}


/* ==========================================================================
   13. USER BADGE COMPONENT
   ========================================================================== */

/**
 * Compact user display with avatar
 * Usage: <span class="user-badge"><img src="avatar.jpg"><span>Name</span></span>
 */
.user-badge {
  display: inline-block;
  padding: 2px;
  border: 1px solid #eee;
  background: #fff;
  color: #111;
  border-radius: 24px;
  text-align: left;
  min-width: 160px;
}

.user-badge span {
  padding: 0 10px 0 0;
}

.user-badge img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 16px;
}

.user-badge:hover {
  background-color: #106DB8;
}

.user-badge:hover span {
  color: #fff;
}


/* ==========================================================================
   14. CONTENT EDITABLE STYLES
   ========================================================================== */

/** Remove default outline for contenteditable elements */
[contenteditable] {
  outline: 0px solid transparent;
}

/** Visual indicator when editing inline content */
.editing {
  outline: 5px dashed rgba(252, 151, 0, 0.9);
}


/* ==========================================================================
   15. NOTEBOARD COMPONENT
   ========================================================================== */

/**
 * Sticky note / noteboard styling
 * Yellow background reminiscent of physical sticky notes
 */
.noteboard {
  padding: 20px;
  font-size: 22px;
  line-height: 140%;
  color: #171717;
  background: #F5EEA6;
}

/** Noteboard in edit mode - more vibrant, with inner shadow */
.noteboard.editing {
  background-color: #f9f193;
  box-shadow: inset 2px 2px 1em rgb(201, 154, 5);
  color: #000;
  font-style: italic;
}


/* ==========================================================================
   16. ADDRESS/MAP STYLES
   ========================================================================== */

/** Responsive address map image */
.address-map {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  max-height: 240px;
  width: 100%;
}


/* ==========================================================================
   17. FORM HELP BLOCKS
   ========================================================================== */

/** Help text below form inputs - hidden until hover */
.main-form-area .help-block {
  font-size: 14px;
  line-height: 16px;
  margin-top: 2px;
  margin-bottom: 0;
  padding: 0;
  opacity: 0;
}

.main-form-area input:hover+.help-block,
.main-form-area select:hover+.help-block,
.main-form-area textarea:hover+.help-block {
  opacity: 0.7;
  transition: opacity 0.3s ease-in-out;
}

/** Required field indicator (asterisk) */
.main-form-area .form-group .control-label sup {
  font-size: 18px;
  color: #FF9719;
  line-height: 80%;
}


/* ==========================================================================
   18. CURSOR UTILITIES
   ========================================================================== */

/**
 * Cursor utility classes for interactive elements
 * Usage: <div class="grab"> for grab cursor on hover
 */
.alias {
  cursor: alias;
}

.all-scroll {
  cursor: all-scroll;
}

.auto {
  cursor: auto;
}

.cell {
  cursor: cell;
}

.col-resize {
  cursor: col-resize;
}

.context-menu {
  cursor: context-menu;
}

.copy {
  cursor: copy;
}

.crosshair {
  cursor: crosshair;
}

.default {
  cursor: default;
}

.e-resize {
  cursor: e-resize;
}

.ew-resize {
  cursor: ew-resize;
}

.grab {
  cursor: -webkit-grab;
  cursor: grab;
}

.grabbing {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.help {
  cursor: help;
}

.move {
  cursor: move;
}

.n-resize {
  cursor: n-resize;
}

.ne-resize {
  cursor: ne-resize;
}

.nesw-resize {
  cursor: nesw-resize;
}

.ns-resize {
  cursor: ns-resize;
}

.nw-resize {
  cursor: nw-resize;
}

.nwse-resize {
  cursor: nwse-resize;
}

.no-drop {
  cursor: no-drop;
}

.none {
  cursor: none;
}

.not-allowed {
  cursor: not-allowed;
}

.pointer {
  cursor: pointer;
}

.progress {
  cursor: progress;
}

.row-resize {
  cursor: row-resize;
}

.s-resize {
  cursor: s-resize;
}

.se-resize {
  cursor: se-resize;
}

.sw-resize {
  cursor: sw-resize;
}

.text {
  cursor: text;
}

.w-resize {
  cursor: w-resize;
}

.wait {
  cursor: wait;
}

.zoom-in {
  cursor: zoom-in;
}

.zoom-out {
  cursor: zoom-out;
}