/* Ergometre Events - Public UI (shortcodes) */

/* Scope everything to prevent theme conflicts */
.ergoe-shortcode {
  --ergoe-accent: #2563eb; /* Modern blue */
  --ergoe-accent-soft: rgba(37, 99, 235, 0.1);
  --ergoe-success: #10b981;
  --ergoe-warning: #f59e0b;
  --ergoe-error: #ef4444;
  --ergoe-bg: #ffffff;
  --ergoe-fg: #1f2937;
  --ergoe-muted: #6b7280;
  --ergoe-border: #e5e7eb;
  --ergoe-border-strong: #d1d5db;
  --ergoe-surface: #f9fafb;
  --ergoe-radius: 16px;
  --ergoe-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --ergoe-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --ergoe-shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  max-width: 1000px;
  margin: 24px auto;
  padding: 32px;
  border: 1px solid var(--ergoe-border);
  border-radius: var(--ergoe-radius);
  background: var(--ergoe-bg);
  color: var(--ergoe-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-shadow: var(--ergoe-shadow);
}

/* Hero Section */
.ergoe-hero {
  background: linear-gradient(135deg, var(--ergoe-accent), #1e40af);
  color: #ffffff;
  padding: 40px;
  border-radius: 20px;
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.ergoe-hero::after {
  content: "";
  position: absolute;
  top: -20%;
  right: -5%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.ergoe-hero h3 {
  color: #ffffff !important;
  margin-bottom: 8px;
}

.ergoe-hero p {
  opacity: 0.9;
  font-size: 1.1rem;
  max-width: 500px;
  margin-bottom: 24px;
}

.ergoe-hero-stats {
  display: flex;
  gap: 30px;
  margin-top: 20px;
}

.ergoe-hero-stat {
  display: flex;
  flex-direction: column;
}

.ergoe-hero-stat strong {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.ergoe-hero-stat small {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  color: #fff;
}

.ergoe-hero-icon {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 50%;
  backdrop-filter: blur(4px);
}

.ergoe-hero-icon svg {
  width: 48px;
  height: 48px;
  stroke: #ffffff;
}

/* League Cards */
.ergoe-league-card h5 {
  font-size: 1.25rem;
  margin: 0 0 12px;
  font-weight: 800;
}

.ergoe-league-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ergoe-muted);
  font-size: 0.9rem;
}

.ergoe-league-meta span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ergoe-league-meta svg {
  width: 16px;
  height: 16px;
  stroke: var(--ergoe-muted);
}

.ergoe-shortcode h3 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ergoe-fg);
  margin-bottom: 24px;
}

.ergoe-shortcode h4 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 32px 0 16px;
  color: var(--ergoe-fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stats/Cards Grid */
.ergoe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.ergoe-card {
  background: var(--ergoe-bg);
  border: 1px solid var(--ergoe-border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--ergoe-shadow-sm);
}

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

.ergoe-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ergoe-status-pending { background: #fef3c7; color: #92400e; }
.ergoe-status-approved { background: #d1fae5; color: #065f46; }
.ergoe-status-booked { background: #dbeafe; color: #1e40af; }
.ergoe-status-cancelled { background: #f3f4f6; color: #374151; }
.ergoe-status-rejected { background: #fee2e2; color: #991b1b; }

/* Buttons */
.ergoe-shortcode button,
.ergoe-shortcode .ergoe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s ease;
  border: 0;
  cursor: pointer;
}

.ergoe-btn-primary {
  background: var(--ergoe-accent) !important;
  color: #fff !important;
}

.ergoe-btn-primary:hover {
  background: #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.ergoe-btn-secondary {
  background: #f3f4f6 !important;
  color: #374151 !important;
}

.ergoe-btn-secondary:hover {
  background: #e5e7eb !important;
}

.ergoe-btn-danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

.ergoe-btn-danger:hover {
  background: #fecaca !important;
}

/* Table Enhancements */
.ergoe-shortcode table {
  border: 0;
  box-shadow: var(--ergoe-shadow-sm);
  background: var(--ergoe-bg);
}

.ergoe-shortcode table thead th {
  background: var(--ergoe-surface);
  color: var(--ergoe-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
}

.ergoe-shortcode table td {
  padding: 16px;
  vertical-align: middle;
}

/* Event Selector Styling */
.ergoe-event-selector {
  background: var(--ergoe-surface);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid var(--ergoe-border);
}

.ergoe-event-selector select {
  font-size: 1rem;
  font-weight: 600;
  border-color: var(--ergoe-border-strong);
}

/* Podium Styles */
.ergoe-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 15px;
  margin: 40px 0;
  padding-bottom: 20px;
}

.ergoe-podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 180px;
}

.ergoe-podium-avatar {
  background: var(--ergoe-surface);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border: 2px solid var(--ergoe-border);
}

.ergoe-podium-avatar svg {
  stroke: var(--ergoe-muted);
}

.ergoe-podium-name {
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 4px;
}

.ergoe-podium-time {
  font-family: monospace;
  font-weight: 800;
  color: var(--ergoe-accent);
  margin-bottom: 12px;
}

.ergoe-podium-step {
  width: 100%;
  background: var(--ergoe-surface);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ergoe-muted);
  border: 1px solid var(--ergoe-border);
  border-bottom: 0;
}

.ergoe-podium-rank-1 .ergoe-podium-step { height: 120px; background: #fffbeb; border-color: #fde68a; color: #b45309; }
.ergoe-podium-rank-2 .ergoe-podium-step { height: 90px; background: #f9fafb; border-color: #e5e7eb; color: #4b5563; }
.ergoe-podium-rank-3 .ergoe-podium-step { height: 70px; background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

.ergoe-podium-rank-1 .ergoe-podium-avatar { width: 80px; height: 80px; border-color: #fbbf24; border-width: 4px; box-shadow: 0 0 20px rgba(251, 191, 36, 0.2); }
.ergoe-podium-rank-1 .ergoe-podium-name { font-size: 1.1rem; }

/* Leaderboard Specific */
.ergoe-table-leaderboard tr:nth-child(1) { background: rgba(255, 215, 0, 0.05); }
.ergoe-table-leaderboard tr:nth-child(2) { background: rgba(192, 192, 192, 0.05); }
.ergoe-table-leaderboard tr:nth-child(3) { background: rgba(205, 127, 50, 0.05); }

.ergoe-btn svg {
  margin-right: 8px;
  width: 18px;
  height: 18px;
}

/* Auth Containers */
.ergoe-signup-container, .ergoe-login-container {
  max-width: 500px !important;
}

@media (max-width: 640px) {
  .ergoe-hero {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
  .ergoe-hero-icon {
    margin-top: 20px;
    order: -1;
  }
  .ergoe-hero-stats {
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
  }
}

.ergoe-shortcode code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

/* Notices */
.ergoe-notice {
  padding: 12px 14px;
  border-radius: var(--ergoe-radius);
  margin: 12px 0;
  border: 1px solid var(--ergoe-border);
}

.ergoe-notice p {
  margin: 0;
}

.ergoe-notice.ergoe-success {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.25);
}

.ergoe-notice.ergoe-error {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.25);
}

/* Inline forms inside lists/tables */
.ergoe-shortcode form[style*="display:inline-block"] select {
  width: auto;
  max-width: 240px;
  display: inline-block;
}

.ergoe-shortcode form[style*="display:inline-block"] button {
  padding: 8px 10px;
  border-radius: 10px;
}

/* Dark mode (best-effort) */
@media (prefers-color-scheme: dark) {
  .ergoe-shortcode {
    --ergoe-bg: rgba(17, 24, 39, 0.65);
    --ergoe-fg: #f9fafb;
    --ergoe-muted: rgba(249, 250, 251, 0.72);
    --ergoe-border: rgba(255, 255, 255, 0.10);
    --ergoe-border-strong: rgba(255, 255, 255, 0.16);
    --ergoe-surface: rgba(255, 255, 255, 0.06);
  }

  .ergoe-shortcode input::placeholder,
  .ergoe-shortcode textarea::placeholder {
    color: rgba(249, 250, 251, 0.55);
  }

  .ergoe-shortcode code {
    background: rgba(255, 255, 255, 0.10);
  }

  .ergoe-notice.ergoe-success {
    background: rgba(16, 185, 129, 0.14);
  }

  .ergoe-notice.ergoe-error {
    background: rgba(239, 68, 68, 0.14);
  }
}

/* Mobile */
@media (max-width: 640px) {
  .ergoe-shortcode {
    padding: 14px;
  }

  .ergoe-shortcode input[type="text"],
  .ergoe-shortcode input[type="email"],
  .ergoe-shortcode input[type="url"],
  .ergoe-shortcode input[type="date"],
  .ergoe-shortcode input[type="number"],
  .ergoe-shortcode input[type="time"],
  .ergoe-shortcode select,
  .ergoe-shortcode textarea {
    max-width: 100%;
  }

  .ergoe-shortcode table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Profil Sayfası Özel Stilleri */
.ergoe-shortcode.ergoe-profile {
  position: relative;
}

.ergoe-shortcode.ergoe-profile .ergoe-profile-avatar-section {
  display: flex !important;
  justify-content: center !important;
  margin-bottom: 32px !important;
  padding-bottom: 32px !important;
  border-bottom: 1px solid var(--ergoe-border) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-profile-avatar-wrapper {
  position: relative !important;
  width: 150px !important;
  height: 150px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  border: 4px solid var(--ergoe-border) !important;
  background: var(--ergoe-surface) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ergoe-shortcode.ergoe-profile .ergoe-profile-avatar-wrapper:hover {
  transform: scale(1.02) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-profile-avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-profile-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-form-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-form-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-form-group > label:not(.ergoe-file-label) {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.ergoe-form-help {
  color: var(--ergoe-muted);
  font-size: 0.875em;
  margin-top: -4px;
}

/* Dosya Yükleme Stili */
.ergoe-shortcode.ergoe-profile .ergoe-avatar-upload-group {
  margin-bottom: 8px !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-label {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  border: 2px dashed var(--ergoe-border-strong) !important;
  border-radius: var(--ergoe-radius) !important;
  background: var(--ergoe-surface) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
  max-width: 520px !important;
  box-sizing: border-box !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-label:hover {
  border-color: var(--ergoe-accent) !important;
  background: color-mix(in srgb, var(--ergoe-accent) 5%, var(--ergoe-surface)) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-label input[type="file"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-label-text {
  font-weight: 600 !important;
  color: var(--ergoe-accent) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-file-label-name {
  color: var(--ergoe-muted) !important;
  font-size: 0.9em !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 !important;
}

.ergoe-file-input:focus + .ergoe-file-label-text,
.ergoe-file-input:focus-visible + .ergoe-file-label-text {
  outline: 2px solid color-mix(in srgb, var(--ergoe-accent) 35%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Form Actions */
.ergoe-shortcode.ergoe-profile .ergoe-form-actions {
  margin-top: 8px !important;
  padding-top: 20px !important;
  border-top: 1px solid var(--ergoe-border) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-btn-primary {
  appearance: none !important;
  border: 0 !important;
  border-radius: 10px !important;
  padding: 12px 24px !important;
  font-weight: 700 !important;
  font-size: 1em !important;
  cursor: pointer !important;
  background: var(--ergoe-accent) !important;
  color: #fff !important;
  transition: all 0.2s ease !important;
  min-width: 140px !important;
}

.ergoe-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ergoe-btn-primary:active {
  transform: translateY(0);
}

/* Mobile Responsive for Profile */
@media (max-width: 640px) {
  .ergoe-shortcode.ergoe-profile .ergoe-form-row {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .ergoe-shortcode.ergoe-profile .ergoe-profile-avatar-wrapper {
    width: 120px !important;
    height: 120px !important;
  }

  .ergoe-shortcode.ergoe-profile .ergoe-profile-avatar-section {
    margin-bottom: 24px !important;
    padding-bottom: 24px !important;
  }

  .ergoe-shortcode.ergoe-profile .ergoe-file-label {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .ergoe-shortcode.ergoe-profile .ergoe-file-label-name {
    width: 100% !important;
  }
}

/* Dark mode adjustments for profile */
@media (prefers-color-scheme: dark) {
  .ergoe-profile-avatar-wrapper {
    border-color: var(--ergoe-border-strong);
  }

  .ergoe-file-label {
    background: var(--ergoe-surface);
  }
}

/* Sekme Stilleri */
.ergoe-shortcode.ergoe-profile .ergoe-profile-tabs {
  display: flex !important;
  gap: 8px !important;
  margin-bottom: 24px !important;
  border-bottom: 2px solid var(--ergoe-border) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-tab-btn {
  appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  padding: 12px 20px !important;
  font-weight: 600 !important;
  font-size: 1em !important;
  color: var(--ergoe-muted) !important;
  cursor: pointer !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -2px !important;
  transition: all 0.2s ease !important;
  position: relative !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-tab-btn:hover {
  color: var(--ergoe-accent) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-tab-btn.active {
  color: var(--ergoe-accent) !important;
  border-bottom-color: var(--ergoe-accent) !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-tab-content {
  display: none !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-tab-content.active {
  display: block !important;
}

/* Mobile için sekme stilleri */
@media (max-width: 640px) {
  .ergoe-shortcode.ergoe-profile .ergoe-profile-tabs {
    flex-direction: column !important;
    gap: 0 !important;
  }
  
  .ergoe-shortcode.ergoe-profile .ergoe-tab-btn {
    border-bottom: 1px solid var(--ergoe-border) !important;
    border-left: 3px solid transparent !important;
    margin-bottom: 0 !important;
    padding: 12px 16px !important;
    text-align: left !important;
  }
  
  .ergoe-shortcode.ergoe-profile .ergoe-tab-btn.active {
    border-left-color: var(--ergoe-accent) !important;
    border-bottom-color: var(--ergoe-border) !important;
  }
}

/* Lisans Görseli Önizleme */
.ergoe-shortcode.ergoe-profile .ergoe-license-image-preview-wrapper {
  margin-bottom: 16px !important;
  border: 1px solid var(--ergoe-border) !important;
  border-radius: var(--ergoe-radius) !important;
  padding: 12px !important;
  background: var(--ergoe-surface) !important;
  text-align: center !important;
}

.ergoe-shortcode.ergoe-profile .ergoe-license-image-preview {
  max-width: 100% !important;
  max-height: 400px !important;
  height: auto !important;
  border-radius: 8px !important;
  object-fit: contain !important;
}


