/* ==========================================================================
   CSS Variables - Black & Gold Theme (Box-Based UI)
========================================================================== */
:root {
  --bg-main: #000000;
  --bg-card: #151515;
  /* Defined dark pill boxes */
  --bg-card-light: #1e1e1e;
  --bg-glass: rgba(18, 18, 18, 0.85);

  --text-main: #ffffff;
  --text-muted: #888888;

  --gold-primary: #D4AF37;
  --gold-hover: #b9972c;
  --gold-light: #f3d674;
  --gold-gradient: linear-gradient(135deg, #e6c875 0%, #a88421 100%);

  --border-color: rgba(255, 255, 255, 0.08);
  /* subtle grey border */
  --border-focus: #D4AF37;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 35px;
  /* Heavy roundness like the images */
  --radius-full: 9999px;

  --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.15);
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.8);

  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   Reset & Base Styles
========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px;
  /* Space for bottom nav */
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
  outline: none;
  font-size: 16px;
  line-height: 1.4;
}

/* ==========================================================================
   Layout & Container
========================================================================== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

.page {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Typography
========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.text-gold {
  color: var(--gold-primary);
}

.text-gradient {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-muted {
  color: var(--text-muted);
}

/* ==========================================================================
   Components (Buttons, Cards, Forms)
========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1rem;
  transition: var(--transition);
}

.btn-primary {
  background: var(--gold-gradient);
  color: #000;
  box-shadow: var(--shadow-gold);
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-outline {
  background: transparent;
  color: var(--gold-primary);
  border: 2px solid var(--gold-primary);
}

.btn-ghost {
  background: var(--bg-card-light);
  color: var(--text-main);
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* The Pill Box Design from Screenshots */
.pill-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.pill-box-outline {
  border: 1px solid var(--gold-primary);
}

/* ==========================================================================
   Top Header (BarberGo Nav)
========================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-main);
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

.top-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lang-btn {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bell-btn {
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  position: relative;
}

.bell-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: red;
  border-radius: 50%;
}

/* ==========================================================================
   Floating Bottom Navigation
========================================================================== */
.bottom-nav-container {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
}

.bottom-nav {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: stretch;
  width: 90%;
  max-width: 400px;
  height: 70px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  gap: 4px;
  border-radius: var(--radius-lg);
}

.nav-item i {
  font-size: 1.2rem;
}

.nav-item.active {
  color: var(--gold-primary);
}

.nav-center-action {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 65px;
  height: 65px;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 1.5rem;
  box-shadow: var(--shadow-gold);
  border: 4px solid var(--bg-main);
  cursor: pointer;
  transition: transform 0.2s;
}

.nav-center-action:active {
  transform: translateX(-50%) scale(0.9);
}

/* ==========================================================================
   Barber Profile UI (Screenshots matched)
========================================================================== */
.profile-cover {
  height: 180px;
  background: linear-gradient(to bottom, #1a1a1a, #000);
  position: relative;
}

.profile-img-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin: -70px auto 15px;
}

.profile-img-container img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--gold-primary);
}

.verified-badge {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 35px;
  height: 35px;
  background: var(--gold-gradient);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--bg-main);
  font-size: 1rem;
}

.service-pill {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.service-details {
  text-align: right;
}

.service-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text-main);
}

.service-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.service-meta span {
  color: var(--gold-primary);
  font-weight: bold;
}

.service-action .btn {
  border-radius: var(--radius-sm);
  padding: 10px 25px;
}

/* AI Camera Box */
.ai-camera-box {
  background: #111;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  margin: 30px 0;
}

.ai-icon {
  width: 60px;
  height: 60px;
  border: 1px solid var(--gold-primary);
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  color: var(--gold-primary);
  font-size: 1.5rem;
}

/* Tabs Toggle (Gallery / Store) */
.tabs-container {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: 15px 0;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 700;
}

.tab-item.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 15px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.product-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 10px;
}

.product-card h4 {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.product-card .price {
  color: var(--gold-primary);
  font-weight: bold;
  margin-bottom: 15px;
}

.product-card .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Social Icons */
.social-icons-row {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
}

.social-icon {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  gap: 4px;
  cursor: pointer;
}

.social-icon.call {
  background: #ECA321;
}

.social-icon.whatsapp {
  background: #25D366;
}

.social-icon.facebook {
  background: #333;
  color: #555;
}

/* Inactive look from image */
.social-icon.instagram {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.social-icon span {
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
}

/* Address Box */
.address-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.address-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(50, 100, 255, 0.1);
  color: #4a90e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ==========================================================================
   Toasts & Notifications
========================================================================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-sm);
  padding: 15px;
  min-width: 300px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  animation: slideInRight 0.3s ease-out forwards;
}

.toast-success {
  border-color: #2ecc71;
}

.toast-warning {
  border-color: #f39c12;
}

.toast-error {
  border-color: #e74c3c;
}

