/* ==========================================================================
   ASA DECORATION - UNIVERSAL RESPONSIVE & MOBILE DESIGN SYSTEM
   Modern Charcoal & ASA Red Theme • Professional • Strong • 100% Mobile Optimized
   Palette:
     - Charcoal Black: #1A1A1A
     - ASA Red:        #9B1C1C
     - Dark Red:       #6E0F0F
     - Modern Gray:    #6B6B6B
     - Light Gray:     #D9D9D9
     - Off White:      #F8F8F8
   ========================================================================== */

:root {
  /* Brand Palette (ASA DECORATION Official) */
  --charcoal-black: #1A1A1A;
  --charcoal-dark:  #141414;
  --charcoal-mid:   #252525;
  --charcoal-light: #333333;
  --asa-red:        #9B1C1C;
  --dark-red:       #6E0F0F;
  --bright-red:     #B92525;
  --modern-gray:    #6B6B6B;
  --light-gray:     #D9D9D9;
  --off-white:      #F8F8F8;
  --pure-white:     #FFFFFF;

  /* Gradients */
  --charcoal-gradient: linear-gradient(135deg, #1A1A1A 0%, #2E2E2E 100%);
  --red-gradient:      linear-gradient(135deg, #9B1C1C 0%, #6E0F0F 100%);
  --red-gradient-hover:linear-gradient(135deg, #B92525 0%, #801414 100%);
  --red-soft:          rgba(155, 28, 28, 0.08);
  --red-soft-border:   rgba(155, 28, 28, 0.25);

  /* System Compatibility Variables (Mapping old Navy/Gold to ASA Palette) */
  --navy:              #1A1A1A;
  --navy-light:        #282828;
  --gold:              #9B1C1C;
  --gold-dark:         #6E0F0F;
  --gold2:             #B92525;
  --primary:           #1A1A1A;
  --bg-page:           #F8F8F8;
  --card-bg:           #FFFFFF;
  --border:            #E5E7EB;
  --text-main:         #1A1A1A;
  --text-muted:        #6B6B6B;
  --surface:           #F3F4F6;
  --surface-gray:      #D9D9D9;
  --danger:            #DC2626;
  --success:           #16A34A;
  --bottom-nav-height: 64px;

  /* Elevation Shadows & Glows */
  --shadow-sm:  0 2px 8px rgba(26, 26, 26, 0.05);
  --shadow-md:  0 6px 20px rgba(26, 26, 26, 0.08);
  --shadow-lg:  0 14px 36px rgba(26, 26, 26, 0.12);
  --red-glow:   0 4px 18px rgba(155, 28, 28, 0.32);
}

/* 1. Global Viewport & Touch Optimization */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--bg-page);
  color: var(--text-main);
}

/* 2. Topbar Component */
.topbar {
  background: var(--charcoal-gradient) !important;
  border-bottom: 3px solid var(--asa-red) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22) !important;
}
.topbar a, .topbar .brand-title, .topbar span {
  color: #FFFFFF;
}
.brand-logo, .brand-img {
  background: #FFFFFF !important;
  border: 1.5px solid var(--asa-red) !important;
  border-radius: 8px !important;
  padding: 2px 6px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18) !important;
  object-fit: contain;
}

@media (max-width: 768px) {
  .topbar {
    padding: 8px 12px !important;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar .brand-text,
  .topbar h1, .topbar h2, .topbar h4, .topbar h5 {
    font-size: 15px !important;
  }
  .topbar img {
    height: 30px !important;
  }
  .topbar .soft-btn,
  .topbar .btn {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }
  .topbar .d-none-mobile {
    display: none !important;
  }
}

/* 3. Responsive Containers & Layouts */
@media (max-width: 768px) {
  .main-wrap,
  .container,
  .container-fluid,
  .app-container,
  .page-wrap {
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-top: 10px !important;
    max-width: 100% !important;
  }

  body.has-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + 20px) !important;
  }

  /* Cards & Panels */
  .card, .cardglass, .panel, .box-card, .stat-card, .inv-card {
    padding: 14px !important;
    border-radius: 16px !important;
    margin-bottom: 12px !important;
  }

  /* Typography on Mobile */
  h1 { font-size: 1.4rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.15rem !important; }
  h4 { font-size: 1.05rem !important; }
  h5 { font-size: 0.95rem !important; }

  /* Forms & Inputs */
  input[type="text"],
  input[type="number"],
  input[type="tel"],
  input[type="password"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 15px !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
  }

  /* Buttons on Mobile */
  .btn, button, .btn-gold {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
  }
  .btn-sm {
    min-height: 34px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
  }

  /* Grids to Single Column */
  .row-cols-md-3 > *,
  .row-cols-md-4 > *,
  .row-cols-lg-4 > *,
  .row-cols-md-2 > *,
  .grid-2, .grid-3, .grid-4,
  .invoices-grid, .stats-grid, .cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* Tables */
  .table-responsive {
    border-radius: 14px !important;
    margin-bottom: 15px !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }
  table th, table td {
    padding: 10px 12px !important;
    font-size: 13px !important;
    white-space: nowrap;
  }

  /* Modals */
  .modal-dialog {
    margin: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
  .modal-content {
    border-radius: 18px !important;
  }

  /* Nav Tabs */
  .tab-nav, .nav-pills, .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px !important;
  }
  .tab-btn, .nav-link {
    white-space: nowrap !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    flex-shrink: 0;
  }
}

