/* ============================================
   BUTTON SYSTEM - Unified Button Styles
   GraceMe Project - Single Source of Truth
   ============================================ */

/* ===== BASE BUTTON ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.5;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  min-height: 44px;
}

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

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* ===== SIZE MODIFIERS (must use !important to override base .btn) ===== */
.btn-sm {
  padding: 0.5rem 1rem !important;
  font-size: 0.875rem !important;
  border-radius: 8px !important;
  min-height: 36px !important;
}

.btn-xs {
  padding: 0.35rem 0.75rem !important;
  font-size: 0.8rem !important;
  border-radius: 6px !important;
  min-height: 30px !important;
}

.btn-lg {
  padding: 1rem 2rem !important;
  font-size: 1.125rem !important;
  border-radius: 14px !important;
  min-height: 52px !important;
}

/* ===== VARIANT BUTTONS (higher specificity than base .btn) ===== */

/* PRIMARY BUTTON */
.btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  border-color: #7c3aed;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #7c3aed;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

/* SECONDARY / OUTLINED BUTTON */
.btn-outline {
  background: #ffffff;
  color: #8b5cf6;
  border-color: #8b5cf6;
  box-shadow: none;
}

.btn-outline:hover:not(:disabled) {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
  transform: translateY(-2px);
}

/* SUCCESS BUTTON */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #047857;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

/* DANGER BUTTON */
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #b91c1c;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

/* WARNING BUTTON */
.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: #b45309;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

/* SECONDARY (GRAY) BUTTON */
.btn-secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: #ffffff;
  border-color: #475569;
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  border-color: #334155;
  box-shadow: 0 6px 20px rgba(100, 116, 139, 0.3);
  transform: translateY(-2px);
  color: #ffffff;
}

/* ===== BLOCK BUTTON ===== */
.btn-block {
  display: flex;
  width: 100%;
}

/* ===== LOADING STATE ===== */
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.btn-outline.loading::after {
  border-color: rgba(139, 92, 246, 0.3);
  border-top-color: #8b5cf6;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ===== OUTLINED VARIANTS ===== */
.btn-outline-success {
  background: #ffffff;
  color: #10b981;
  border-color: #10b981;
}

.btn-outline-success:hover:not(:disabled) {
  background: #10b981;
  color: #ffffff;
}

.btn-outline-danger {
  background: #ffffff;
  color: #ef4444;
  border-color: #ef4444;
}

.btn-outline-danger:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
}

.btn-outline-warning {
  background: #ffffff;
  color: #f59e0b;
  border-color: #f59e0b;
}

.btn-outline-warning:hover:not(:disabled) {
  background: #f59e0b;
  color: #ffffff;
}

/* ===== SOCIAL BUTTONS ===== */
.btn-vkid {
  background: #0077FF;
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 119, 255, 0.25);
}

.btn-vkid:hover:not(:disabled) {
  background: #0066DD;
  box-shadow: 0 6px 20px rgba(0, 119, 255, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

/* ===== CTA BUTTON ===== */
.btn-cta {
  background: #ffffff;
  color: #8b5cf6;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.btn-cta:hover {
  background: #f5f0f5;
  border-color: #f5f0f5;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  color: #8b5cf6;
}

/* ===== HERO BUTTONS (dark background — glass effect) ===== */
.hero-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  box-shadow: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Override for light hero sections (main page) */
.hero-section .hero-btn {
  border: none;
  backdrop-filter: none;
  box-shadow: none;
  background: transparent;
  color: inherit;
}

.hero-section .hero-btn-primary {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.hero-section .hero-btn-primary:hover {
  background: #7c3aed;
  border-color: #7c3aed;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
  transform: translateY(-2px);
  color: #ffffff;
}

.hero-section .hero-btn-secondary {
  background: #ffffff;
  color: #8b5cf6;
  border-color: #8b5cf6;
  box-shadow: none;
}

.hero-section .hero-btn-secondary:hover {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
  transform: translateY(-2px);
}

/* ===== QUICK ACTION BUTTON ===== */
.quick-action-btn {
  background: #ffffff;
  color: #1e293b;
  border: 2px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quick-action-btn:hover:not(:disabled) {
  border-color: #8b5cf6;
  background: #faf5ff;
  color: #8b5cf6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* ===== BOOKING BUTTON ===== */
.booking-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}

.booking-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.4);
  color: #ffffff;
}

.booking-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.booking-btn-outline {
  background: transparent;
  color: #8b5cf6;
  border: 2px solid #8b5cf6;
}

.booking-btn-outline:hover:not(:disabled) {
  background: #faf5ff;
  transform: translateY(-2px);
  color: #8b5cf6;
}

/* ===== MODAL BUTTONS ===== */
.modal-btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.modal-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  color: #ffffff;
}

.modal-btn-secondary {
  background: #f8fafc;
  color: #64748b;
  border: 2px solid #e2e8f0;
}

.modal-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: #1e293b;
}

