/* Component Library - Horse Festival Platform 2026 */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 44px; /* Standardize height */
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

@media (max-width: 768px) {
  .btn {
    height: 48px; /* Larger touch targets on mobile */
  }
}

.btn-lg {
  height: 52px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--border-radius-lg);
}

@media (max-width: 768px) {
  .btn-lg {
    height: 56px;
  }
}

.btn-sm {
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--border-radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--border-radius-md);
}

.btn-primary {
  background-color: var(--accent-red);
  color: white;
  box-shadow: var(--shadow-red);
}

.btn-primary:hover {
  background-color: var(--accent-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(212, 0, 0, 0.35);
}

.btn-primary:active {
  background-color: var(--accent-red-active);
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-dark {
  background-color: var(--bg-dark);
  color: white;
}

.btn-dark:hover {
  background-color: #27272A;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--text-primary);
  background-color: var(--bg-secondary);
}

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

.btn-outline-red:hover {
  background-color: var(--accent-red-light);
}

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

.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background-color: var(--status-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #DC2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background-color: var(--status-warning);
  color: white;
}

.btn-warning:hover {
  background-color: #D97706;
}

/* High Contrast Header Links for Admin Navbar */
.navbar.card-dark .nav-link,
.admin-nav-link {
  color: #FFFFFF !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  opacity: 0.9;
  padding: 0.4rem 0.6rem !important;
  border-radius: var(--border-radius-md);
  transition: var(--transition-fast);
}

.navbar.card-dark .nav-link:hover,
.admin-nav-link:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15) !important;
  color: #FFFFFF !important;
}

.navbar.card-dark .nav-link.active,
.admin-nav-link.active {
  opacity: 1;
  background: var(--accent-red) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(212, 0, 0, 0.4);
}

/* Cards & Surface Panels */
.card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: var(--transition-normal);
  max-width: 100%;
}

@media (max-width: 768px) {
  .card {
    padding: 1rem;
  }
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 0, 0, 0.12);
}

.card-dark {
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--border-radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
}

.badge-success {
  background-color: var(--status-success-bg);
  color: var(--status-success);
}

.badge-warning {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
}

.badge-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
}

.badge-info {
  background-color: var(--status-info-bg);
  color: var(--status-info);
}

.badge-red {
  background-color: var(--accent-red-light);
  color: var(--accent-red);
}

.badge-neutral {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Form Controls & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
}

.form-label .required {
  color: var(--accent-red);
}

.form-control {
  width: 100%;
  height: 44px; /* Standardize input height */
  padding: 0 var(--space-3);
  font-size: var(--text-base);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.15); /* Glass background */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-fast);
}

@media (max-width: 768px) {
  .form-control {
    height: 48px; /* Larger touch targets on mobile */
  }
}

.form-control:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-light);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  height: auto;
  min-height: 120px;
  padding: var(--space-3);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Hero Section */
.hero-section {
  position: relative;
  padding: 6rem 0 5rem 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--accent-red-light);
  color: var(--accent-red);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-pill);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.hero-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2.25rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.glass-heading {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  display: inline-block;
  font-size: 0.9em;
}

.hero-image-wrapper {
  position: relative;
  border-radius: var(--border-radius-xl);
  overflow: hidden;
}

.hero-image-wrapper img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  display: block;
}

.hero-stats-badge {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(12px);
  color: white;
  padding: 1.25rem 1.75rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  gap: 2rem;
}

body[dir="rtl"] .hero-stats-badge {
  right: auto;
  left: 24px;
}

.stat-item-mini h4 {
  color: white;
  font-size: 1.5rem;
}

.stat-item-mini p {
  color: #A1A1AA;
  font-size: 0.8rem;
}

/* Carousel & Lightbox */
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  aspect-ratio: 1080 / 1350; /* Vertical 4:5 */
  max-height: 70vh;
  overflow: hidden;
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-xl);
  background: transparent;
  cursor: pointer;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 1;
}

.carousel-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel-indicators .indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s;
}

