/* ============================================
   anestoledo Academy — Design System
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- Variables --- */
:root {
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #5541d9;
  --secondary: #00CEC9;
  --secondary-light: #81ecec;
  --accent: #FD79A8;
  --bg-dark: #0F0F1A;
  --bg-surface: #1A1A2E;
  --bg-card: rgba(30, 30, 50, 0.7);
  --bg-glass: rgba(30, 30, 50, 0.5);
  --bg-input: rgba(255, 255, 255, 0.05);
  --text-primary: #E8E8F0;
  --text-secondary: #A0A0B8;
  --text-muted: #6C6C80;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #FF6B6B;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --sidebar-width: 300px;
  --header-height: 70px;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108,92,231,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,206,201,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(253,121,168,0.08) 0%, transparent 50%);
  z-index: 0; pointer-events: none;
}
a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--secondary); }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; } h4 { font-size: 1.25rem; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
.page-wrapper { position: relative; z-index: 1; min-height: 100vh; }

/* --- Header --- */
.header {
  height: var(--header-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; background: var(--bg-glass); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.header-logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.header-logo .logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.header-logo h2 {
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-nav { display: flex; align-items: center; gap: 1rem; }
.header-user { display: flex; align-items: center; gap: 0.75rem; color: var(--text-secondary); font-size: 0.9rem; }
.header-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; color: white;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
  border: none; transition: var(--transition); position: relative; overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; box-shadow: 0 4px 15px rgba(108,92,231,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(108,92,231,0.5); }
.btn-secondary {
  background: var(--bg-glass); color: var(--text-primary);
  border: 1px solid var(--border-light); backdrop-filter: blur(10px);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--primary-light); }
.btn-success { background: linear-gradient(135deg, var(--success), #00a884); color: white; box-shadow: 0 4px 15px rgba(0,184,148,0.4); }
.btn-success:hover { transform: translateY(-2px); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #ee5a5a); color: white; }
.btn-danger:hover { transform: translateY(-2px); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #f0b82e); color: #1a1a2e; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* --- Cards --- */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(20px); transition: var(--transition); overflow: hidden;
}
.card:hover { border-color: var(--border-light); transform: translateY(-4px); box-shadow: var(--shadow); }
.card-img { width: 100%; height: 180px; object-fit: cover; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.card-body { padding: 1.25rem; }
.card-title { font-size: 1.15rem; margin-bottom: 0.5rem; }
.card-text { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.card-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.card-clickable { cursor: pointer; }

/* --- Forms --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-control {
  width: 100%; padding: 0.75rem 1rem; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.95rem; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.2); background: rgba(255,255,255,0.08); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 100px; resize: vertical; }

/* --- Progress Bar --- */
.progress { height: 8px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.3rem; }

/* --- Tabs --- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; flex-shrink: 0; }
.tab {
  padding: 0.75rem 1.5rem; font-weight: 500; font-size: 0.95rem; color: var(--text-secondary);
  border: none; background: none; border-bottom: 2px solid transparent; transition: var(--transition); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.tab-content { display: none; padding-top: 0; margin-top: 0; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; padding-top: 0; margin-top: 0; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; padding: 2rem;
  transform: scale(0.9) translateY(20px); transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); color: var(--text-secondary); font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: rgba(255,107,107,0.2); color: var(--danger); }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* --- Sidebar --- */
.layout-sidebar { display: flex; min-height: calc(100vh - var(--header-height)); }
.sidebar {
  width: var(--sidebar-width); background: var(--bg-glass); backdrop-filter: blur(20px);
  border-right: 1px solid var(--border); padding: 1.5rem 0; overflow-y: auto;
  position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); flex-shrink: 0;
}
.sidebar-title { padding: 0 1.5rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.75rem; }
.sidebar-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.5rem;
  font-size: 0.95rem; color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.sidebar-item.active { background: rgba(108,92,231,0.1); color: var(--primary-light); border-left-color: var(--primary); }
.sidebar-item.locked { opacity: 0.4; cursor: not-allowed; }
.sidebar-item .icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-item .badge {
  margin-left: auto; font-size: 0.7rem; padding: 0.15rem 0.5rem;
  border-radius: 99px; background: rgba(0,184,148,0.2); color: var(--success);
}
.sidebar-item.locked .badge { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.sidebar-back { margin: 0 1rem 1rem; }

/* --- Main Content --- */
.main-content { flex: 1; padding: 2rem; min-width: 0; }

/* --- Course Grid --- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }

/* --- Section Content --- */
.section-content { max-width: 850px; }
.content-block { margin-bottom: 2rem; }
.embed-container { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-surface); }
.embed-container iframe { width: 100%; border: none; border-radius: var(--radius); }
.embed-container.video iframe { aspect-ratio: 16/9; }
.embed-container.document iframe { height: 600px; }
.embed-container.audio iframe { height: 160px; }
.content-text { color: var(--text-secondary); line-height: 1.8; font-size: 1rem; }
.content-text p { margin-bottom: 1rem; }

/* --- Test Section --- */
.test-section {
  margin-top: 2rem; padding: 1.5rem; background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.2); border-radius: var(--radius);
}
.test-section h4 { color: var(--primary-light); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.test-section iframe { width: 100%; min-height: 500px; border: none; border-radius: var(--radius-sm); background: white; }
.test-actions { margin-top: 1rem; display: flex; align-items: center; gap: 1rem; }

/* --- Badges --- */
.badge-role {
  display: inline-flex; padding: 0.2rem 0.7rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-admin { background: rgba(253,121,168,0.2); color: var(--accent); }
.badge-student { background: rgba(0,206,201,0.2); color: var(--secondary); }

/* --- Table --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--text-secondary); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* --- Alerts --- */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; border: 1px solid; }
.alert-error { background: rgba(255,107,107,0.1); border-color: rgba(255,107,107,0.3); color: var(--danger); }
.alert-success { background: rgba(0,184,148,0.1); border-color: rgba(0,184,148,0.3); color: var(--success); }
.alert-info { background: rgba(108,92,231,0.1); border-color: rgba(108,92,231,0.3); color: var(--primary-light); }

/* --- Login Page --- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; padding: 2rem;
}
.login-container {
  width: 100%; max-width: 440px;
}
.login-brand { text-align: center; margin-bottom: 2.5rem; }
.login-brand .logo-icon {
  width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
  box-shadow: 0 8px 32px rgba(108,92,231,0.3);
}
.login-brand h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-brand p { color: var(--text-secondary); margin-top: 0.5rem; }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  backdrop-filter: blur(20px); padding: 2rem; box-shadow: var(--shadow-lg);
}
.login-toggle {
  display: flex; margin-bottom: 1.5rem; background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px;
}
.login-toggle button {
  flex: 1; padding: 0.6rem; border: none; background: none; color: var(--text-secondary);
  border-radius: 6px; font-weight: 500; transition: var(--transition); font-size: 0.9rem;
}
.login-toggle button.active { background: var(--primary); color: white; }
.login-divider { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin: 1rem 0; }

/* --- Loading --- */
.loading-spinner {
  display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite;
}
.page-loader {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-dark);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.page-loader .spinner {
  width: 48px; height: 48px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* --- Empty State --- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1rem; margin-bottom: 1.5rem; }

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }

/* --- Content blocks editor --- */
.content-blocks-list { display: flex; flex-direction: column; gap: 0.75rem; }
.content-block-item {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.content-block-header { display: flex; justify-content: space-between; align-items: center; }
.content-block-item select { max-width: 200px; }

/* --- Admin list items --- */
.list-item {
  display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 0.5rem; transition: var(--transition);
}
.list-item:hover { border-color: var(--border-light); }
.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.95rem; }
.list-item-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.15rem; }
.list-item-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* --- Section order input --- */
.order-input { width: 60px; text-align: center; }

/* --- Dashboard stats --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; backdrop-filter: blur(20px);
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; font-family: var(--font-heading); }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.stat-card.purple .stat-value { color: var(--primary-light); }
.stat-card.teal .stat-value { color: var(--secondary); }
.stat-card.pink .stat-value { color: var(--accent); }
.stat-card.green .stat-value { color: var(--success); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
.fade-in { animation: fadeIn 0.4s ease; }

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  .header { padding: 0 1rem; }
  .header-logo h2 { display: none; }
  .sidebar { position: fixed; left: -100%; z-index: 99; width: 280px; transition: var(--transition); top: var(--header-height); }
  .sidebar.open { left: 0; }
  .sidebar-overlay { display: none; position: fixed; top: var(--header-height); left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 98; }
  .sidebar-overlay.open { display: block; }
  .main-content { padding: 1.25rem; }
  .course-grid { grid-template-columns: 1fr; }
  .modal { width: 95%; padding: 1.5rem; }
  .tabs { gap: 0; }
  .tab { padding: 0.6rem 1rem; font-size: 0.85rem; }
  .menu-toggle { display: flex !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 769px) {
  .menu-toggle { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- Toast notifications --- */
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.8rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.9rem;
  box-shadow: var(--shadow); animation: slideIn 0.3s ease; min-width: 250px;
  backdrop-filter: blur(20px); border: 1px solid var(--border);
}
.toast-success { background: rgba(0,184,148,0.9); color: white; }
.toast-error { background: rgba(255,107,107,0.9); color: white; }
.toast-info { background: rgba(108,92,231,0.9); color: white; }

/* --- Select custom --- */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A0A0B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
select.form-control option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Utilities */
.hidden { display: none !important; }
