@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

:root {
  --primary-brown: #8B5B4A;
  --primary-brown-light: #A77462;
  --primary-brown-dark: #6E4435;
  --secondary-green: #A6B84D;
  --secondary-green-light: #C0D364;
  --secondary-green-dark: #899A36;
  --dark-bg: #1F1F1F;
  --dark-sidebar: #171717;
  --light-bg: #F8F8F6;
  --white: #FFFFFF;
  --light-grey: #EFEFEF;
  
  /* Status Colors */
  --success-bg: rgba(166, 184, 77, 0.12);
  --success-text: #5D6C1D;
  --warning-bg: rgba(139, 91, 74, 0.12);
  --warning-text: #8B5B4A;
  --danger-bg: rgba(220, 53, 69, 0.1);
  --danger-text: #DC3545;
  --info-bg: rgba(0, 123, 255, 0.08);
  --info-text: #007BFF;
  
  /* Layout config */
  --sidebar-width: 280px;
  --header-height: 70px;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 24px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 30px rgba(139, 91, 74, 0.05);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.08);
  --shadow-glass: 0 8px 32px 0 rgba(139, 91, 74, 0.1);
  --border-glass: 1px solid rgba(255, 255, 255, 0.18);
}

/* Base resets & styles */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--light-bg);
  color: #333333;
  overflow-x: hidden;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--dark-bg);
  letter-spacing: -0.02em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--light-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-brown-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-brown);
}

/* Wood Textures & Patterns */
.bg-wood-grain {
  background-color: var(--light-bg);
  background-image: radial-gradient(circle at 100% 150%, rgba(139, 91, 74, 0.03) 24%, white 24%, white 28%, rgba(139, 91, 74, 0.03) 28%, rgba(139, 91, 74, 0.03) 36%, white 36%, white 40%, rgba(139, 91, 74, 0.03) 40%);
}

.gradient-brown-green {
  background: linear-gradient(135deg, var(--primary-brown) 0%, var(--secondary-green) 100%);
}

.gradient-brown-dark {
  background: linear-gradient(135deg, var(--primary-brown-dark) 0%, var(--primary-brown) 100%);
}

/* Utility Styles */
.text-brown { color: var(--primary-brown) !important; }
.text-green { color: var(--secondary-green) !important; }
.bg-brown { background-color: var(--primary-brown) !important; }
.bg-green { background-color: var(--secondary-green) !important; }
.bg-dark-custom { background-color: var(--dark-bg) !important; }

/* Buttons Customization */
.btn {
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--primary-brown);
  border-color: var(--primary-brown);
  color: var(--white);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--primary-brown-dark);
  border-color: var(--primary-brown-dark);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 91, 74, 0.35);
}

.btn-success-custom {
  background-color: var(--secondary-green);
  border-color: var(--secondary-green);
  color: var(--white);
}
.btn-success-custom:hover {
  background-color: var(--secondary-green-dark);
  border-color: var(--secondary-green-dark);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(166, 184, 77, 0.35);
}

.btn-outline-primary {
  color: var(--primary-brown);
  border-color: var(--primary-brown);
}
.btn-outline-primary:hover {
  background-color: var(--primary-brown);
  border-color: var(--primary-brown);
  color: var(--white);
}

.btn-link-custom {
  color: var(--primary-brown);
  text-decoration: none;
  font-weight: 500;
}
.btn-link-custom:hover {
  color: var(--primary-brown-dark);
  text-decoration: underline;
}

/* Glassmorphism Panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-panel-dark {
  background: rgba(31, 31, 31, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: var(--border-glass);
}

/* Form Styling */
.form-control, .form-select {
  border: 1.5px solid rgba(139, 91, 74, 0.15);
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  background-color: rgba(255, 255, 255, 0.8);
  transition: var(--transition-smooth);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-brown);
  box-shadow: 0 0 0 4px rgba(139, 91, 74, 0.12);
  background-color: var(--white);
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #4A4A4A;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Custom Cards */
.card-custom {
  background: var(--white);
  border: 1px solid rgba(139, 91, 74, 0.08);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  overflow: hidden;
  position: relative;
}
.card-custom:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.card-header-custom {
  background: transparent;
  border-bottom: 1px solid rgba(139, 91, 74, 0.06);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* LOGIN LAYOUT */
.login-container {
  min-height: 100vh;
  display: flex;
}

.login-hero-side {
  flex: 0 0 60%;
  position: relative;
  background-image: url('../assets/login-bg.png');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 4rem;
}

.login-hero-side::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(31, 31, 31, 0.9) 0%, rgba(139, 91, 74, 0.75) 50%, rgba(166, 184, 77, 0.45) 100%);
  z-index: 1;
}

