/**
 * Radostna Leaderboard Stylesheet
 *
 * Styles the influencer leaderboard tables rendered by the
 * [radostna_top300] and [radostna_top100ugc] WordPress shortcodes.
 *
 * Naming convention (BEM-influenced):
 *   .radostna-leaderboard-*   — Base block styles, always present.
 *   .radostna-top300-*        — Leaderboard type identifier class (no extra rules by default).
 *   .radostna-top100ugc-*     — Leaderboard type identifier class (no extra rules by default).
 *
 * Every container always carries both the base `.radostna-leaderboard-*` class
 * and a type-specific class, so the base selectors are sufficient for all shared
 * styles. Type-specific selectors are reserved at the bottom of this file for
 * future per-leaderboard overrides.
 *
 * @package RadostnaCRM
 * @author  Katsarov Design
 * @version 1.3.0
 */

/* ============================================================================
   Custom properties (design tokens)
   ============================================================================ */

:root {
  --accent-color:    #d62828;
  --accent-dark:     #a01e1e;
  --accent-light:    rgba( 214, 40, 40, 0.15 );
  --dark-bg:         #0a0f1c;
  --light-bg:        #f1f5f9;
  --text-primary:    #0f172a;
  --text-secondary:  #475569;
  --card-shadow:     0 12px 24px -8px rgba( 0, 0, 0, 0.18 );
  --transition-speed: 0.4s;
  --border-radius:   0.5rem;
  --cell-border:     2px solid #e2e8f0;
}

/* ============================================================================
   Outer container
   ============================================================================ */

.radostna-leaderboard-container {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient( 145deg, #ffffff 0%, var( --light-bg ) 100% );
  padding: 3rem;
  margin: 2rem auto;
  max-width: 1800px;
  border-radius: var( --border-radius );
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #e2e8f0;
  border-left: 1rem solid var( --accent-color );
}

.radostna-leaderboard-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
}

/* ============================================================================
   Header
   ============================================================================ */

.radostna-leaderboard-header {
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.radostna-leaderboard-header h2 {
  margin: 0;
  color: var( --text-primary );
  letter-spacing: 0;
}

/* Visually-hidden caption for screen readers. */
.radostna-leaderboard-table caption.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect( 0, 0, 0, 0 );
  white-space: nowrap;
  border: 0;
}

/* ============================================================================
   Table — base
   ============================================================================ */

.radostna-leaderboard-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var( --border-radius );
  overflow: hidden;
  margin-top: 2rem;
  font-size: 1rem;
  position: relative;
  box-shadow: var( --card-shadow );
  border: 2px solid #e2e8f0;
}

/* ============================================================================
   Table — head
   ============================================================================ */

.radostna-leaderboard-table thead {
  background: linear-gradient( 90deg, var( --accent-color ) 0%, var( --accent-dark ) 100% );
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.radostna-leaderboard-table th {
  padding: 1.5rem 2rem;
  text-align: left;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 0.85rem;
  position: relative;
  border-right: 2px solid rgba( 255, 255, 255, 0.1 );
}

.radostna-leaderboard-table th:last-child {
  border-right: none;
}

/* ============================================================================
   Table — body rows
   ============================================================================ */

.radostna-leaderboard-table tbody tr {
  transition: all var( --transition-speed ) ease;
  border-bottom: var( --cell-border );
  animation: fadeIn 0.6s cubic-bezier( 0.23, 1, 0.32, 1 ) forwards;
  opacity: 0;
}

.radostna-leaderboard-table td {
  padding: 1.5rem 2rem;
  background: #fff;
  vertical-align: middle;
  position: relative;
  border-right: var( --cell-border );
  font-weight: 500;
}

.radostna-leaderboard-table td:last-child {
  border-right: none;
}

.radostna-leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

/* Hover lift effect — excluded for non-data rows. */
.radostna-leaderboard-table tbody tr:not( .loading-row ):not( .error-row ):not( .empty-row ):hover {
  transform: translateY( -4px );
  box-shadow: 0 12px 20px -8px rgba( 214, 40, 40, 0.2 );
}

.radostna-leaderboard-table tbody tr:not( .loading-row ):not( .error-row ):not( .empty-row ):hover td {
  background: var( --accent-light );
}

/* ============================================================================
   Table — column widths
   ============================================================================ */

.radostna-leaderboard-table th:nth-child( 1 ),
.radostna-leaderboard-table td:nth-child( 1 ) {
  width: 6%;
  text-align: left;
  font-weight: 600;
}

.radostna-leaderboard-table th:nth-child( 2 ),
.radostna-leaderboard-table td:nth-child( 2 ) {
  width: 28%;
  text-align: left;
  font-weight: 600;
}

.radostna-leaderboard-table th:nth-child( 3 ),
.radostna-leaderboard-table td:nth-child( 3 ) {
  min-width: 200px;
  width: 22%;
  text-align: left;
}

.radostna-leaderboard-table th:nth-child( 4 ),
.radostna-leaderboard-table td:nth-child( 4 ) {
  width: 16%;
  text-align: left;
  font-weight: 600;
}

.radostna-leaderboard-table th:nth-child( 5 ),
.radostna-leaderboard-table td:nth-child( 5 ) {
  width: 16%;
  text-align: left;
  font-weight: 600;
}

.radostna-leaderboard-table th:nth-child( 6 ),
.radostna-leaderboard-table td:nth-child( 6 ) {
  width: 22%;
  text-align: left;
  font-weight: 700;
}

.radostna-leaderboard-table td:nth-child( 6 ) {
  color: var( --accent-dark );
  text-align: center;
}

/* Error cell (legacy inline use — kept for backward compatibility). */
.radostna-leaderboard-table td.error {
  text-align: center;
  color: var( --accent-color );
  font-weight: 700;
  padding: 2.5rem;
  background: rgba( 214, 40, 40, 0.08 );
  font-size: 1.1rem;
}

/* ============================================================================
   Cell components — name, social, data
   ============================================================================ */

.name-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.social-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  color: var( --text-primary );
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  border-radius: 50%;
  background: var( --accent-light );
  color: var( --accent-dark );
  font-size: 0.72rem;
  font-weight: 800;
}

