/**
 * ZADI - Components CSS
 * Reusable UI components
 * Buttons, Cards, Forms, Badges, Modals, Navbar, Footer
 */

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-1);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  min-height: 44px; /* Touch-friendly */
}

.btn:focus {
  outline: 2px solid var(--zadi-accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background-color: var(--zadi-accent);
  color: white;
  border-color: var(--zadi-accent);
}

.btn-primary:hover {
  background-color: var(--zadi-accent-dark);
  border-color: var(--zadi-accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
  text-decoration: none;
  color: white;
}

.btn-secondary {
  background-color: var(--zadi-text-secondary);
  color: white;
  border-color: var(--zadi-text-secondary);
}

.btn-secondary:hover {
  background-color: var(--zadi-text-primary);
  border-color: var(--zadi-text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: white;
}

.btn-outline {
  background-color: transparent;
  color: var(--zadi-accent);
  border-color: var(--zadi-accent);
}

.btn-outline:hover {
  background-color: var(--zadi-accent);
  color: white;
  text-decoration: none;
}

.btn-ghost {
  background-color: transparent;
  color: var(--zadi-accent);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--zadi-surface-dark);
  text-decoration: none;
}

.btn-success {
  background-color: var(--zadi-success);
  color: white;
  border-color: var(--zadi-success);
}

.btn-success:hover {
  background-color: #00a07d;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 184, 148, 0.3);
  text-decoration: none;
  color: white;
}

.btn-warning {
  background-color: var(--zadi-warning);
  color: var(--zadi-text-primary);
  border-color: var(--zadi-warning);
}

.btn-warning:hover {
  background-color: #f8b739;
  transform: translateY(-2px);
  text-decoration: none;
}

.btn-error {
  background-color: var(--zadi-error);
  color: white;
  border-color: var(--zadi-error);
}

.btn-error:hover {
  background-color: #c92a2a;
  transform: translateY(-2px);
  text-decoration: none;
  color: white;
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--font-size-lg);
  min-height: 52px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Button Icon */
.btn i {
  font-size: 1.25em;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background-color: var(--zadi-surface);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-header {
  padding: var(--spacing-3);
  border-bottom: 1px solid var(--zadi-border);
  background-color: var(--zadi-surface);
}

.card-body {
  padding: var(--spacing-3);
}

.card-footer {
  padding: var(--spacing-3);
  border-top: 1px solid var(--zadi-border);
  background-color: var(--zadi-surface-dark);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-1);
  color: var(--zadi-text-primary);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--zadi-text-secondary);
  margin-bottom: var(--spacing-2);
}

.card-text {
  color: var(--zadi-text-secondary);
  line-height: var(--line-height-relaxed);
}

.card-img-top {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Card Variants */
.card-featured {
  border: 2px solid var(--zadi-accent);
  box-shadow: var(--shadow-accent);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--zadi-border);
}

.card-flat:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background-color: var(--zadi-accent-light);
  color: var(--zadi-accent-dark);
}

.badge-success {
  background-color: #d4edda;
  color: #155724;
}

.badge-warning {
  background-color: #fff3cd;
  color: #856404;
}

.badge-error {
  background-color: #f8d7da;
  color: #721c24;
}

.badge-info {
  background-color: #d1ecf1;
  color: #0c5460;
}

.badge-secondary {
  background-color: var(--zadi-surface-dark);
  color: var(--zadi-text-secondary);
}

/* Badge Sizes */
.badge-sm {
  padding: 0.15rem 0.3rem;
  font-size: 0.4rem;
  line-height: 1;
}

.badge-lg {
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-3);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-1);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--zadi-text-primary);
}

