/* ============================================
   Custom CSS for Solnate POS - Based on Material Dashboard 21
   ============================================ */

/* ============================================
   1. MATERIAL ICONS BASE STYLES
   ============================================ */
.material-icons,
.material-icons-round {
  font-family: 'Material Icons Round';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* Smaller icon sizes for inline text */
.material-icons.text-sm,
i.material-icons[style*="font-size: 16px"] {
  font-size: 16px;
}

/* Icon color utilities */
.material-icons.text-info {
  color: #17c1e8;
}

.material-icons.text-warning {
  color: #fbcf33;
}

.material-icons.text-white {
  color: #ffffff;
}

/* ============================================
   2. THEME TOGGLE STYLES
   ============================================ */

/* Light mode (default) */
html {
  font-size: 14px;
}

body {
  background: linear-gradient(135deg, #f3f6fb 0%, #e9eff7 100%);
  min-height: 100vh;
  font-family: 'Open Sans', sans-serif;
}

body.light-mode {
  background-color: #f0f2f5;
}

body.light-mode .card {
  background-color: #ffffff;
  color: #344767;
}

body.light-mode .card-header {
  background-color: transparent;
}

body.light-mode .navbar {
  background-color: #ffffff;
}

body.light-mode .text-muted {
  color: #7b809a !important;
}

/* Dark mode */
body.dark-mode {
  background-color: #1a1a2e;
}

body.dark-mode .card {
  background-color: #16213e;
  color: #eaeaea;
}

body.dark-mode .card-header {
  background-color: transparent;
}

body.dark-mode .navbar {
  background-color: #16213e;
}

body.dark-mode .navbar-main {
  background-color: #16213e;
}

body.dark-mode .bg-gray-200 {
  background-color: #1a1a2e !important;
}

body.dark-mode .text-muted {
  color: #a0a0a0 !important;
}

body.dark-mode .text-dark {
  color: #eaeaea !important;
}

body.dark-mode h4, 
body.dark-mode h5, 
body.dark-mode h6 {
  color: #eaeaea;
}

body.dark-mode .form-control {
  background-color: #1a1a2e;
  border-color: #2d3748;
  color: #eaeaea;
}

body.dark-mode .form-select {
  background-color: #1a1a2e;
  border-color: #2d3748;
  color: #eaeaea;
}

body.dark-mode .table {
  color: #eaeaea;
}

body.dark-mode .table thead th {
  color: #a0a0a0;
}

body.dark-mode .table td, 
body.dark-mode .table th {
  border-color: #2d3748;
}

body.dark-mode .breadcrumb-item a {
  color: #a0a0a0;
}

body.dark-mode .breadcrumb-item.active {
  color: #eaeaea;
}

/* ============================================
   2. SIDEBAR STYLES - Following MD21 Design
   ============================================ */

.g-sidenav-show {
  transition: all 0.3s ease;
}

.g-sidenav-pinned .sidenav {
  width: 80px !important;
}

.g-sidenav-pinned .sidenav .nav-link-text {
  opacity: 0;
  visibility: hidden;
}

.g-sidenav-pinned .sidenav .sidenav-header {
  padding: 1.5rem 0.5rem;
}

.g-sidenav-pinned .sidenav .sidenav-header .navbar-brand {
  justify-content: center;
}

.g-sidenav-pinned .main-content {
  margin-left: 80px !important;
}

/* Sidebar collapse animation */
.sidenav {
  transition: width 0.3s ease;
}

.sidenav .nav-link {
  transition: all 0.3s ease;
}

.sidenav .nav-link-text {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Sidebar scroll - thin custom scrollbar */
.sidenav-collapse-main {
  overflow-y: auto;
  overflow-x: hidden;
}

.sidenav-collapse-main::-webkit-scrollbar {
  width: 6px;
}

.sidenav-collapse-main::-webkit-scrollbar-track {
  background: transparent;
}

.sidenav-collapse-main::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidenav-collapse-main::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   3. HEADER / NAVBAR STYLES
   ============================================ */

.navbar {
  transition: all 0.3s ease;
}

.navbar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

.navbar-nav .nav-link i.material-icons {
  vertical-align: middle;
  line-height: 1;
}

/* Header icons alignment */
.navbar-nav .nav-item {
  display: flex;
  align-items: center;
}

.nav-item.d-xl-none.ps-3 {
  padding-left: 0.5rem !important;
}

/* Sidenav toggler */
.sidenav-toggler {
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
}

.sidenav-toggler-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 14px;
}

.sidenav-toggler-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: #7b809a;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ============================================
   4. MODAL STYLES
   ============================================ */

.modal.show {
  display: block !important;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
}

.modal {
  z-index: 1050;
}

.modal-content {
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

body.dark-mode .modal-content {
  background-color: #16213e;
  color: #eaeaea;
}

body.dark-mode .modal-header {
  border-bottom-color: #2d3748;
}

body.dark-mode .modal-footer {
  border-top-color: #2d3748;
}

/* Close button - light mode (dark X) */
.btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  opacity: 0.6;
}

.btn-close:hover {
  opacity: 1;
}

/* Close button - dark mode (white X) */
body.dark-mode .btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  opacity: 0.8;
  filter: none;
}

body.dark-mode .btn-close:hover {
  opacity: 1;
}

/* ============================================
   5. CHART STYLES
   ============================================ */

.chart-canvas {
  width: 100% !important;
  height: 170px !important;
  position: relative;
}

.chart {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Chart container backgrounds (matching MD21) */
.bg-gradient-primary {
  background: linear-gradient(310deg, #5e72e4 0%, #825ee4 100%);
}

.bg-gradient-success {
  background: linear-gradient(310deg, #4ade80 0%, #22c55e 100%);
}

.bg-gradient-dark {
  background: linear-gradient(310deg, #344767 0%, #1a1a2e 100%);
}

/* ============================================
   6. CARD STYLES
   ============================================ */

.card {
  transition: all 0.3s ease;
}

.card-header {
  overflow: visible !important;
}

/* Stats card icon positioning (matching MD21) */
.card-header.pt-2 {
  position: relative;
  min-height: 100px;
}

.icon-lg {
  width: 56px;
  height: 56px;
}

.icon-shape {
  display: inline-flex;
  padding: 12px;
  text-align: center;
  border-radius: 12px;
}

.mt-n4 {
  margin-top: -1.5rem !important;
}

.position-absolute {
  position: absolute !important;
}

/* ============================================
   7. TOAST NOTIFICATIONS
   ============================================ */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.pos-toast {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.3s ease-out;
  font-family: 'Roboto', sans-serif;
  min-width: 280px;
}

.pos-toast-success { 
  background: linear-gradient(135deg, #10b981, #059669); 
  color: white; 
}

.pos-toast-error { 
  background: linear-gradient(135deg, #ef4444, #dc2626); 
  color: white; 
}

.pos-toast-warning { 
  background: linear-gradient(135deg, #f59e0b, #d97706); 
  color: white; 
}

.pos-toast-info { 
  background: linear-gradient(135deg, #3b82f6, #2563eb); 
  color: white; 
}

@keyframes toastSlideIn {
  from { 
    transform: translateX(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

/* ============================================
   8. NAVIGATION LINK STYLES
   ============================================ */

.nav-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.nav-link.active {
  background: linear-gradient(135deg, #5e72e4 0%, #825ee4 100%);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   9. TABLE STYLES
   ============================================ */

.table {
  vertical-align: middle;
}

.table-responsive {
  overflow-x: auto;
}

/* ============================================
   10. BUTTON STYLES
   ============================================ */

.btn {
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================
   11. FUNCTION KEY HELPER STYLES
   ============================================ */

/* Enhanced visibility for function key hints */
kbd {
  padding: 0.4rem 0.6rem;
  font-size: 0.9em;
  font-weight: 600;
  color: #fff;
  background-color: #2c3e50;
  border-radius: 3px;
  display: inline-block;
  margin: 0 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Function key hints container */
.function-keys-hint {
  background: linear-gradient(135deg, rgba(93, 114, 228, 0.1) 0%, rgba(130, 94, 228, 0.1) 100%);
  border: 1px solid rgba(93, 114, 228, 0.3);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* ============================================
   12. INPUT & BUTTON ALIGNMENT
   ============================================ */

/* Ensure consistent input field heights */
.form-control,
.form-select {
  height: 44px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
}

/* Match button heights to input fields */
.btn {
  height: 44px;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.3s ease;
}

/* Button sizing for small buttons */
.btn-sm {
  height: 36px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Icon scaling within buttons - occupy button space with margin */
.btn i,
.btn-sm i,
.btn-lg i {
  margin: 0 0.25rem;
  display: inline-block;
  line-height: inherit;
}

/* First icon (no left margin) and last icon (no right margin) */
.btn i:first-child {
  margin-left: 0;
}

.btn i:last-child {
  margin-right: 0;
}

/* Input group alignment */
.input-group {
  gap: 0;
}

.input-group .form-control,
.input-group .form-select {
  height: 44px;
}

.input-group .btn {
  height: 44px;
  border-left: 1px solid #e0e0e0;
}

.input-group-text {
  height: 44px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure row alignment with flex */
.row.align-items-end > [class*='col-'] {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.row.g-3.align-items-end .col-md-2 .btn,
.row.g-3.align-items-end .col-md-3 .btn,
.row.g-3.align-items-end .col-md-4 .btn {
  width: 100%;
  height: 44px;
}

/* Action button sizing (table action buttons) */
.action-btn {
  padding: 0.375rem 0.5rem;
  font-size: 0.9rem;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-btn i {
  font-size: 1rem;
  margin: 0;
}

/* Multi-select guidance buttons */
.btn-group-vertical .btn,
.btn-group .btn {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   11. FORM STYLES
   ============================================ */
/* Light Mode - Black border-bottom */

body.light-mode .form-control,
body.light-mode .form-select,
body.light-mode textarea.form-control {
  border-bottom: 2px solid #000000;
  border-top: none;
  border-left: none;
  border-right: none;
}

/* Dark Mode - White border-bottom */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode textarea.form-control {
  border-bottom: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  border-right: none;
}

/* Focus state - Purple accent for both themes */
body.light-mode .form-control:focus,
body.dark-mode .form-control:focus {
  border-bottom-color: #5e72e4;
  box-shadow: none;
}

/* Login page exception - always black border */
.login-page .form-control {
  border-bottom: 2px solid #000000 !important;
}

.form-control, 
.form-select {
  transition: all 0.3s ease;
}

.form-control:focus, 
.form-select:focus {
  box-shadow: none;
  border-color: #5e72e4;
}

/* ============================================
   11A. INPUT FIELD BORDER-BOTTOM THEMES
   ============================================ */

/* Light Mode - Black border-bottom */
body.light-mode .form-control,
body.light-mode .form-select,
body.light-mode textarea.form-control {
  border-bottom: 2px solid #000000;
  border-top: none;
  border-left: none;
  border-right: none;
  background-color: #ffffff;
  color: #344767;
}

/* Light Mode - Focus state with purple accent */
body.light-mode .form-control:focus,
body.light-mode .form-select:focus {
  border-bottom-color: #5e72e4;
  box-shadow: none;
}

/* Dark Mode - White border-bottom */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode textarea.form-control {
  border-bottom: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  border-right: none;
  background-color: #1a1a2e;
  color: #eaeaea;
}

/* Dark Mode - Focus state with purple accent */
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  border-bottom-color: #5e72e4;
  box-shadow: none;
}

/* Input group text - match border-bottom */
body.light-mode .input-group-text {
  border-bottom: 2px solid #000000;
  border-top: none;
  border-left: none;
  border-right: none;
}

body.dark-mode .input-group-text {
  border-bottom: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  border-right: none;
}

/* Search inputs (input-group-outline) */
body.light-mode .input-group-outline .form-control {
  border-bottom: 2px solid #000000;
  border: 1px solid #d2d6da;
  border-bottom-width: 2px;
  border-bottom-color: #000000;
}

body.dark-mode .input-group-outline .form-control {
  border-bottom: 2px solid #ffffff;
  border: 1px solid #2d3748;
  border-bottom-width: 2px;
  border-bottom-color: #ffffff;
}

/* Checkbox and radio inputs - label color */
body.light-mode .form-check-label {
  color: #344767;
}

body.dark-mode .form-check-label {
  color: #eaeaea;
}

/* Login page exception - always light theme */
.login-page .form-control {
  border-bottom: 2px solid #000000 !important;
  border: 1px solid #d2d6da;
  border-bottom-width: 2px;
}

/* Input group outline style */
.input-group-outline .form-control {
  border: 1px solid #d2d6da;
  border-radius: 0.375rem;
  padding: 0.625rem 0.75rem;
}

.input-group-outline .form-control:focus {
  border-color: #5e72e4;
  box-shadow: 0 0 0 2px rgba(94, 114, 228, 0.2);
}

body.dark-mode .input-group-outline .form-control {
  border-color: #2d3748;
  background-color: #1a1a2e;
  color: #eaeaea;
}

/* ============================================
   11A. INPUT FIELD BORDER-BOTTOM THEMES
   ============================================ */

/* Light Mode - Black border-bottom */
body.light-mode .form-control,
body.light-mode .form-select,
body.light-mode textarea.form-control {
  border-bottom: 2px solid #000000;
  border-top: none;
  border-left: none;
  border-right: none;
  background-color: #ffffff;
  color: #344767;
}

/* Light Mode - Remove bottom border on focus (optional: keep it or change color) */
body.light-mode .form-control:focus,
body.light-mode .form-select:focus {
  border-bottom-color: #5e72e4; /* Purple accent on focus */
  box-shadow: none;
}

/* Dark Mode - White border-bottom */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode textarea.form-control {
  border-bottom: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  border-right: none;
  background-color: #1a1a2e;
  color: #eaeaea;
}

/* Dark Mode - Focus state */
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  border-bottom-color: #5e72e4; /* Purple accent on focus */
  box-shadow: none;
}

/* Input group text - match border-bottom */
body.light-mode .input-group-text {
  border-bottom: 2px solid #000000;
  border-top: none;
  border-left: none;
  border-right: none;
}

body.dark-mode .input-group-text {
  border-bottom: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  border-right: none;
}

/* Search inputs (input-group-outline) */
body.light-mode .input-group-outline .form-control {
  border-bottom: 2px solid #000000;
  border: 1px solid #d2d6da;
  border-bottom-width: 2px;
  border-bottom-color: #000000;
}

body.dark-mode .input-group-outline .form-control {
  border-bottom: 2px solid #ffffff;
  border: 1px solid #2d3748;
  border-bottom-width: 2px;
  border-bottom-color: #ffffff;
}

/* Checkbox and radio inputs - label color */
body.light-mode .form-check-label {
  color: #344767;
}

body.dark-mode .form-check-label {
  color: #eaeaea;
}

/* Login page exception - always light theme */
.login-page .form-control {
  border-bottom: 2px solid #000000 !important;
  border: 1px solid #d2d6da;
  border-bottom-width: 2px;
}

/* ============================================
   12. LOADING SPINNER
   ============================================ */

.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { 
    transform: rotate(360deg); 
  }
}

/* ============================================
   13. RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 991.98px) {
  .g-sidenav-show .sidenav {
    transform: translateX(-100%);
  }
  
  .g-sidenav-show .sidenav.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}

@media (min-width: 992px) {
  .g-sidenav-pinned .main-content {
    margin-left: 80px;
  }
}

/* ============================================
   14. FIXES FOR VUE TRANSITIONS
   ============================================ */

/* Ensure smooth transitions */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* Vue transition for modals */
.modal-enter-active,
.modal-leave-active {
  transition: all 0.3s ease;
}

.modal-enter-from,
.modal-leave-to {
  opacity: 0;
}

.modal-enter-from .modal-dialog,
.modal-leave-to .modal-dialog {
  transform: translateY(-50px);
}

/* ============================================
    15. PRINT STYLES - Receipt Printing
    ============================================ */

@media print {
  /* Hide all elements by default */
  body * {
    visibility: hidden;
  }
  
  /* Only show receipt elements */
  .receipt-container,
  .receipt-container * {
    visibility: visible;
  }
  
  /* Position receipt at top-left */
  .receipt-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: white;
  }
  
  /* Hide elements not needed for printing */
  .no-print,
  .sidebar,
  .navbar,
  .card-header,
  .card-footer,
  .btn,
  .modal,
  .toast-container,
  #toast-container {
    display: none !important;
  }
  
  /* Receipt styling */
  .receipt {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: black;
    background: white;
  }
  
  .receipt-header {
    text-align: center;
    margin-bottom: 20px;
  }
  
  .receipt-items {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
  }
  
  .receipt-items th,
  .receipt-items td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px dashed #ccc;
  }
  
  .receipt-total {
    font-weight: bold;
    font-size: 14px;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 2px solid #000;
  }
  
  /* Ensure background colors print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
