/**
 * Theme Fixes CSS
 * Contains fixes for padding, contrast, and styling issues
 */

/* Phone Country Select - Make it narrower across all templates */
.phone-country-select,
select.phone-country-select,
.form-control.phone-country-select,
select[id*="phone_country"],
select[name*="phone_country"],
select[id*="business_phone_country"] {
  min-width: 90px !important;
  max-width: 90px !important;
  width: 90px !important;
  flex: 0 0 90px !important;
}

/* Make phone number input fill available space */
.input-group input[name="phone_number"],
.input-group input[name="phone"],
.input-group input[id^="id_phone"],
.input-group input[type="tel"] {
  flex: 1 1 auto !important;
  width: auto !important;
}

/* For mobile layouts, make it even narrower */
@media (max-width: 767.98px) {
  .phone-country-select,
  select.phone-country-select,
  .form-control.phone-country-select {
    min-width: 90px !important;
    max-width: 90px !important;
    width: 90px !important;
    flex: 0 0 90px !important;
  }
}

/* Main Content Padding Fix */
.main-content.app-content {
  padding: 1.5rem !important; /* Consistent padding on all sides */
  margin-top: 0 !important;
}

/* Header Username Styling */
.app-header .user-name {
  font-weight: 600 !important;
  padding: 0.25rem 0.5rem !important;
  border-radius: 4px !important;
  display: inline-block !important;
  margin: 0 !important;
}

/* Sidebar Logo Styling */
.sidebar-logo {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
}

