/* ===== 1. RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== 2. THEME VARIABLES (PROFESSIONAL DARK BY DEFAULT) ===== */
:root {
  /* Dark Mode Palette (Matched with lawProject - Flipped) */
  --bg-primary: #18181b;
  --bg-secondary: #09090b;
  --bg-header: #18181b;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --accent: #34d399;
  --accent-hover: #059669;
  --border: #27272a;
  --card-bg: #09090b;
  --footer-bg: #18181b;
  --overlay: rgba(9, 9, 11, 0.75);
  --shadow: rgba(0, 0, 0, 0.6);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-primary: #e2e8f0; /* Darker background for better contrast against white cards */
  --bg-secondary: #cbd5e1;
  --bg-header: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --accent: #059669;
  --accent-hover: #047857;
  --border: #94a3b8; /* Much more visible borders */
  --card-bg: #ffffff;
  --footer-bg: #ffffff;
  --overlay: rgba(15, 23, 42, 0.5);
  --shadow: rgba(0, 0, 0, 0.2); /* Stronger shadow for depth */
}

/* Light mode specifics */
[data-theme="light"] .vehicle-item,
[data-theme="light"] .report-item,
[data-theme="light"] .car-card,
[data-theme="light"] .profile-sidebar,
[data-theme="light"] .profile-main,
[data-theme="light"] #report-details,
[data-theme="light"] .content {
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px var(--shadow);
}
[data-theme="light"] header {
  border-bottom: 1px solid var(--border);
}

/* ===== 3. HEADER ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 5%;
  background: var(--bg-header);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px var(--shadow);
  transition: transform 0.3s ease-in-out, background-color 0.3s ease,
    border-color 0.3s ease;
}

header.header-hidden {
  transform: translateY(-100%);
}

.logo-link {
  text-decoration: none;
  display: inline-block;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-svg {
  width: 44px;
  height: 44px;
  transition: transform 0.3s ease;
}

.logo-link:hover .logo-svg {
  transform: scale(1.05);
}

.logo-c {
  color: #0f172a; /* slate-900 */
}

[data-theme="dark"] .logo-c {
  color: #ffffff;
}

.logo-s-1,
.logo-s-2 {
  color: #4f46e5; /* indigo-600 */
}

[data-theme="dark"] .logo-s-1,
[data-theme="dark"] .logo-s-2 {
  color: #818cf8; /* indigo-400 */
}

.logo-s-3 {
  color: #06b6d4; /* cyan-500 */
}

[data-theme="dark"] .logo-s-3 {
  color: #22d3ee; /* cyan-400 */
}

.logo h2 {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-links {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 1rem;
}
.nav-links a:hover {
  background: var(--bg-secondary);
  color: var(--accent);
}

/* Language switcher */
.language-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: 1rem;
}
.language-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  padding: 0;
}
.language-links a:hover,
.language-links a.active {
  color: var(--accent);
}
.language-links .separator {
  color: var(--border);
}

/* Auth Buttons */
.auth-buttons {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-signin {
  background: var(--accent);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-signin:hover {
  background: var(--accent-hover);
}

/* User Menu */
.user-menu {
  position: relative;
  cursor: pointer;
}

.user-name {
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: inline-block;
  transition: border-color 0.2s;
}
.user-menu:hover .user-name {
  border-color: var(--accent);
}

.dropdown {
  display: none !important;
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px;
  z-index: 1000;
  margin-top: 8px;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px var(--shadow);
}
.dropdown.show {
  display: block !important;
}
.dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.9rem;
}
.dropdown a:hover {
  background: var(--bg-secondary);
  color: var(--accent);
}

/* Theme Toggle (lawProject Style) */
.theme-toggle {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--text-primary);
}
.theme-toggle:hover {
  background: var(--bg-secondary);
}
.theme-toggle svg {
  width: 24px;
  height: 24px;
}
.theme-toggle .sun-icon {
  display: none;
}
[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}
[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* ===== 4. MAIN CONTENT LAYOUT ===== */
main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 5%;
}

h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

/* ===== 5. BUTTONS (GENERAL) ===== */
.btn {
  background: var(--accent);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  color: #ffffff;
  font-size: 1rem;
}
.btn:hover {
  background: var(--accent-hover);
}

/* ===== 6. FORMS ===== */
form:not(.login-form) {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px var(--shadow);
  border: 1px solid var(--border);
  max-width: 500px;
  margin: 0 auto;
}
form:not(.login-form) div {
  margin-bottom: 1.5rem;
}
form:not(.login-form) label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text-primary);
  transition: border-color 0.2s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== 7. DASHBOARD / REPORT ITEMS ===== */
.vehicle-item,
.report-item {
  background: var(--card-bg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent);
}
.vehicle-item h3 a,
.report-item a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 600;
  transition: color 0.2s;
}
.vehicle-item h3 a:hover,
.report-item a:hover {
  color: var(--accent);
}
.vehicle-item p,
.report-item p {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== 8. PROFILE PAGE ===== */
.profile-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
}
.profile-sidebar,
.profile-main {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--border);
}
.profile-sidebar {
  text-align: center;
}
.avatar-placeholder {
  width: 90px;
  height: 90px;
  background: var(--bg-secondary);
  color: var(--accent);
  font-size: 2.5rem;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 2px solid var(--border);
}
.profile-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.profile-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-danger:hover {
  background: #b91c1c;
}
.danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
  padding: 1.5rem;
  border-radius: 8px;
}

/* ===== 9. FOOTER ===== */
footer {
  background-color: var(--footer-bg);
  padding: 40px 5%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  border-top: 1px solid var(--border);
}
.footer-section h2,
.footer-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.footer-section p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.footer-section ul {
  list-style: none;
}
.footer-section ul li {
  margin-bottom: 0.8rem;
}
.footer-section ul li a {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.footer-section ul li a:hover {
  color: var(--accent);
}
.live-support-btn {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.live-support-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== 10. UTILITIES & COMPONENTS ===== */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}
.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.spinner-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2.5rem;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  line-height: 1.8;
  color: var(--text-secondary);
}
.content h1,
.content h2 {
  color: var(--text-primary);
}
.content a {
  color: var(--accent);
  text-decoration: none;
}
.content a:hover {
  text-decoration: underline;
}

/* ===== 11. RTL SUPPORT (Logical Properties Handle Most) ===== */
.arabic {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
[dir="rtl"] .dropdown {
  inset-inline-end: 0;
  inset-inline-start: auto;
}

/* ===== 12. RESPONSIVE (MOBILE) ===== */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  nav {
    flex-direction: column;
    gap: 16px;
  }
  .nav-links {
    flex-wrap: wrap;
    width: 100%;
  }
  .profile-container {
    grid-template-columns: 1fr;
  }
}
