/* Dental Clinic Management System - Main Stylesheet */
/* White and Red Theme (White Primary, Red Secondary) */

/* Print Styles */
@media print {
  /* Hide header, sidebar, navigation, and action buttons */
  .main-header,
  .sidebar,
  .page-header,
  .page-actions,
  .breadcrumb,
  .btn,
  .action-buttons,
  .sidebar-toggle,
  .user-menu,
  .language-switcher,
  footer,
  .no-print,
  header,
  nav {
    display: none !important;
    visibility: hidden !important;
  }

  /* Hide all children of page-header */
  .page-header,
  .page-header *,
  .page-header h1,
  .page-header h1 *,
  .page-actions,
  .page-actions *,
  .main-header,
  .main-header * {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Adjust layout for print */
  body {
    margin: 0 !important;
    padding: 0 !important;
  }

  .wrapper {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .content {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Show only invoice content */
  .invoice-print {
    display: block !important;
    visibility: visible !important;
  }

  /* Invoice print styles */
  .card {
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .card-header {
    border-bottom: 2px solid #dc3545 !important;
    padding: 15px !important;
    background: #ffffff !important;
  }

  .card-body {
    padding: 20px !important;
  }

  /* Ensure tables print properly */
  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  /* Remove background colors for print */
  .badge,
  .table-primary {
    background-color: #f8f9fa !important;
    color: #000 !important;
    border: 1px solid #ddd !important;
  }

  /* Ensure proper page breaks */
  .invoice-print {
    page-break-after: always;
  }
}

:root {
  --primary-color: #ffffff;
  --primary-dark: #f8f9fa;
  --primary-light: #ffffff;
  --secondary-color: #dc3545;
  --secondary-dark: #c82333;
  --secondary-light: #e4606d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --sidebar-width: 260px;
  --header-height: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.wrapper {
  display: flex;
  min-height: 100vh;
}

/* Header Styles */
.main-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: #ffffff;
  color: #dc3545;
  border-bottom: 2px solid #dc3545;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: left 0.3s;
}

.sidebar-collapsed .main-header {
  left: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 20px;
  cursor: pointer;
  padding: 10px;
  border-radius: 5px;
  transition: background 0.3s;
}

.sidebar-toggle:hover {
  background: rgba(220, 53, 69, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
}

.logo i {
  font-size: 24px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.language-switcher a {
  color: #dc3545;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 3px;
  margin: 0 2px;
  transition: background 0.3s;
  border: 1px solid #dc3545;
}

.language-switcher a.active,
.language-switcher a:hover {
  background: #dc3545;
  color: #ffffff;
}

.user-menu .dropdown-toggle {
  color: #dc3545;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.3s;
}

.user-menu .dropdown-toggle:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.user-menu .dropdown-toggle span {
  display: block;
  font-weight: 500;
}

.user-menu .dropdown-toggle small {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

/* Sidebar Styles */
.main-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  transition: transform 0.3s;
  overflow-y: auto;
}

.sidebar-collapsed .main-sidebar {
  transform: translateX(-100%);
}

.sidebar-header {
  background: #ffffff;
  color: #dc3545;
  padding: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 18px;
  border-bottom: 2px solid #dc3545;
}

.sidebar-menu {
  padding: 20px 0;
}

.nav-menu {
  list-style: none;
}

.nav-menu li {
  margin: 5px 0;
}

.nav-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.nav-menu li a:hover {
  background: rgba(220, 53, 69, 0.1);
  color: var(--secondary-color);
  border-left-color: var(--secondary-color);
}

.nav-menu li a.active {
  background: rgba(220, 53, 69, 0.15);
  color: var(--secondary-color);
  border-left-color: var(--secondary-color);
  font-weight: 500;
}

.nav-menu li a i {
  width: 20px;
  text-align: center;
}

.menu-divider {
  padding: 15px 20px 5px;
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 30px;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.3s, width 0.3s;
}

.sidebar-collapsed .main-content {
  margin-left: 0;
  width: 100%;
}

.page-header {
  margin-bottom: 30px;
}

.page-header h1 {
  color: var(--secondary-color);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 10px;
}

.page-header h1 i {
  margin-right: 10px;
}

.breadcrumb {
  background: none;
  padding: 0;
  margin: 0;
}

.breadcrumb-item a {
  color: var(--secondary-color);
  text-decoration: none;
}

/* Cards */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  border: none;
}

.card-header {
  background: #ffffff;
  color: #dc3545;
  padding: 15px 20px;
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  border-bottom: 2px solid #dc3545;
}

.card-header h5 {
  margin: 0;
  color: #dc3545;
}

.card-body {
  padding: 20px;
  overflow: visible;
}

.card {
  overflow: visible;
}

.content {
  overflow: visible;
}

/* Ensure dropdown options are not clipped */
select.form-control {
  overflow: visible;
}

/* Fix for table-responsive if it's clipping dropdowns */
.table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}

/* Ensure modals and cards don't clip dropdowns */
.modal-body,
.card-body,
.content {
  overflow: visible !important;
}

/* Statistics Cards */
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
  margin-bottom: 20px;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: white;
}

.stat-primary .stat-icon {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  color: #dc3545;
  border: 2px solid #dc3545;
}

.stat-success .stat-icon {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.stat-info .stat-icon {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.stat-warning .stat-icon {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.stat-content h3 {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  color: #333;
}

.stat-content p {
  margin: 5px 0 0;
  color: #6c757d;
  font-size: 14px;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.table tbody tr {
  transition: background 0.3s;
}

.table tbody tr:hover {
  background: #f8f9fa;
}

/* Buttons */
.btn {
  border-radius: 5px;
  padding: 8px 20px;
  font-weight: 500;
  transition: all 0.3s;
  border: none;
}

.btn-primary {
  background: #ffffff;
  color: #dc3545;
  border: 2px solid #dc3545;
}

.btn-primary:hover {
  background: #dc3545;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-info {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.btn-warning {
  background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

/* Badges */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background-color: #28a745;
}

.badge-danger {
  background-color: #dc3545;
}

.badge-warning {
  background-color: #ffc107;
  color: #333;
}

.badge-secondary {
  background-color: #6c757d;
}

.badge-info {
  background-color: #17a2b8;
}

/* Forms */
.form-control {
  border-radius: 5px;
  border: 1px solid #ddd;
  padding: 10px 15px;
  transition: all 0.3s;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
  display: block;
  height: calc(2.5em + 0.75rem + 2px);
}

/* Textarea should not have fixed height */
textarea.form-control {
  height: auto;
  min-height: calc(2.5em + 0.75rem + 2px);
  resize: vertical;
}

.form-control:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
  outline: 0;
}

/* Select Dropdown Styling */
select.form-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px;
  padding-right: 40px;
  cursor: pointer;
}

select.form-control:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23dc3545' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

select.form-control option {
  padding: 10px;
  background-color: #fff;
  color: #333;
}

select.form-control option:hover {
  background-color: #f8f9fa;
}

select.form-control option:checked {
  background-color: var(--secondary-color);
  color: #fff;
}

/* Ensure select dropdowns are visible */
select.form-control,
select.form-control option {
  z-index: 1;
  position: relative;
}

/* Fix for dropdown options visibility */
.form-group {
  position: relative;
  z-index: 1;
  overflow: visible;
}

.form-group select.form-control {
  z-index: 2;
}

.form-label {
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
  display: block;
}

/* Footer */
.main-footer {
  background: white;
  padding: 20px;
  margin-left: var(--sidebar-width);
  border-top: 1px solid #dee2e6;
  transition: margin-left 0.3s;
}

.sidebar-collapsed .main-footer {
  margin-left: 0;
}

.main-footer p {
  margin: 0;
  color: #6c757d;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .main-sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 15px;
  }

  .main-header {
    left: 0;
  }

  .main-footer {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }
}

/* Toastr Customization */
.toast-success {
  background-color: #28a745;
}

.toast-error {
  background-color: #dc3545;
}

.toast-info {
  background-color: #17a2b8;
}

.toast-warning {
  background-color: #ffc107;
}

/* Loading Spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h4 {
  margin-bottom: 10px;
  color: #333;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 14px;
}

/* Page Actions */
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Search and Filter */
.search-filter-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-filter-bar .form-control {
  flex: 1;
  min-width: 200px;
}

/* Image Upload */
.image-upload {
  position: relative;
  display: inline-block;
}

.image-upload img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  border: 2px solid #ddd;
}

.image-upload .btn {
  margin-top: 10px;
}

/* Pagination Styles */
.pagination {
  margin-top: 20px;
  margin-bottom: 20px;
}

.pagination .page-link {
  color: #dc3545;
  border-color: #ddd;
  padding: 8px 16px;
  transition: all 0.3s;
}

.pagination .page-link:hover {
  background-color: #dc3545;
  color: #ffffff;
  border-color: #dc3545;
}

.pagination .page-item.active .page-link {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #ffffff;
}

.pagination .page-item.disabled .page-link {
  color: #6c757d;
  background-color: #ffffff;
  border-color: #ddd;
  cursor: not-allowed;
  opacity: 0.6;
}

.pagination .page-link:focus {
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
  outline: 0;
}