/* ===== CONTEXTUAL BUTTON OVERRIDES ===== */

/* Master cabinet specific button contexts */
.slot-actions .btn-sm {
  flex: 1;
  min-width: 80px;
}

.appt-card-actions .btn-sm {
  flex: 1;
  min-width: 80px;
  padding: 0.625rem 0.875rem !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  border: none !important;
}

.appt-card-actions .btn-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
}

.appt-card-actions .btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.appt-card-actions .btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
}

.appt-card-actions .btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-actions .btn {
  flex: 1;
  min-width: 140px;
  padding: 0.875rem 1.25rem;
}

/* Stats detail button */
.stats-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.stats-detail-btn:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
  background: #faf5ff;
}

/* Slots collapse toggle */
.slots-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: #f7fafc;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.slots-collapse-toggle:hover {
  background: #edf2f7;
  color: #8b5cf6;
}

.slots-collapse-toggle.active .slots-collapse-icon {
  transform: rotate(180deg);
}

/* Portfolio buttons */
.portfolio-item-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #475569;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ====== MOBILE TOUCH TARGETS ====== */
@media (max-width: 768px) {
  /* Ensure all buttons have proper touch targets */
  .btn {
    min-height: 48px !important;
    padding: 0.875rem 1.5rem !important;
  }
  
  .btn-sm {
    min-height: 44px !important;
    padding: 0.625rem 1rem !important;
    font-size: 0.875rem !important;
  }
  
  .btn-xs {
    min-height: 40px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  
  /* Service items touch-friendly */
  .service-item,
  .slot-item {
    min-height: 52px !important;
  }
  
  /* Admin panel buttons */
  .admin-panel .btn,
  .admin-content .btn {
    min-height: 44px !important;
  }
  
  /* Table action buttons */
  .table-actions .btn,
  td .btn {
    min-height: 36px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 480px) {
  .btn {
    padding: 0.75rem 1.25rem !important;
    font-size: 0.95rem !important;
    min-height: 48px !important;
  }
  
  .btn-sm {
    min-height: 42px !important;
    padding: 0.5rem 0.875rem !important;
  }
}

.portfolio-item-btn:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.portfolio-item-btn.featured-btn.active {
  background: #fbbf24;
  color: #ffffff;
}

.portfolio-item-btn.delete-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Filter buttons */
.filter-btn {
  padding: 0.625rem 1.25rem;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.filter-btn.active {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  border-color: #8b5cf6;
}

/* Form grid submit button */
.form-grid button {
  height: fit-content;
}

/* ===== RESET BUTTON (used on landing page) ===== */
/* Higher specificity to override .btn-outline base */
.btn.reset-btn,
.btn-outline.reset-btn {
  padding: 0.6rem 1rem !important;
  font-size: 0.875rem !important;
}

/* ===== RESPONSIVE BUTTON OVERRIDES ===== */
@media (max-width: 768px) {
  .btn-sm {
    padding: 0.5rem 0.875rem !important;
    font-size: 0.9rem !important;
    min-height: 44px !important;
  }

  .btn-outline,
  .btn-sm {
    min-height: 44px !important;
  }
}

@media (max-width: 480px) {
  .btn-sm {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.8rem !important;
  }
}