.form-label-required::after {
  content: " *";
  color: var(--zadi-error);
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  color: var(--zadi-text-primary);
  background-color: var(--zadi-surface);
  border: 2px solid var(--zadi-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 44px; /* Touch-friendly */
}

.form-control:focus {
  border-color: var(--zadi-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 24, 68, 0.1);
}

.form-control:disabled {
  background-color: var(--zadi-surface-dark);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-control::placeholder {
  color: var(--zadi-text-muted);
}

/* Form Control Sizes */
.form-control-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.form-control-lg {
  padding: 1rem 1.25rem;
  font-size: var(--font-size-lg);
  min-height: 52px;
}

/* Textarea */
textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Select */
select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636e72' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  margin-bottom: var(--spacing-2);
  min-height: 44px; /* Touch-friendly */
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0;
  cursor: pointer;
  accent-color: var(--zadi-accent);
}

.form-check-label {
  cursor: pointer;
  user-select: none;
}

/* Form Validation */
.form-control.is-valid {
  border-color: var(--zadi-success);
}

.form-control.is-invalid {
  border-color: var(--zadi-error);
}

.valid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm);
  color: var(--zadi-success);
}

.invalid-feedback {
  display: none;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm);
  color: var(--zadi-error);
}

.form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

.form-text {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--font-size-sm);
  color: var(--zadi-text-secondary);
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group .form-control {
  flex: 1;
  border-radius: 0;
}

.input-group .form-control:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.input-group .form-control:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  color: var(--zadi-text-secondary);
  background-color: var(--zadi-surface-dark);
  border: 2px solid var(--zadi-border);
  border-radius: var(--radius-md);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  position: relative;
  padding: var(--spacing-2) var(--spacing-3);
  margin-bottom: var(--spacing-3);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
}

.alert-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-warning {
  background-color: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-dismissible {
  padding-right: 3rem;
}

.alert-dismissible .btn-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.alert-dismissible .btn-close:hover {
  opacity: 1;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-2) 0;
  background-color: var(--zadi-surface);
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--zadi-accent);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--zadi-accent-dark);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--zadi-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
  padding: 0.5rem 0;
}

.nav-link:hover {
  color: var(--zadi-accent);
  text-decoration: none;
}

.nav-link.active {
  color: var(--zadi-accent);
  border-bottom: 2px solid var(--zadi-accent);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background-color: var(--zadi-text-primary);
  color: white;
  padding: var(--spacing-6) 0 var(--spacing-3) 0;
  margin-top: var(--spacing-8);
}

.footer a {
  color: white;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--zadi-accent-light);
  text-decoration: underline;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-bottom {
  margin-top: var(--spacing-4);
  padding-top: var(--spacing-3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--zadi-text-muted);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 24, 68, 0.2);
  border-top-color: var(--zadi-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.spinner-lg {
  width: 3rem;
  height: 3rem;
  border-width: 4px;
}

/* ============================================
   MODAL (Basic)
   ============================================ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  animation: fadeIn var(--transition-fast);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--zadi-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  animation: fadeInUp var(--transition-base);
}

.modal-header {
  padding: var(--spacing-3);
  border-bottom: 1px solid var(--zadi-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.modal-body {
  padding: var(--spacing-3);
}

.modal-footer {
  padding: var(--spacing-3);
  border-top: 1px solid var(--zadi-border);
  display: flex;
  gap: var(--spacing-2);
  justify-content: flex-end;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-item {
  display: inline-block;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--zadi-text-primary);
  background-color: var(--zadi-surface);
  border: 2px solid var(--zadi-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.page-link:hover {
  background-color: var(--zadi-accent);
  border-color: var(--zadi-accent);
  color: white;
  text-decoration: none;
}

.page-item.active .page-link {
  background-color: var(--zadi-accent);
  border-color: var(--zadi-accent);
  color: white;
}

.page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   COUPON CARDS
   ============================================ */
.coupon-card {
  transition: all 0.3s ease;
  border: 1px solid #e0e0e0;
}

.coupon-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.coupon-card .card-img-top {
  height: 200px;
  object-fit: cover;
  border-radius: 0.75rem 0.75rem 0 0;
}

.coupon-badges .badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
}

.vendor-logo {
  border: 2px solid var(--zadi-accent);
}

