@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Vazir", -apple-system, sans-serif;
  direction: rtl;
  background: #ffffff;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  /* Add safe area insets for app-like experience */
  padding-bottom: env(safe-area-inset-bottom);
}

/* PWA Full Screen Support */
body.standalone {
  padding-top: env(safe-area-inset-top);
}

/* iOS-style Bottom Navigation Bar - Always visible on mobile */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 9999;
  display: none;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }

  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

.mobile-bottom-nav .nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: #8e8e93;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  flex: 1;
}

.mobile-bottom-nav .nav-item.active {
  color: #10b981;
}

.mobile-bottom-nav .nav-item:active {
  transform: scale(0.9);
}

.mobile-bottom-nav .nav-item .icon {
  font-size: 24px;
  transition: transform 0.2s;
}

.mobile-bottom-nav .nav-item.active .icon {
  transform: translateY(-2px);
}

.mobile-bottom-nav .nav-item .label {
  font-size: 11px;
  font-weight: 500;
}

/* iOS-style Pull to Refresh */
.pull-to-refresh {
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
}

.pull-to-refresh.visible {
  opacity: 1;
}

.pull-to-refresh .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(16, 185, 129, 0.2);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* iOS-style Page Transitions */
.page-transition {
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* iOS-style Swipe Gestures */
.swipeable {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.swipeable.swiping {
  transition: none;
}

/* iOS-style Card Stack */
.card-stack {
  perspective: 1000px;
}

.card-stack .course-card {
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-stack .course-card:active {
  transform: scale(0.98);
}

/* iOS-style Modal Presentation */
.modal-ios {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-ios.active {
  display: block;
}

.modal-ios-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s;
}

.modal-ios-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-ios-handle {
  width: 40px;
  height: 4px;
  background: #d1d1d6;
  border-radius: 2px;
  margin: 12px auto;
}

/* iOS-style Haptic Feedback Simulation */
.haptic-light:active {
  animation: hapticPulse 0.1s;
}

@keyframes hapticPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.97);
  }
}

/* iOS-style Search Bar */
.search-bar-ios {
  background: #f2f2f7;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.search-bar-ios:focus-within {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-bar-ios input {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  font-size: 16px;
  color: #1d1d1f;
}

.search-bar-ios input::placeholder {
  color: #8e8e93;
}

/* iOS-style List Items */
.list-item-ios {
  background: white;
  padding: 16px;
  border-bottom: 1px solid #f2f2f7;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.list-item-ios:active {
  background: #f2f2f7;
}

.list-item-ios:last-child {
  border-bottom: none;
}

/* iOS-style Status Bar */
.status-bar-spacer {
  height: env(safe-area-inset-top);
  background: white;
}

/* iOS-style Action Sheet */
.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-sheet.active {
  transform: translateY(0);
}

.action-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}

.action-sheet.active .action-sheet-backdrop {
  opacity: 1;
}

.action-sheet-content {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.action-sheet-option {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid #f2f2f7;
  font-size: 17px;
  color: #007aff;
  cursor: pointer;
  transition: background 0.2s;
}

.action-sheet-option:active {
  background: #f2f2f7;
}

.action-sheet-option.destructive {
  color: #ff3b30;
}

.action-sheet-option:last-child {
  border-bottom: none;
}

/* Custom Scrollbar - Apple Style */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f5f7;
}

::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #86868b;
}

/* Smooth Transitions - Apple Style */
* {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button,
a {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Navigation Overlay */
.mobile-menu-overlay {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Card Hover Effects - Apple Style */
.course-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Touch-friendly mobile card interactions */
@media (max-width: 768px) {
  .course-card:active {
    transform: scale(0.98);
  }
}

@media (min-width: 769px) {
  .course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  }
}

/* Button Animations */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s;
}

.btn-primary:hover::before {
  transform: translateX(0);
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Loading Spinner */
.spinner {
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top: 3px solid #10b981;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Persian Number Font */
.persian-number {
  font-family: "Vazir", sans-serif;
  font-feature_settings: "tnum" 1;
}

/* Glass Effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.5s ease;
}

/* Certificate Badge */
.certificate-badge {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.3);
}

/* Chat Bubble */
.chat-bubble {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
  z-index: 1000;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Star Rating */
.star-rating {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.star {
  color: #fbbf24;
  font-size: 18px;
}

/* Video Player */
.video-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}

.video-player iframe,
.video-player video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Shopping Cart Badge */
.cart-badge {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
  min-width: 18px;
  text-align: center;
}

/* Search Overlay */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-overlay.active {
  display: flex;
}

/* Dashboard Sidebar */
.sidebar {
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(100%);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  padding: 8px;
  display: none;
  z-index: 1000;
}

.dropdown-menu.active {
  display: block;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 40px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

/* Tag Pills */
.tag {
  display: inline-block;
  background: #f3f4f6;
  color: #4b5563;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.tag.primary {
  background: #d1fae5;
  color: #065f46;
}

.tag.secondary {
  background: #dbeafe;
  color: #1e40af;
}

/* Accordion */
.accordion-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion-header {
  padding: 16px 20px;
  background: white;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: #f9fafb;
}

.accordion-body {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-item.active .accordion-body {
  padding: 16px 20px;
  max-height: 1000px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-right: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e5e7eb;
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
}

.timeline-dot {
  position: absolute;
  right: -36px;
  width: 20px;
  height: 20px;
  background: #10b981;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 0 0 2px #10b981;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-bubble {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .modal-content {
    padding: 24px;
  }

  .toast {
    right: 10px;
    left: 10px;
    top: 10px;
  }
}

/* Hide desktop header on mobile app mode */
@media (max-width: 768px) {
  body.app-mode header {
    display: none;
  }

  body.app-mode {
    padding-top: 0;
  }
}

/* iOS-style segment control */
.segment-control {
  display: inline-flex;
  background: #f2f2f7;
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

.segment-control button {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.segment-control button.active {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile-optimized grid for 2 columns */
@media (max-width: 768px) {
  .grid-cols-2 {
    gap: 12px;
  }

  .course-card {
    border-radius: 16px;
  }
}

/* Improved mobile touch targets */
@media (max-width: 768px) {
  button,
  a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tailwind Color Utilities */
.bg-primary {
  background-color: #10b981;
}
.bg-secondary {
  background-color: #3b82f6;
}
.bg-accent {
  background-color: #f97316;
}
.bg-dark {
  background-color: #1d1d1f;
}
.bg-light {
  background-color: #f5f5f7;
}

.text-primary {
  color: #10b981;
}
.text-secondary {
  color: #3b82f6;
}
.text-accent {
  color: #f97316;
}
.text-dark {
  color: #1d1d1f;
}

.border-primary {
  border-color: #10b981;
}
.border-secondary {
  border-color: #3b82f6;
}

.hover\:bg-green-600:hover {
  background-color: #059669;
}
.hover\:bg-gray-50:hover {
  background-color: #f9fafb;
}
.hover\:text-primary:hover {
  color: #10b981;
}