.toast-info {
  border-color: #3498db;
}

.toast-icon {
  font-size: 1.5rem;
  margin-top: 2px;
}

.toast-success .toast-icon {
  color: #2ecc71;
}

.toast-warning .toast-icon {
  color: #f39c12;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--text-main);
}

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

.toast-close {
  color: var(--text-muted);
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Utilities */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.d-flex {
  display: flex;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

/* Booking & Schedule Grid */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.time-slot {
  background: var(--bg-card-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 15px 10px;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-main);
}

.time-slot:hover:not(.disabled) {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.1);
}

.time-slot.selected {
  background: var(--gold-primary);
  color: #000;
  border-color: var(--gold-primary);
  transform: scale(1.05);
  box-shadow: var(--shadow-gold);
}

.time-slot.disabled {
  background: rgba(255, 0, 0, 0.05);
  color: #666;
  text-decoration: line-through;
  cursor: not-allowed;
  border-color: rgba(255, 0, 0, 0.1);
}

/* ==========================================================================
   Mobile & Responsive Design
========================================================================== */

/* Ensure body is always visible on all devices */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
}

/* Tablet and mobile optimization */
@media (max-width: 768px) {
  .container {
    max-width: 100%;
    padding: 0 15px;
  }

  body {
    padding-bottom: 100px;
  }

  /* Ensure header is always visible and responsive */
  .top-header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .header-actions {
    gap: 8px;
  }

  .lang-btn,
  .bell-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  /* Make bottom nav more touch-friendly */
  .bottom-nav {
    height: 80px;
    width: 95%;
  }

  .nav-item {
    font-size: 0.7rem;
    padding: 8px 4px;
  }

  .nav-item i {
    font-size: 1rem;
  }

  /* Schedule grid for mobile */
  .schedule-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .time-slot {
    padding: 12px 8px;
    font-size: 0.85rem;
  }

  /* Products grid for mobile */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .product-card img {
    height: 150px;
  }

  /* Barber grid for mobile */
  .barbers-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .barber-grid-card {
    padding: 12px;
  }

  /* Profile image for mobile */
  .profile-img-container {
    width: 120px;
    height: 120px;
    margin: -60px auto 15px;
  }

  .profile-cover {
    height: 150px;
  }

  /* Pills and boxes for mobile */
  .pill-box {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  /* Form inputs for mobile */
  .form-control {
    font-size: 16px !important;
    padding: 12px !important;
    min-height: 44px;
  }

  /* Service pills for mobile */
  .service-pill {
    flex-direction: column;
    text-align: right;
  }

  .service-action .btn {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  /* Address box for mobile */
  .address-box {
    flex-direction: column;
    text-align: right;
    gap: 10px;
  }

  /* Social icons for mobile */
  .social-icons-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .social-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  /* Buttons for mobile */
  .btn {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 0.95rem;
  }

  .btn-block {
    width: 100%;
  }

  /* Toast notifications for mobile */
  #toast-container {
    top: 60px;
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
    font-size: 0.9rem;
  }

  /* Ensure search bar is responsive */
  .search-bar {
    flex-wrap: wrap;
    gap: 5px;
  }

  .search-bar input {
    min-height: 44px;
  }

  /* Tabs for mobile */
  .tabs-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-item {
    font-size: 0.9rem;
    padding: 12px 10px;
    min-width: max-content;
  }

  /* Fix for iOS Safari viewport issues */
  input,
  select,
  textarea,
  button {
    font-size: 16px !important;
  }
}

/* Small mobile devices (portrait) */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .schedule-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .time-slot {
    padding: 10px 6px;
    font-size: 0.8rem;
  }

  .pill-box {
    padding: 12px;
    margin-bottom: 15px;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    word-break: break-word;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-height: 40px;
  }

  .profile-cover {
    height: 120px;
  }

  .profile-img-container {
    width: 100px;
    height: 100px;
    margin: -50px auto 12px;
  }

  .barbers-list {
    gap: 10px;
  }

  .social-icon {
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }

  .top-header .container {
    padding: 0 8px;
  }

  .nav-item span {
    font-size: 0.65rem;
  }
}

/* Landscape orientation optimization */
@media (max-width: 768px) and (orientation: landscape) {
  body {
    padding-bottom: 80px;
  }

  .bottom-nav {
    height: 60px;
  }

  .nav-item {
    font-size: 0.65rem;
  }

  .page {
    padding-bottom: 80px !important;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .container {
    padding: 0 10px;
  }

  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .time-slot {
    padding: 8px 4px;
    font-size: 0.75rem;
  }

  .social-icon {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* High resolution mobile devices (pixel ratio) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimize for retina displays */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Fix for iPhone X and notch devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(100px, env(safe-area-inset-bottom));
  }

  .bottom-nav-container {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Ensure smooth scrolling on mobile */
html {
  scroll-behavior: smooth;
}

/* Prevent layout shift on mobile */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