.sidebar-logo img {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ===== Light Mode Fixes ===== */
[data-theme-mode="light"] .app-header .user-name,
[data-theme-mode="light"] .dropdown-item.active .user-name,
html[data-theme-mode="light"] .app-header .user-name {
  color: #fff !important;
  background-color: rgba(var(--primary-rgb), 0.9) !important;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
}

[data-theme-mode="light"] .fc .fc-col-header-cell,
.light-mode .fc .fc-col-header-cell {
    background-color: #f0f0f0;
}

.light-mode .fc .fc-col-header-cell-cushion,
[data-theme-mode="light"] .fc .fc-col-header-cell-cushion {
    color: #333333 !important;
    font-weight: 600;
}

/* Fix calendar backgrounds for themes */
.light-mode .fc-scrollgrid, .light-mode .fc-theme-standard td,
.light-mode .fc-theme-standard th,
[data-theme-mode="light"] .fc-scrollgrid,
[data-theme-mode="light"] .fc-theme-standard td,
[data-theme-mode="light"] .fc-theme-standard th {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.dark-mode .fc-day, [data-theme-mode="dark"] .fc-day{
    background-color: var(--dark-color) !important;
}

/* ===== Dark Mode Fixes ===== */
.dark-mode .fc .fc-col-header-cell,
[data-theme-mode="dark"] .fc .fc-col-header-cell {
  background-color: var(--custom-white) !important;
  color: #fff !important;
}

.dark-mode .fc .fc-col-header-cell-cushion,
[data-theme-mode="dark"] .fc .fc-col-header-cell-cushion {
  color: #fff !important;
  font-weight: 600;
}

[data-theme-mode="dark"] .fc-scrollgrid,
[data-theme-mode="dark"] .fc-theme-standard .fc-scrollgrid,
[data-theme-mode="dark"] .fc-theme-standard td,
[data-theme-mode="dark"] .fc-theme-standard th,
.dark-mode .fc-scrollgrid,
.dark-mode .fc-theme-standard .fc-scrollgrid,
.dark-mode .fc-theme-standard td,
.dark-mode .fc-theme-standard th {
  border-color: #555 !important;

}

[data-theme-mode="dark"] .fc-daygrid-day-number,
.dark-mode .fc-daygrid-day-number {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* General Text Contrast Fixes */
[data-theme-mode="light"] .form-control {
  color: #333 !important;
  background-color: #fff !important;
}

[data-theme-mode="dark"] .form-control {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Sidebar Link Contrast Fixes */
[data-theme-mode="light"] .side-menu__item {
  color: rgba(0, 0, 0, 0.7) !important;
}

[data-theme-mode="light"] .side-menu__item.active {
  color: rgb(var(--primary-rgb)) !important;
  background-color: rgba(var(--primary-rgb), 0.1) !important;
}

[data-theme-mode="dark"] .side-menu__item {
  color: rgba(255, 255, 255, 0.7) !important;
}

[data-theme-mode="dark"] .side-menu__item.active {
  color: #fff !important;
  background-color: rgba(var(--primary-rgb), 0.2) !important;
}

/* Card and Modal Contrast Fixes */
[data-theme-mode="light"] .card {
  background-color: #fff !important;
  border-color: rgba(0, 0, 0, 0.125) !important;
}

[data-theme-mode="dark"] .card {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme-mode="light"] .modal-content {
  background-color: #fff !important;
}

[data-theme-mode="dark"] .modal-content {
  background-color: #1a1a1a !important;
  color: #fff !important;
}

/* Table Contrast Fixes */
[data-theme-mode="light"] .table,
.light-mode .table {
  color: #333 !important;
}

[data-theme-mode="dark"] .table,
.dark-mode .table {
  color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme-mode="dark"] .table thead th,
.dark-mode .table thead th {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme-mode="dark"] .table td,
[data-theme-mode="dark"] .table th,
.dark-mode .table td,
.dark-mode .table th {
  border-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme-mode="dark"] .table-hover tbody tr:hover,
.dark-mode .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
}

/* Button Contrast Fixes */
[data-theme-mode="light"] .btn-outline-secondary {
  color: #333 !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

[data-theme-mode="dark"] .btn-outline-secondary {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme-mode="light"] .btn-secondary {
  background-color: #e9ecef !important;
  color: #333 !important;
  border-color: #dde2e6 !important;
}

[data-theme-mode="dark"] .btn-secondary {
  background-color: #383838 !important;
  color: #fff !important;
  border-color: #4a4a4a !important;
}

/* ===== Mobile App Specific Styles ===== */
body.mobile-app {
  padding-bottom: 70px; /* Space for bottom nav */
}

.header-compact {
  background: var(--card-bg);
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.greeting {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.current-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.main-content-mobile {
  padding: 1rem;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem;
  z-index: 1000;
}

.nav-item {
  flex: 1;
  text-align: center;
}

.nav-link {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.nav-link.active {
  color: var(--theme-primary);
}

.nav-link i {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

/* Search bar styles */
.search-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.search-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  border-radius: 8px;
}

.search-input:focus {
  background: var(--input-focus-bg);
  border-color: var(--theme-primary);
  color: var(--text-color);
  box-shadow: 0 0 0 0.25rem var(--theme-primary-transparent);
}

/* Business card styles */
.business-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.business-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.business-logo {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.business-info {
  padding-left: 1rem;
}

.business-name {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.business-address {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 1rem;
}

/* Mobile Interface Styles */
.mobile-app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

.mobile-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--header-bg);
    color: var(--header-color);
    border-bottom: 1px solid rgba(var(--body-color-rgb), 0.1);
}

.mobile-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--body-bg-color);
    color: var(--body-color);
}

.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--sidebar-bg);
    padding: 0.5rem 1rem;
    z-index: 1000;
    border-top: 1px solid rgba(var(--body-color-rgb), 0.1);
}

.mobile-nav .nav-item {
    text-align: center;
    flex: 1;
}

.mobile-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    color: var(--sidebar-color);
    opacity: 0.7;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.mobile-nav .nav-link i {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.mobile-nav .nav-link span {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-nav .nav-link.active {
    color: var(--primary-bg-color);
    opacity: 1;
}

/* Greeting Styles */
.greeting {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.current-date {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Button Icon Styles */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: var(--body-color);
    position: relative;
}

.btn-icon:hover {
    background-color: rgba(var(--body-color-rgb), 0.05);
}

.btn-icon i {
    font-size: 1.5rem;
}

/* Notification Dropdown Styles */
.dropdown-menu {
    background-color: var(--card-bg);
    color: var(--card-color);
    border-color: rgba(var(--body-color-rgb), 0.1);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.dropdown-header {
    background-color: var(--primary-bg-color);
    color: #fff;
    font-weight: 600;
}

.dropdown-item {
    color: var(--card-color);
}

.dropdown-item:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-bg-color);
}

.dropdown-item.unread {
    background-color: rgba(var(--primary-rgb), 0.05);
}

.notification-icon {
    font-size: 1.5rem;
    color: var(--primary-bg-color);
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.notification-text {
    color: var(--body-color);
    opacity: 0.8;
}

/* Mobile Card Styles */
.mobile-card {
    background-color: var(--card-bg);
    color: var(--card-color);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid rgba(var(--body-color-rgb), 0.08);
}

.mobile-card-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(var(--body-color-rgb), 0.08);
    font-weight: 600;
}

.mobile-card-body {
    padding: 1rem;
}

.mobile-card-footer {
    padding: 1rem;
    border-top: 1px solid rgba(var(--body-color-rgb), 0.08);
}

/* Add padding to mobile content to account for the bottom navigation */
.mobile-content {
    padding-bottom: 5rem;
}

/* Ensure theme toggle button is above the mobile navigation */
.theme-toggle-btn {
    z-index: 1001;
    bottom: 70px;
}

/* Main Header Custom Fixes */
.app-header .d-flex.align-items-center.justify-content-center {
    position: relative;
}

.header-logo-container {
    z-index: 1;
}

.header-logo-container .logo {
    max-height: 40px;
}

/* Notifications Dropdown Positioning */
#notificationsDropdown[data-bs-popper="none"] {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-top: 0.5rem !important;
}

/* Avatar Styling */
.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    font-size: 0.8rem;
}

.avatar img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Badge Fixes for Workers Page */
[data-theme-mode="dark"] .badge,
.dark-mode .badge {
  color: #ffffff !important;
}

[data-theme-mode="dark"] .badge.bg-primary,
.dark-mode .badge.bg-primary {
  background-color: rgba(var(--primary-rgb), 0.7) !important;
}

[data-theme-mode="light"] .phone-country-select option,
[data-theme-mode="light"] select.phone-country-select option {
  background-color: #fff !important;
  color: #212529 !important;
}

[data-theme-mode="dark"] .phone-country-select option,
[data-theme-mode="dark"] select.phone-country-select option {
  background-color: #333 !important;
  color: #fff !important;
  padding: 8px !important;
}

/* Force dropdown text to be visible in both themes */
.phone-country-select option,
select.phone-country-select option,
.form-control.phone-country-select option {
  padding: 8px !important;
  font-size: 14px !important;
}

/* Light mode text color fixes */
[data-theme-mode="light"] .mobile-content,
.light-mode .mobile-content {
    color: #333333 !important;
}

[data-theme-mode="light"] .mobile-header,
.light-mode .mobile-header {
    color: #333333 !important;
}

[data-theme-mode="light"] .mobile-nav,
.light-mode .mobile-nav {
    color: #333333 !important;
}

[data-theme-mode="light"] .mobile-nav .nav-link,
.light-mode .mobile-nav .nav-link {
    color: #555555 !important;
}

[data-theme-mode="light"] .mobile-nav .nav-link.active,
.light-mode .mobile-nav .nav-link.active {
    color: var(--primary-color) !important;
}

[data-theme-mode="light"] .mobile-content h1, 
[data-theme-mode="light"] .mobile-content h2, 
[data-theme-mode="light"] .mobile-content h3, 
[data-theme-mode="light"] .mobile-content h4,
.light-mode .mobile-content h1, 
.light-mode .mobile-content h2, 
.light-mode .mobile-content h3, 
.light-mode .mobile-content h4 {
    color: #333333 !important;
}

[data-theme-mode="light"] .mobile-content p,
[data-theme-mode="light"] .mobile-content div,
.light-mode .mobile-content p,
.light-mode .mobile-content div {
    color: #333333 !important;
}

[data-theme-mode="light"] .text-muted,
.light-mode .text-muted {
    color: #666666 !important;
}

[data-theme-mode="light"] .form-group label,
.light-mode .form-group label {
    color: #333333 !important;
}

[data-theme-mode="light"] .form-control,
.light-mode .form-control {
    color: #333333 !important;
    background-color: #ffffff !important;
    border-color: #cccccc !important;
}

[data-theme-mode="light"] .profile-form,
.light-mode .profile-form {
    background-color: #ffffff !important;
}

[data-theme-mode="light"] .profile-actions,
.light-mode .profile-actions {
    background-color: #ffffff !important;
}

[data-theme-mode="light"] .action-item,
.light-mode .action-item {
    color: #333333 !important;
}

[data-theme-mode="light"] .action-item.text-danger,
.light-mode .action-item.text-danger {
    color: #dc3545 !important;
}

/* Fix for input placeholders */
[data-theme-mode="light"] .form-control::placeholder,
.light-mode .form-control::placeholder {
    color: #999999 !important;
} 