.social-handle {
  color: var( --text-primary );
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.social-handle:hover,
.social-handle:focus {
  color: var( --accent-dark );
  text-decoration: underline;
}

.data-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.5rem 1rem;
  background: rgba( 15, 23, 42, 0.05 );
  border-radius: 0.25rem;
  font-weight: 600;
}

/* ============================================================================
   Status rows — loading / empty / error
   ============================================================================ */

.status-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5rem;
  padding: 1rem;
  text-align: center;
}

.status-message {
  color: var( --text-secondary );
  font-weight: 700;
}

.error-row .status-message {
  color: var( --accent-dark );
}

/* Loading animation — three bouncing circles. */
.loading-animation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 20px;
}

.loading-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var( --accent-color );
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-circle:nth-child( 1 ) { animation-delay: -0.32s; }
.loading-circle:nth-child( 2 ) { animation-delay: -0.16s; }
.loading-circle:nth-child( 3 ) { animation-delay: 0;      }

/* ============================================================================
   Rating bar
   ============================================================================ */

.rating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}

.rating-bar-wrapper {
  width: 100%;
  height: 10px;
  background-color: #e6e6e6;
  border-radius: 5px;
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  background: linear-gradient( 90deg, #f0904c, #ee5d43 );
  transition: width 0.4s ease;
  border-radius: 5px;
}

/* ============================================================================
   Decorative elements (kept for theme compatibility)
   ============================================================================ */

.tech-accent-line {
  height: 3px;
  background: linear-gradient( 90deg, var( --accent-color ) 0%, transparent 100% );
  margin: 1.5rem 0;
  position: relative;
}

.tech-accent-line::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient( 90deg, transparent 0%, var( --accent-color ) 100% );
  opacity: 0.5;
}

.data-highlight {
  position: relative;
  padding: 0.5rem 1rem;
  background: rgba( 15, 23, 42, 0.05 );
  border-radius: 0.25rem;
  font-weight: 600;
}

.data-highlight::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var( --accent-color );
}

.rank-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var( --accent-color );
  color: white;
  border-radius: 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  margin-left: 1rem;
  vertical-align: middle;
}

/* Utility modifiers. */
.sharp-corner    { border-radius: 0 !important; }
.cell-border-right  { border-right: 2px solid #e2e8f0 !important; }
.cell-border-bottom { border-bottom: 2px solid #e2e8f0 !important; }

/* ============================================================================
   Keyframe animations
   ============================================================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY( 20px );
  }
  to {
    opacity: 1;
    transform: translateY( 0 );
  }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale( 0 ); }
  40%           { transform: scale( 1 ); }
}

/* ============================================================================
   Responsive breakpoints
   ============================================================================ */

@media ( max-width: 1400px ) {
  .radostna-leaderboard-container {
    padding: 2rem;
    margin: 1.5rem;
  }

  .radostna-leaderboard-table th,
  .radostna-leaderboard-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
  }
}

@media ( max-width: 1024px ) {
  .radostna-leaderboard-container {
    padding: 1.5rem;
    margin: 1rem;
  }

  .radostna-leaderboard-table th,
  .radostna-leaderboard-table td {
    padding: 1rem;
    font-size: 0.9rem;
  }
}

/* ============================================================================
   Leaderboard type-specific overrides
   (reserved — add per-leaderboard rules here as needed)
   ============================================================================ */

/* .radostna-top300-container  { } */
/* .radostna-top100ugc-container { } */
/* .radostna-top300-table      { } */
/* .radostna-top100ugc-table   { } */
