/* ============================================================
   EduConnect - Social Media Education Platform - Global CSS
   ============================================================ */

:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --secondary: #764ba2;
  --accent: #f093fb;
  --success: #48bb78;
  --danger: #f56565;
  --warning: #ed8936;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2d3748;
  --muted: #718096;
  --border: #e2e8f0;
  --sidebar-width: 260px;
  --navbar-height: 60px;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  margin: 0;
  padding-top: var(--navbar-height);
}

/* ── Navbar ─────────────────────────────────────────────────── */
.edu-navbar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  height: var(--navbar-height);
  box-shadow: 0 2px 20px rgba(102,126,234,.4);
  z-index: 1050;
}
.edu-navbar .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .edu-navbar .container-fluid {
    position: relative;
    justify-content: space-between;
  }
  .edu-navbar .navbar-toggler {
    order: 1;
  }
  .edu-navbar .navbar-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Hide brand on mobile */
@media (max-width: 768px) {
  .edu-navbar .navbar-brand { display: none; }
}
@media (min-width: 769px) {
  .edu-navbar .navbar-brand { display: block; }
}

.edu-navbar .nav-link { transition: opacity .2s; }
@media (max-width: 768px) {
  .edu-navbar .d-flex.align-items-center.gap-3 {
    display: none;
  }
}

/* ── Layout ──────────────────────────────────────────────────── */
.main-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 260px;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}
@media (max-width: 1200px) { .main-layout { grid-template-columns: var(--sidebar-width) 1fr; } .right-sidebar { display: none; } }
@media (max-width: 768px) { .main-layout { grid-template-columns: 1fr; } .left-sidebar { display: none; } }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--navbar-height) + 16px);
  height: calc(100vh - var(--navbar-height) - 32px);
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
  transition: all .2s;
  text-decoration: none;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}
.sidebar-nav .nav-link .icon { width: 24px; text-align: center; }

/* ── Profile Card in Sidebar ─────────────────────────────────── */
.sidebar-profile { text-align: center; }
.sidebar-profile img { width: 72px; height: 72px; object-fit: cover; border: 3px solid var(--primary); }
.sidebar-profile .name { font-weight: 700; margin-top: 8px; font-size: .95rem; }
.sidebar-profile .role-badge { font-size:.75rem; padding:2px 10px; border-radius:20px; }

/* ── Cards ───────────────────────────────────────────────────── */
.edu-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border: none;
  margin-bottom: 16px;
  overflow: hidden;
}
.edu-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transition: box-shadow .2s; }

