/* ============================================================
   Young Innovators - Shared Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Inter:wght@400;500;600&family=Fredoka+One&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #6C63FF;
  --primary-light: #8B83FF;
  --primary-dark: #5A52E0;
  --secondary: #FF6B6B;
  --secondary-light: #FF8E8E;
  --tertiary: #4ECDC4;
  --tertiary-light: #7EDDD6;
  --bg: #F8F9FE;
  --bg-dark: #EDEEF6;
  --card-bg: #FFFFFF;
  --dark-text: #2D3436;
  --light-text: #636E72;
  --muted-text: #B2BEC3;
  --gold: #FDCB6E;
  --gold-dark: #E4B84A;
  --admin-blue: #0984E3;
  --success: #00B894;
  --warning: #E17055;
  --danger: #D63031;
  --border: #E8E8F0;
  --shadow-sm: 0 2px 8px rgba(108, 99, 255, 0.08);
  --shadow-md: 0 4px 16px rgba(108, 99, 255, 0.12);
  --shadow-lg: 0 8px 32px rgba(108, 99, 255, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-heading: 'Nunito', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-game: 'Fredoka One', cursive;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--dark-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--dark-text);
  line-height: 1.3;
}

/* ---- Navbar ---- */
.yi-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--accent, var(--primary));
  box-shadow: var(--shadow-sm);
}

.yi-navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.yi-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--dark-text);
}

.yi-navbar-brand:hover {
  color: var(--primary);
}

.yi-navbar-logo {
  height: 36px;
  width: auto;
}

.yi-navbar-title {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.yi-navbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yi-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--light-text);
  transition: var(--transition);
}

.yi-nav-link:hover {
  background: var(--bg);
  color: var(--primary);
}

.yi-nav-link.active {
  background: var(--primary);
  color: white;
}

.yi-nav-icon {
  font-size: 1.1rem;
}

.yi-nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.yi-nav-role-badge {
  background: var(--accent, var(--primary));
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
}

.yi-nav-username {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--dark-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yi-nav-logout {
  background: var(--danger);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.yi-nav-logout:hover {
  background: #C0392B;
  transform: scale(1.05);
}

/* Mobile toggle */
.yi-navbar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.yi-navbar-toggle span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--dark-text);
  border-radius: 2px;
  transition: var(--transition);
}

.yi-navbar-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.yi-navbar-toggle.open span:nth-child(2) {
  opacity: 0;
}
.yi-navbar-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .yi-navbar-toggle {
    display: flex;
  }
  .yi-navbar-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 16px;
    box-shadow: var(--shadow-md);
    border-bottom: 3px solid var(--accent, var(--primary));
  }
  .yi-navbar-links.open {
    display: flex;
  }
  .yi-nav-user {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 2px solid var(--border);
    width: 100%;
    justify-content: center;
  }
}

/* ---- Page Layout ---- */
.yi-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.yi-page-header {
  margin-bottom: 30px;
}

.yi-page-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.yi-page-header p {
  color: var(--light-text);
  font-size: 1rem;
}

/* ---- Cards ---- */
.yi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

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

.yi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

/* ---- Grid ---- */
.yi-grid {
  display: grid;
  gap: 20px;
}

.yi-grid-2 { grid-template-columns: repeat(2, 1fr); }
.yi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.yi-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .yi-grid-2, .yi-grid-3, .yi-grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .yi-grid-3, .yi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Buttons ---- */
.yi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.yi-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.yi-btn-primary {
  background: var(--primary);
  color: white;
}

.yi-btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.yi-btn-secondary {
  background: var(--secondary);
  color: white;
}

.yi-btn-secondary:hover {
  background: #E85555;
  color: white;
}

.yi-btn-tertiary {
  background: var(--tertiary);
  color: white;
}

.yi-btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.yi-btn-outline:hover {
  background: var(--primary);
  color: white;
}

.yi-btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.yi-btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.yi-btn-block {
  width: 100%;
}

.yi-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---- Forms ---- */
.yi-form-group {
  margin-bottom: 20px;
}

.yi-form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--dark-text);
}

.yi-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
  background: white;
  color: var(--dark-text);
}

.yi-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.yi-input::placeholder {
  color: var(--muted-text);
}

.yi-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: white;
  color: var(--dark-text);
  cursor: pointer;
  transition: var(--transition);
}

.yi-select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.yi-input {
  resize: vertical;
  min-height: 100px;
}

/* ---- Auth Card ---- */
.yi-auth-container {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.yi-auth-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.yi-auth-card h1 {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 8px;
}

.yi-auth-card .yi-subtitle {
  text-align: center;
  color: var(--light-text);
  margin-bottom: 30px;
}

.yi-auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--light-text);
}

/* ---- Stats ---- */
.yi-stat {
  text-align: center;
  padding: 20px;
}

.yi-stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.yi-stat-label {
  font-size: 0.85rem;
  color: var(--light-text);
  margin-top: 4px;
}

/* ---- Progress Bar ---- */
.yi-progress {
  background: var(--bg-dark);
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
}

.yi-progress-bar {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--primary), var(--tertiary));
  transition: width 0.8s ease;
}

/* ---- Badge ---- */
.yi-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg);
  border: 2px solid var(--gold);
}

.yi-badge-icon {
  font-size: 1.2rem;
}

/* ---- Table ---- */
.yi-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.yi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.yi-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--light-text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.yi-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.yi-table tr:hover td {
  background: var(--bg);
}

/* ---- Status Badges ---- */
.yi-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
}

.yi-status-pending { background: #FFF3CD; color: #856404; }
.yi-status-approved { background: #D4EDDA; color: #155724; }
.yi-status-rejected { background: #F8D7DA; color: #721C24; }
.yi-status-published { background: #D1ECF1; color: #0C5460; }
.yi-status-draft { background: #E2E3E5; color: #383D41; }

/* ---- Toast ---- */
.yi-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.yi-toast.show {
  transform: translateX(-50%) translateY(0);
}

.yi-toast-info { background: var(--primary); color: white; }
.yi-toast-success { background: var(--success); color: white; }
.yi-toast-error { background: var(--danger); color: white; }
.yi-toast-warning { background: var(--warning); color: white; }

/* ---- Loader ---- */
.yi-loader {
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 254, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.yi-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- Empty State ---- */
.yi-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--light-text);
}

.yi-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.yi-empty h3 {
  color: var(--light-text);
  margin-bottom: 8px;
}

/* ---- Tabs ---- */
.yi-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.yi-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--light-text);
}

.yi-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.yi-tab:hover:not(.active) {
  color: var(--dark-text);
}

/* ---- Modal ---- */
.yi-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.yi-modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.yi-modal h2 {
  margin-bottom: 20px;
}

/* ---- Chip / Tag ---- */
.yi-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
}

.yi-chip-selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.yi-animate-fade { animation: fadeIn 0.5s ease forwards; }
.yi-animate-slide { animation: slideUp 0.6s ease forwards; }
.yi-animate-pulse { animation: pulse 2s ease infinite; }
.yi-animate-float { animation: float 3s ease infinite; }

/* Staggered animation delays */
.yi-delay-1 { animation-delay: 0.1s; opacity: 0; }
.yi-delay-2 { animation-delay: 0.2s; opacity: 0; }
.yi-delay-3 { animation-delay: 0.3s; opacity: 0; }
.yi-delay-4 { animation-delay: 0.4s; opacity: 0; }
.yi-delay-5 { animation-delay: 0.5s; opacity: 0; }