.login-hero-content {
  position: relative;
  z-index: 2;
  color: var(--white);
  max-width: 650px;
}

.login-form-side {
  flex: 0 0 40%;
  background: var(--light-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  position: relative;
}

.login-card-wrapper {
  width: 100%;
  max-width: 440px;
}

/* MAIN SYSTEM LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--dark-sidebar);
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  transition: var(--transition-smooth);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  height: 40px;
  width: 40px;
  background: linear-gradient(135deg, var(--primary-brown) 0%, var(--secondary-green) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(166, 184, 77, 0.4);
}

.brand-logo-img-sm {
  height: 30px !important;
  width: 30px !important;
  max-height: 30px !important;
  max-width: 30px !important;
  object-fit: contain !important;
  transition: var(--transition-smooth);
}

.brand-logo-img-md {
  height: 40px !important;
  width: 40px !important;
  max-height: 40px !important;
  max-width: 40px !important;
  object-fit: contain !important;
}

.brand-logo-img-lg {
  height: 50px !important;
  width: 50px !important;
  max-height: 50px !important;
  max-width: 50px !important;
  object-fit: contain !important;
}

.brand-logo-img-login-card {
  height: 100px !important;
  width: 100px !important;
  max-height: 100px !important;
  max-width: 100px !important;
  object-fit: contain !important;
}


.sidebar-profile {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-profile-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--secondary-green);
  object-fit: cover;
}

.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition-smooth);
  gap: 0.85rem;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  transition: var(--transition-smooth);
}

.sidebar-link:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--primary-brown) 0%, rgba(166, 184, 77, 0.8) 100%);
  box-shadow: 0 4px 15px rgba(139, 91, 74, 0.25);
  font-weight: 600;
}

.sidebar-link.active i {
  color: var(--white);
}

/* Submenu layout */
.sidebar-submenu {
  list-style: none;
  padding-left: 2.75rem;
  margin-top: 0.25rem;
  display: none;
}

.sidebar-submenu.show {
  display: block;
}

.sidebar-submenu-link {
  display: block;
  padding: 0.5rem 0;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 0.88rem;
  transition: var(--transition-smooth);
}

.sidebar-submenu-link:hover, .sidebar-submenu-link.active {
  color: var(--secondary-green-light);
}

/* Chevron spin */
.menu-arrow {
  margin-left: auto;
  font-size: 0.8rem !important;
  transition: var(--transition-smooth);
}
.collapsed .menu-arrow {
  transform: rotate(-90deg);
}

/* App Main Panel */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  background-color: var(--light-bg);
}

/* Header Navbar */
.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(139, 91, 74, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}

.search-bar-wrapper {
  position: relative;
  width: 320px;
}

.search-bar-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-brown-light);
}

.search-bar-wrapper .form-control {
  padding-left: 2.5rem;
  border-radius: 30px;
  background-color: rgba(139, 91, 74, 0.03);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.action-btn-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light-grey);
  color: var(--dark-bg);
  border: none;
  position: relative;
  transition: var(--transition-smooth);
}
.action-btn-pill:hover {
  background: var(--primary-brown);
  color: var(--white);
  transform: translateY(-2px);
}

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--secondary-green);
}

.breadcrumb-container {
  padding: 1.25rem 2rem 0.5rem 2rem;
}

.breadcrumb-item a {
  color: var(--primary-brown);
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb-item.active {
  color: #777777;
}

.app-content {
  flex: 1;
  padding: 1.5rem 2rem 3rem 2rem;
}

/* Custom Table Styles */
.table-responsive {
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid rgba(139, 91, 74, 0.08);
}

.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  background-color: #FAF6F4;
  color: var(--primary-brown-dark);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 1.1rem 1.5rem;
  border-bottom: 1.5px solid rgba(139, 91, 74, 0.1);
}

.table-custom td {
  padding: 1.1rem 1.5rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(139, 91, 74, 0.05);
  color: #4A4A4A;
  background: var(--white);
  transition: var(--transition-smooth);
}

.table-custom tr:hover td {
  background-color: #FAF9F7;
}