.coupon-tags {
  display: flex;
  gap: 0.25rem;
}

/* Vendor Info Styles */
.vendor-info {
  border-left: 3px solid #ff1844;
  padding-left: 8px;
  margin: 8px 0;
}

.vendor-name {
  font-weight: 600;
  color: #333;
  line-height: 1.2;
}

.vendor-location {
  color: #666;
  font-size: 0.75rem;
  line-height: 1.2;
}

/* Offer Details Styles */
.offer-details {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
}

.detail-item {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
}

.detail-item i {
  color: #ff1844;
  width: 12px;
  text-align: center;
}

/* Offer Page Specific Styles */
.vendor-info {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.vendor-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.vendor-name {
  color: #333;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.vendor-location {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.offer-details {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.detail-item:last-child {
  margin-bottom: 0;
}

.detail-item i {
  width: 16px;
  text-align: center;
  margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .coupon-card .card-img-top {
    height: 150px;
  }
  
  .vendor-info {
    padding: 0.75rem;
  }
  
  .offer-details {
    padding: 0.75rem;
  }
  
  /* Mobile-specific fixes */
  .coupon-card {
    margin: 0;
    width: 100%;
    max-width: 100%;
  }
  
  .coupon-card .card-body {
    padding: 1rem;
  }
  
  .coupon-badges .badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
  }
  
  .card-title {
    font-size: 1rem;
    line-height: 1.3;
  }
  
  .vendor-name {
    font-size: 0.85rem;
  }
  
  .vendor-location {
    font-size: 0.7rem;
  }
  
  .detail-item {
    font-size: 0.75rem;
  }
  
  /* Ensure buttons fit properly */
  .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
}

/* ============================================
   LIST VIEW STYLES
   ============================================ */
.list-view {
  display: block !important;
}

.list-view .card {
  display: flex;
  flex-direction: row;
  margin-bottom: 1rem;
}

.list-view .card-img-top {
  width: 200px;
  height: 150px;
  object-fit: cover;
}

.list-view .card-body {
  flex: 1;
}

/* ============================================
   COMMON INLINE STYLES
   ============================================ */
/* Brand logo */
.navbar-brand {
  color: var(--zadi-accent) !important;
  font-size: 24px;
}

.navbar-brand i {
  color: var(--zadi-accent) !important;
}

/* Button icon colors */
.btn-primary i {
  color: white !important;
}

.btn-outline-primary i {
  color: var(--zadi-accent) !important;
}

/* Card image placeholders */
.card-img-placeholder {
  height: 200px;
  background: linear-gradient(135deg, var(--zadi-accent) 0%, var(--zadi-accent-light) 100%);
}

.card-img-placeholder i {
  font-size: 3rem;
}

.card-img-placeholder-large {
  height: 300px;
  background: linear-gradient(135deg, var(--zadi-accent) 0%, var(--zadi-accent-light) 100%);
}

.card-img-placeholder-large i {
  font-size: 4rem;
}

/* Vendor logo sizes */
.vendor-logo-large {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.vendor-logo-medium {
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.vendor-logo-small {
  width: 50px;
  height: 50px;
  object-fit: cover;
}

.vendor-logo-xs {
  width: 32px;
  height: 32px;
  object-fit: cover;
}

/* Vendor logo placeholder */
.vendor-logo-placeholder {
  width: 100px;
  height: 100px;
  background-color: var(--zadi-accent);
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.vendor-logo-placeholder-medium {
  width: 80px;
  height: 80px;
  background-color: var(--zadi-accent);
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.vendor-logo-placeholder-small {
  width: 50px;
  height: 50px;
  background-color: var(--zadi-accent);
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Cover photo */
.cover-photo {
  height: 300px;
  background-size: cover;
  background-position: center;
}

/* Back to top button */
.back-to-top {
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  padding: 0;
}

/* Notification time */
.notification-time {
  font-size: 0.7rem;
}

/* Progress bar */
.progress-thin {
  height: 4px;
}