/* 4. Unified ASA Brand Buttons & Links */
.btn-gold, .btn-primary, .btn-brand {
  background: var(--red-gradient) !important;
  color: #FFFFFF !important;
  border: 1px solid var(--dark-red) !important;
  font-weight: 800;
  border-radius: 10px;
  box-shadow: var(--red-glow) !important;
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-gold:hover, .btn-primary:hover, .btn-brand:hover {
  background: var(--red-gradient-hover) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(155, 28, 28, 0.45) !important;
}
.btn-gold:active, .btn-primary:active, .btn-brand:active {
  transform: scale(0.98);
}

.btn-outline-brand, .btn-outline-gold {
  border: 1.5px solid var(--asa-red) !important;
  color: var(--asa-red) !important;
  background: transparent !important;
  font-weight: 700;
  border-radius: 10px;
  transition: all 0.2s;
}
.btn-outline-brand:hover, .btn-outline-gold:hover {
  background: var(--red-soft) !important;
  color: var(--dark-red) !important;
  border-color: var(--dark-red) !important;
}

/* 5. Navigation Icons & Pills */
.nav-icon-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #FFFFFF !important;
  padding: 6px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.nav-icon-btn:hover {
  background: var(--asa-red) !important;
  border-color: var(--asa-red) !important;
  color: #FFFFFF !important;
}

.cat-pill, .filter-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  color: var(--text-main);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
}
.cat-pill:hover, .filter-btn:hover:not(.active) {
  background: #FFFFFF;
  border-color: var(--asa-red);
  color: var(--asa-red);
}
.cat-pill.active, .filter-btn.active {
  background: var(--red-gradient) !important;
  border-color: var(--dark-red) !important;
  color: #FFFFFF !important;
  box-shadow: var(--red-glow);
}

/* 6. Form Inputs & Live Search Bars */
.search-input, .form-control:focus, .form-select:focus {
  border-color: var(--asa-red) !important;
  box-shadow: 0 0 0 3.5px rgba(155, 28, 28, 0.16) !important;
  outline: none;
}
.search-input {
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  color: var(--text-main);
  border-radius: 12px;
  padding: 9px 15px;
  transition: all 0.2s;
}
.search-input:focus {
  background: #FFFFFF;
}

/* 7. Tables */
.table thead th {
  background: var(--charcoal-black) !important;
  color: #FFFFFF !important;
  font-weight: 800;
  font-size: 13px;
  padding: 14px 16px;
  border-bottom: 2.5px solid var(--asa-red) !important;
  white-space: nowrap;
}
.table tbody tr {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.table tbody tr:hover {
  background: rgba(155, 28, 28, 0.028) !important;
}

/* 8. Unified Mobile Bottom Navigation Bar */
.unified-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .unified-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--charcoal-black);
    border-top: 2.5px solid var(--asa-red);
    z-index: 1050;
    align-items: center;
    justify-content: space-around;
    padding: 4px 6px;
    box-shadow: 0 -4px 22px rgba(0, 0, 0, 0.28);
  }

  .unified-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 10.5px;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 8px;
    transition: all 0.15s ease;
    flex: 1;
    text-align: center;
  }

  .unified-bottom-nav a i {
    font-size: 18px;
    margin-bottom: 2px;
    transition: transform 0.15s;
  }

  .unified-bottom-nav a.active,
  .unified-bottom-nav a:active {
    color: var(--asa-red);
  }
  .unified-bottom-nav a.active i {
    transform: scale(1.18);
    color: var(--asa-red);
    filter: drop-shadow(0 0 6px rgba(155, 28, 28, 0.45));
  }
}

/* 9. Touch Friendly Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(107, 107, 107, 0.35);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--asa-red);
}
