/* MHomepage custom styles */

/* ========================================
   Dark Mode Theme
   ======================================== */

/* Smooth theme transitions */
*, *::before, *::after {
  transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- Page/body backgrounds --- */
[data-theme="dark"] .bg-gray-50 { background-color: #0f172a; }
[data-theme="dark"] .bg-gray-100 { background-color: #1f2937; }
[data-theme="dark"] .bg-white { background-color: #1e293b; }
[data-theme="dark"] .bg-gray-200 { background-color: #374151; }

/* --- Accent tint backgrounds --- */
[data-theme="dark"] .bg-indigo-50 { background-color: rgba(99, 102, 241, 0.12); }
[data-theme="dark"] .bg-amber-50 { background-color: rgba(245, 158, 11, 0.12); }
[data-theme="dark"] .bg-red-50 { background-color: rgba(239, 68, 68, 0.12); }
[data-theme="dark"] .bg-green-50 { background-color: rgba(34, 197, 94, 0.12); }
[data-theme="dark"] .bg-emerald-100 { background-color: rgba(16, 185, 129, 0.15); }
[data-theme="dark"] .bg-purple-100 { background-color: rgba(168, 85, 247, 0.15); }
[data-theme="dark"] .bg-indigo-100 { background-color: rgba(99, 102, 241, 0.15); }
[data-theme="dark"] .bg-green-100 { background-color: rgba(34, 197, 94, 0.15); }

/* --- Hover background states --- */
[data-theme="dark"] .hover\:bg-gray-200:hover { background-color: #374151; }
[data-theme="dark"] .hover\:bg-gray-300:hover { background-color: #4b5563; }
[data-theme="dark"] .hover\:bg-gray-100:hover { background-color: #334155; }
[data-theme="dark"] .hover\:bg-gray-50:hover { background-color: #1e293b; }
[data-theme="dark"] .hover\:bg-indigo-100:hover { background-color: rgba(99, 102, 241, 0.25); }

/* --- Text color overrides --- */
[data-theme="dark"] .text-gray-900 { color: #f1f5f9; }
[data-theme="dark"] .text-gray-800 { color: #e2e8f0; }
[data-theme="dark"] .text-gray-700 { color: #cbd5e1; }
[data-theme="dark"] .text-gray-600 { color: #94a3b8; }
[data-theme="dark"] .text-gray-500 { color: #64748b; }
[data-theme="dark"] .text-gray-400 { color: #475569; }

/* Indigo text - brighter for readability on dark bg */
[data-theme="dark"] .text-indigo-600 { color: #818cf8; }
[data-theme="dark"] .text-indigo-700 { color: #8b8cfe; }
[data-theme="dark"] .text-indigo-500 { color: #818cf8; }
[data-theme="dark"] .text-amber-600 { color: #fbbf24; }

/* --- Hover text states --- */
[data-theme="dark"] .hover\:text-indigo-600:hover { color: #a5b4fc; }
[data-theme="dark"] .hover\:text-indigo-800:hover { color: #c7d2fe; }
[data-theme="dark"] .hover\:text-indigo-700:hover { color: #a5b4fc; }
[data-theme="dark"] .hover\:text-gray-600:hover { color: #94a3b8; }
[data-theme="dark"] .hover\:text-gray-700:hover { color: #cbd5e1; }

/* --- Border overrides --- */
[data-theme="dark"] .border-gray-100 { border-color: #1e293b; }
[data-theme="dark"] .border-gray-200 { border-color: #334155; }
[data-theme="dark"] .border-gray-300 { border-color: #475569; }

/* --- Shadow overrides - dark mode uses darker shadows --- */
[data-theme="dark"] .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5); }

/* --- Form element overrides --- */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748b;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  border-color: #818cf8;
}

/* --- Card hover shadow --- */
[data-theme="dark"] .hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5); }

/* --- Remove white ring in dark mode --- */
[data-theme="dark"] .ring-white { --tw-ring-color: #334155; }

/* ========================================
   Theme Toggle Button
   ======================================== */
.theme-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 1rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.3s ease;
}
.theme-toggle-btn:hover {
  background-color: #f3f4f6;
  color: #4f46e5;
}
.theme-toggle-btn:active {
  transform: scale(0.9);
}
[data-theme="dark"] .theme-toggle-btn {
  color: #94a3b8;
}
[data-theme="dark"] .theme-toggle-btn:hover {
  background-color: #334155;
  color: #a5b4fc;
}

/* Tooltip on hover */
.theme-toggle-btn .theme-tooltip {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.theme-toggle-btn:hover .theme-tooltip {
  opacity: 1;
}
[data-theme="dark"] .theme-toggle-btn .theme-tooltip {
  background: #f1f5f9;
  color: #1e293b;
}