/* Status Badges */
.badge-custom {
  padding: 0.45em 0.85em;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-custom::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-success-custom {
  background-color: var(--success-bg);
  color: var(--success-text);
}
.badge-success-custom::before { background-color: var(--secondary-green); }

.badge-warning-custom {
  background-color: var(--warning-bg);
  color: var(--warning-text);
}
.badge-warning-custom::before { background-color: var(--primary-brown); }

.badge-danger-custom {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}
.badge-danger-custom::before { background-color: #DC3545; }

.badge-info-custom {
  background-color: var(--info-bg);
  color: var(--info-text);
}
.badge-info-custom::before { background-color: #007BFF; }


/* Dashboard stat card details */
.stat-card-gradient {
  overflow: hidden;
  border: none !important;
}
.stat-card-gradient::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 130px;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
  transform: skewX(-20deg) translateX(40px);
}

/* Timeline Custom styling */
.timeline-custom {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid rgba(139, 91, 74, 0.1);
  margin-left: 0.75rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-icon-dot {
  position: absolute;
  left: -2.6rem;
  top: 0.2rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--white);
  border: 4px solid var(--primary-brown);
  z-index: 2;
}

.timeline-icon-dot.green-dot {
  border-color: var(--secondary-green);
}

/* Sticky Footer */
.app-footer {
  background: var(--white);
  border-top: 1px solid rgba(139, 91, 74, 0.08);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #777777;
}

/* Loading Skeletons */
.skeleton {
  background: linear-gradient(90deg, #F0EFEF 25%, #E5E4E4 50%, #F0EFEF 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-rect {
  height: 80px;
  width: 100%;
}

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

/* Loading overlay for views */
.view-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-in-out;
}

.view-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.wood-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(139, 91, 74, 0.15);
  border-top: 4px solid var(--primary-brown);
  border-right: 4px solid var(--secondary-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Floating Action Button */
.fab-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-brown) 0%, var(--secondary-green) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(139, 91, 74, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 1000;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.fab-btn:hover {
  transform: translateY(-4px) rotate(90deg);
  box-shadow: 0 8px 25px rgba(139, 91, 74, 0.5);
  color: white;
}

/* Invoice Modal Preview template styling */
.invoice-preview-container {
  border: 1px solid rgba(139, 91, 74, 0.15);
  border-radius: var(--border-radius-md);
  background: white;
  padding: 3rem;
  box-shadow: var(--shadow-sm);
  color: #333;
}

/* Responsive adjusters */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 250px;
  }
}

@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show-sidebar {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  
  .login-container {
    flex-direction: column;
  }
  .login-hero-side {
    flex: 0 0 350px;
    padding: 2.5rem;
  }
  .login-form-side {
    flex: 1;
    padding: 2.5rem;
  }
}

@media (max-width: 576px) {
  .app-header {
    padding: 0 1rem;
  }
  .search-bar-wrapper {
    width: 180px;
  }
  .app-content {
    padding: 1rem 1rem 3rem 1rem;
  }
}

/* Flashing error tally warning */
.flashing-danger-alert {
  background-color: rgba(220, 53, 69, 0.08);
  border: 1.5px solid #DC3545;
  color: #DC3545;
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: flash-pulse 1.5s infinite ease-in-out;
}

@keyframes flash-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Print media query override for premium slips generation */
@media print {
  body * {
    visibility: hidden;
  }
  #invoicePreviewModal, #invoicePreviewModal *, #invoice-preview-doc, #invoice-preview-doc * {
    visibility: visible;
  }
  #invoicePreviewModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent !important;
  }
  .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .modal-content {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .modal-header, .modal-footer {
    display: none !important;
  }
  .invoice-preview-container {
    border: none !important;
    box-shadow: none !important;
    padding: 1rem !important;
    width: 100% !important;
  }
}

/* ==========================================
   CUSTOM NOTIFICATION & CONFIRMATION DESK SYSTEM
   ========================================== */
.erp-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.erp-toast {
  background: rgba(31, 31, 31, 0.95);
  backdrop-filter: blur(12px);
  color: #FFFFFF;
  border-left: 5px solid var(--primary-brown);
  padding: 14px 22px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 300px;
  max-width: 420px;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}
.erp-toast.toast-success {
  border-left-color: var(--secondary-green);
}
.erp-toast.toast-danger {
  border-left-color: #dc3545;
}
.erp-toast.toast-warning {
  border-left-color: #ffc107;
}
.erp-toast-content {
  flex-grow: 1;
  font-size: 0.8rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  line-height: 1.4;
}
.erp-toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  transition: color 0.2s ease;
}
.erp-toast-close:hover {
  color: #ffffff;
}
@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.erp-toast.fade-out {
  transform: translateX(120%);
  opacity: 0;
}