.carousel-indicators .indicator.active {
  background: rgba(255, 255, 255, 1);
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 30px;
  cursor: pointer;
  background: none;
  border: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 40px;
  cursor: pointer;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

/* Multi-Step Wizard */
.wizard-header {
  margin-bottom: 2.5rem;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  max-width: 800px;
  margin: 0 auto 3rem auto;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.wizard-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  padding: 0 0.5rem;
}

.step-number {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.wizard-step.active .step-number {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: white;
  box-shadow: var(--shadow-red);
}

.wizard-step.completed .step-number {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: white;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wizard-step.active .step-label {
  color: var(--accent-red);
}

.wizard-step.completed .step-label {
  color: var(--text-primary);
}

/* Dynamic Horse Cards Container */
.horse-card-builder {
  background: rgba(248, 249, 250, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px dashed rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  max-width: 100%;
}

@media (max-width: 768px) {
  .horse-card-builder {
    padding: 1rem;
    margin-bottom: 1rem;
  }
}

.horse-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.horse-card-title {
  font-weight: 700;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Drag and Drop Upload Zone */
.upload-zone {
  border: 2px dashed rgba(212, 0, 0, 0.3);
  border-radius: var(--border-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: var(--transition-fast);
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .upload-zone {
    padding: 1.5rem 1rem;
  }
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-red);
  background: var(--accent-red-light);
}

.upload-icon {
  font-size: 2rem;
  color: var(--accent-red);
  margin-bottom: 0.75rem;
}

.uploaded-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.file-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius-md);
  font-size: 0.88rem;
}

.file-preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Data Table Grid */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  min-width: 280px;
}

.search-input-wrapper i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

body[dir="rtl"] .search-input-wrapper i { left: auto; right: 12px; }
body[dir="ltr"] .search-input-wrapper i { right: auto; left: 12px; }

body[dir="rtl"] .search-input-wrapper input { padding-right: 36px; padding-left: 12px; }
body[dir="ltr"] .search-input-wrapper input { padding-left: 36px; padding-right: 12px; }

.table-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: var(--text-sm);
}

body[dir="ltr"] .data-table {
  text-align: left;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-primary);
}

.data-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  /* Allow text to wrap to save horizontal space */
  white-space: normal; 
}

.data-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.015);
}

.table-pagination {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Admin Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 80px);
}

.sidebar {
  background: var(--bg-dark);
  color: white;
  padding: 2rem 1.25rem;
  border-left: 1px solid var(--border-color-dark);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

body[dir="ltr"] .sidebar {
  border-left: none;
  border-right: 1px solid var(--border-color-dark);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-md);
  color: var(--text-muted-on-dark);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.sidebar-nav-item.active {
  border-right: 4px solid var(--accent-red);
}

body[dir="ltr"] .sidebar-nav-item.active {
  border-right: none;
  border-left: 4px solid var(--accent-red);
}

.dashboard-main {
  padding: 2.5rem;
  background: var(--bg-secondary);
  overflow-y: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.kpi-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.kpi-badge {
  font-size: 0.75rem;
  align-self: flex-start;
}

/* Modals & Drawers */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

/* Side Drawer for Horse Profile */
.drawer-container {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 540px;
  max-width: 100%;
  background: var(--bg-card);
  z-index: 1100;
  box-shadow: var(--shadow-xl);
  padding: 2rem;
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
}

body[dir="rtl"] .drawer-container {
  left: 0;
  right: auto;
  transform: translateX(-100%);
  border-right: 1px solid var(--border-color);
}

body[dir="ltr"] .drawer-container {
  right: 0;
  left: auto;
  transform: translateX(100%);
  border-left: 1px solid var(--border-color);
}

.drawer-container.open {
  transform: translateX(0) !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Code Snippet Box */
.code-box {
  background: var(--bg-dark);
  color: #E4E4E7;
  font-family: 'Courier New', Courier, monospace;
  padding: 1.25rem;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  position: relative;
  max-height: 400px;
  border: 1px solid var(--border-color-dark);
}

.copy-btn {
  position: absolute;
  top: 12px;
  left: 12px;
}

body[dir="rtl"] .copy-btn {
  left: auto; right: 12px;
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .navbar, .footer, .sidebar, .btn, .table-toolbar, .table-pagination {
    display: none !important;
  }
  .dashboard-layout {
    grid-template-columns: 1fr !important;
  }
  .dashboard-main, .container {
    padding: 0 !important;
  }
  .table-container, .card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* Responsive Grid Adjustments */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border: none;
    border-bottom: 1px solid var(--border-color-dark);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .wizard-steps {
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
  }
  .wizard-steps::before {
    display: none;
  }
}