/* ── Post / Wall ─────────────────────────────────────────────── */
.post-composer {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.post-composer textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: none;
  width: 100%;
  padding: 12px;
  font-size: .95rem;
  background: #f7f8fc;
  transition: border .2s;
}
.post-composer textarea:focus { outline: none; border-color: var(--primary); background: #fff; }

.post-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin-bottom: 16px;
  overflow: hidden;
}
.post-header { padding: 14px 16px 8px; display: flex; align-items: center; gap: 10px; }
.post-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.post-meta .username { font-weight: 700; font-size: .95rem; }
.post-meta .time { color: var(--muted); font-size: .8rem; }
.post-body { padding: 0 16px 12px; font-size: .95rem; line-height: 1.6; }
.post-media img, .post-media video { width: 100%; max-height: 400px; object-fit: cover; border-radius: 8px; margin-top: 8px; }
.post-actions { border-top: 1px solid var(--border); padding: 8px 16px; display: flex; gap: 4px; }
.post-action-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: 8px;
  font-size: .88rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.post-action-btn:hover { background: #f0f2f5; color: var(--primary); }
.post-action-btn.liked { color: var(--danger); }

.comments-section { background: #f7f8fc; padding: 12px 16px; border-top: 1px solid var(--border); }
.comment-item { display: flex; gap: 10px; margin-bottom: 10px; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-bubble { background: #fff; border-radius: 12px; padding: 8px 12px; flex: 1; font-size: .88rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary-grad {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  transition: opacity .2s, transform .1s;
}
.btn-primary-grad:hover { opacity:.9; color:#fff; transform: translateY(-1px); }

/* ── Login Page ──────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  min-height: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) { .auth-card { grid-template-columns: 1fr; } .auth-banner { display: none; } }
.auth-banner {
  background: linear-gradient(135deg, #5a67d8, #764ba2);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
}
.auth-banner h2 { font-size: 2rem; font-weight: 800; }
.auth-form-section { padding: 40px; }
.auth-form-section .form-control {
  border-radius: 8px;
  border: 1.5px solid var(--border);
  padding: 12px 14px;
  transition: border .2s;
}
.auth-form-section .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,.15); }

/* ── Badges & Tags ───────────────────────────────────────────── */
.badge-teacher { background: linear-gradient(135deg,#667eea,#764ba2); }
.badge-student { background: linear-gradient(135deg,#48bb78,#38a169); }
.badge-admin { background: linear-gradient(135deg,#f56565,#c53030); }
.badge-free { background: #48bb78; }
.badge-paid { background: #ed8936; }
.badge-demo { background: #4299e1; }

/* ── Chat / Messages ─────────────────────────────────────────── */
.chat-wrapper { display: flex; height: calc(100vh - var(--navbar-height) - 32px); gap: 0; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.chat-list { width: 300px; border-right: 1px solid var(--border); overflow-y: auto; }
.chat-item { display: flex; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .2s; }
.chat-item:hover, .chat-item.active { background: #f0f2f5; }
.chat-item img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.chat-window { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; }
.chat-bubble { max-width: 70%; margin-bottom: 12px; }
.chat-bubble.sent { margin-left: auto; }
.chat-bubble .bubble-text {
  padding: 10px 14px; border-radius: 18px; font-size: .9rem;
  background: #f0f2f5;
}
.chat-bubble.sent .bubble-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}
.chat-input { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 10px; }
.chat-input input { flex: 1; border-radius: 24px; border: 1.5px solid var(--border); padding: 10px 16px; }

/* ── Admin Table ─────────────────────────────────────────────── */
.admin-table th { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.admin-table tbody tr:hover { background: #f0f2f5; }

/* ── Quiz ────────────────────────────────────────────────────── */
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all .2s; }
.quiz-option:hover { border-color: var(--primary); background: #f0f2ff; }
.quiz-option input[type=radio]:checked + span { color: var(--primary); font-weight: 600; }

/* ── Group Cards ─────────────────────────────────────────────── */
.group-card { border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s; }
.group-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.group-card-cover { height: 120px; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.group-card-body { background: #fff; padding: 16px; }

/* ── Gallery ─────────────────────────────────────────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery-item { aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative; cursor: pointer; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.05); }

/* ── Stats Widgets ───────────────────────────────────────────── */
.stat-card { border-radius: 12px; padding: 20px; color: #fff; position: relative; overflow: hidden; }
.stat-card .stat-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); opacity: .25; font-size: 3rem; }
.stat-card h3 { font-size: 2rem; font-weight: 800; margin: 0; }
.stat-card p { margin: 0; font-size: .85rem; opacity: .85; }

/* ── Misc ────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-md { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.text-gradient { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.online-dot { display: inline-block; width: 10px; height: 10px; background: #48bb78; border-radius: 50%; border: 2px solid #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Utility */
.cursor-pointer { cursor: pointer; }
.transition { transition: all .2s; }

/* ── Mobile Navbar ────────────────────────────────────────────── */
.mobile-navbar {
  background: var(--card-bg);
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.mobile-navbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.mobile-navbar a .fa {
  font-size: 1.2rem;
}
.mobile-navbar a .small {
  font-size: .75rem;
  margin-top: 2px;
}
.mobile-navbar a .badge {
  position: absolute;
  top: 4px;
  right: 12px;
  font-size: .6rem;
  padding: .2em .4em;
}
