/* ============================
   Modern Dashboard Custom CSS
   ============================ */

/* Footer visibility fix */
.content-footer {
    position: relative !important;
    z-index: 10 !important;
    background: var(--bs-body-bg) !important;
    border-top: 1px solid var(--bs-border-color) !important;
    margin-top: auto !important;
}

/* Ensure footer is always visible */
.layout-page {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
}

.content-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.container-xxl.flex-grow-1 {
    flex: 1 !important;
}

/* Sidebar brand: show logo always; name only when expanded (menu-text) */
.app-brand-link { text-decoration: none !important; }
.app-brand-logo .brand-initials{
  display:inline-flex; align-items:center; justify-content:center;
  width: 34px; height: 34px; border-radius: 10px;
  font-weight: 800; letter-spacing: .5px; font-size: 0.95rem;
  color: #fff; user-select: none;
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  box-shadow: 0 4px 14px rgba(99,102,241,.25);
}

/* --- Buttons --- */
.btn {
  border-radius: 8px !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .35rem !important;
  transition: transform .18s, box-shadow .18s !important;
  box-shadow: 0 2px 8px rgba(33,150,243,0.06);
}
.btn-sm { padding: .35rem .6rem !important; font-size: .85rem !important; }
.btn-lg { padding: .7rem 1.3rem !important; font-size: 1.15rem !important; }
.btn-primary { background: #2196f3 !important; color: #fff !important; border: none !important; }
.btn-primary:hover { background: #1976d2 !important; }
.btn-success { background: #43e97b !important; color: #fff !important; border: none !important; }
.btn-success:hover { background: #38f9d7 !important; }
.btn-danger { background: #ff5858 !important; color: #fff !important; border: none !important; }
.btn-danger:hover { background: #f09819 !important; }
.btn-warning { background: #ffd54f !important; color: #333 !important; border: none !important; }
.btn-warning:hover { background: #ffb300 !important; color: #fff !important; }
.btn-outline-primary { background: transparent !important; color: #2196f3 !important; border:1px solid #2196f3 !important; }
.btn-outline-primary:hover { background: #2196f3 !important; color: #fff !important; }
.btn-outline-success { background: transparent !important; color: #43e97b !important; border:1px solid #43e97b !important; }
.btn-outline-success:hover { background: #43e97b !important; color: #fff !important; }
.btn-outline-danger { background: transparent !important; color: #ff5858 !important; border:1px solid #ff5858 !important; }
.btn-outline-danger:hover { background: #ff5858 !important; color: #fff !important; }
.btn-icon { width: 34px !important; height: 34px !important; padding: 0 !important; border-radius: 50% !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; font-size: 1.1rem !important; }
.btn-icon.btn-sm { width: 30px !important; height: 30px !important; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.12) !important; }
.btn:active { transform: translateY(0); }
.btn:focus { outline: none !important; box-shadow: 0 0 0 .18rem rgba(33,150,243, .25) !important; }

/* --- Summary Cards --- */
.summary-card {
  background: #fff !important;
  border-radius: 14px;
  border: none;
  box-shadow: 0 2px 8px rgba(33,150,243,0.06);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  min-height: 100px;
}
.summary-card:hover {
  box-shadow: 0 8px 24px rgba(33,150,243,0.13), 0 2px 8px rgba(33,150,243,0.10);
  transform: translateY(-4px) scale(1.03);
  z-index: 2;
}
.summary-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-right: 18px;
}
.summary-card .icon.debit { background: #e3f2fd; color: #2196f3; }
.summary-card .icon.credit { background: #fff8e1; color: #ff9800; }
.summary-card .icon.transferred { background: #e8f5e9; color: #43e97b; }
.summary-card .icon.balance { background: #ffebee; color: #f44336; }

/* --- Table --- */
.table { background: #fff; border-radius: 10px; overflow: hidden; }
.table th, .table td { vertical-align: middle !important; font-size: 0.97rem; }
.table th { background: #f8f9fa; font-weight: 600; text-transform: uppercase; font-size: 0.95rem; }
.table-sm th, .table-sm td { padding: 0.45rem 0.7rem; }
.table-hover tbody tr:hover { background: #f1f7ff; }

/* --- Status Badges --- */
.status-badge { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-block; text-transform: capitalize; letter-spacing: 0.3px; }
.status-paid { background-color: #28a745; color: #fff; }
.status-pending { background-color: #ffc107; color: #212529; }
.status-overdue { background-color: #dc3545; color: #fff; }
.status-select { font-weight: 600; border-radius: 8px; text-align: center; }
.status-select.paid { background-color: #28a745 !important; color: #fff !important; }
.status-select.pending { background-color: #ffc107 !important; color: #212529 !important; }
.status-select.overdue { background-color: #dc3545 !important; color: #fff !important; }

/* --- Scroll to Top Button --- */
.scroll-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: transparent;
  box-shadow: 0 4px 16px rgba(33,150,243,0.18);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.scroll-to-top-btn.show {
  opacity: 1;
  pointer-events: auto;
}
.scroll-to-top-btn:hover svg circle {
  fill: #1976d2;
}

/* --- Form Controls --- */
.form-control, textarea, select {
  border-radius: 7px !important;
  font-size: 1rem !important;
  padding: 0.55rem 1rem !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, textarea:focus, select:focus {
  border-color: #2196f3 !important;
  box-shadow: 0 0 0 0.12rem rgba(33,150,243,0.18) !important;
}
.form-control-lg { font-size: 1.15rem !important; padding: 0.8rem 1.2rem !important; border-radius: 9px !important; }
.form-control-sm { font-size: 0.92rem !important; padding: 0.35rem 0.7rem !important; border-radius: 6px !important; }

/* --- Toastr Notifications --- */
#toast-container .toast {
  border-radius: 12px !important;
  padding: 12px 16px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  background: rgba(255,255,255,0.95) !important;
  box-shadow: 0 12px 30px rgba(15,23,42, .12) !important;
  color: #233446 !important;
  border: 1px solid rgba(67, 89, 113, 0.12) !important;
}
#toast-container .toast-success { background: #f0fdf4 !important; color: #166534 !important; border-left: 6px solid #16a34a !important; }
#toast-container .toast-error { background: #fef2f2 !important; color: #b91c1c !important; border-left: 6px solid #ef4444 !important; }
#toast-container .toast-warning { background: #fffbeb !important; color: #92400e !important; border-left: 6px solid #f59e0b !important; }
#toast-container .toast-info { background: #eff6ff !important; color: #1d4ed8 !important; border-left: 6px solid #3b82f6 !important; }
#toast-container .toast-progress { height: 3px; opacity: .9; border-radius: 0 0 10px 10px; }

/* --- Navbar Profile Images --- */
.avatar-img {
  border-radius: 50% !important;
  object-fit: cover !important;
}

.avatar-40 {
  width: 40px !important;
  height: 40px !important;
}

.avatar-48 {
  width: 48px !important;
  height: 48px !important;
}

/* --- Avatar Online Status Dot Fix --- */
.avatar {
  position: relative !important;
  display: inline-block !important;
}

.avatar-online::after {
  content: '' !important;
  position: absolute !important;
  bottom: 1px !important;
  right: 1px !important;
  width: 10px !important;
  height: 10px !important;
  background-color: #71dd37 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  z-index: 10 !important;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1) !important;
}

/* Ensure proper positioning for different avatar sizes */
.avatar-40 .avatar-online::after {
  bottom: 1px !important;
  right: 1px !important;
  width: 10px !important;
  height: 10px !important;
}

.avatar-48 .avatar-online::after {
  bottom: 2px !important;
  right: 2px !important;
  width: 12px !important;
  height: 12px !important;
}

/* --- Fast Loading Sidebar - Optimized --- */
.layout-menu::-webkit-scrollbar { width: 2px; }
.layout-menu::-webkit-scrollbar-thumb { background: rgba(102, 126, 234, 0.3); }
.ps__rail-y { width: 2px !important; }
.ps__thumb-y { width: 2px !important; background-color: rgba(102, 126, 234, 0.3) !important; }

/* --- Custom File Input --- */
.file-input-container {
  position: relative;
  display: block;
}

.file-input-container input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
  font-size: 0;
}

/* Global File Input Fix - Ensure all file inputs work */
input[type="file"] {
  cursor: pointer !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  z-index: 10 !important;
  position: relative !important;
}

input[type="file"]:hover {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25) !important;
}

input[type="file"]:focus {
  border-color: #6366f1 !important;
}

/* --- Notification Badge Styling --- */
.nav-item.dropdown-notifications .nav-link {
  position: relative !important;
}

#notification-badge {
  position: absolute !important;
  top: -2px !important;
  right: -2px !important;
  font-size: 10px !important;
  min-width: 18px !important;
  height: 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  z-index: 10 !important;
}

/* Notification dropdown styling */
.dropdown-menu-lg {
  min-width: 320px !important;
  max-width: 400px !important;
}

.dropdown-notifications .dropdown-item {
  padding: 12px 16px !important;
  border-bottom: 1px solid #f1f3f4 !important;
}

.dropdown-notifications .dropdown-item:last-child {
  border-bottom: none !important;
}

.dropdown-notifications .avatar-sm {
  width: 32px !important;
  height: 32px !important;
}

.dropdown-notifications .avatar-initial {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
}

.file-input-overlay {
  border: 1px solid #d9dee3;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  background: #fff;
  min-height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s, box-shadow 0.2s;
  pointer-events: none;
}

.file-input-container:hover .file-input-overlay {
  border-color: #2196f3;
  box-shadow: 0 0 0 0.12rem rgba(33,150,243,0.18);
}

.file-input-container:focus-within .file-input-overlay {
  border-color: #2196f3;
  box-shadow: 0 0 0 0.12rem rgba(33,150,243,0.18);
}

.file-name {
  font-size: 0.92rem;
  color: #697a8d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* --- Responsive Tweaks --- */
@media (max-width: 768px) {
  .summary-card { min-height: 80px; }
  .summary-card .icon { width: 38px; height: 38px; font-size: 1.2rem; margin-right: 10px; }
  .table th, .table td { font-size: 0.93rem; }
  .btn-lg { font-size: 1rem !important; padding: 0.6rem 1rem !important; }
  .file-name { max-width: 150px; }
}
