/* === Global mobile responsiveness overrides === */

/* Media should never overflow */
img, video, canvas, iframe { 
  max-width: 100%; 
  height: auto; 
}

/* Prevent layout breaks from long words/URLs */
* { 
  word-wrap: break-word; 
}
pre, code { 
  white-space: pre-wrap; 
}

/* Tables: enable horizontal scroll on small screens */
.table-wrap, .table-responsive { 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch; 
}
.table-wrap table { 
  min-width: 600px; 
}

/* Small devices (phones) */
@media (max-width: 576px) {
  /* Stack grid columns */
  .row > [class*="col"] { 
    flex: 0 0 100% !important; 
    max-width: 100% !important; 
  }

  /* Reduce container side padding */
  .container, .container-fluid { 
    padding-left: 12px; 
    padding-right: 12px; 
  }

  /* Hide sidebars on phones (rename/selectors to match yours if needed) */
  .sidebar, .side-bar, .left-sidebar, .right-sidebar { 
    display: none !important; 
  }

  /* Hero/banner image scaling */
  .banner-hero img { 
    width: 100% !important; 
    height: auto !important; 
  }

  /* Common cards become full width */
  .creator-card, .course-card, .post-card, .video-card, .playlist-card, .profile-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Navbar: items fill width and wrap vertically if needed */
  .navbar .navbar-nav { 
    flex-direction: column !important; 
    align-items: stretch !important; 
  }
  .navbar .nav-item { 
    width: 100% !important; 
  }

  /* Forms */
  input, select, textarea, button { 
    max-width: 100% !important; 
  }
}

/* Medium devices (tablets) — relax fixed widths */
@media (max-width: 768px) {
  .creator-card, .course-card, .post-card, .video-card, .playlist-card, .profile-card {
    max-width: 100% !important;
  }
}

/* Inline, responsive navbar without hamburger */
.nav-inline .container-fluid { display: flex; }
.nav-inline .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-inline .nav-link { white-space: nowrap; border-radius: .5rem; }
.nav-inline .nav-link:hover { background: rgba(0,0,0,.04); }
.nav-inline .auth-area { flex-shrink: 0; }

@media (max-width: 576px) {
  .nav-inline .container-fluid { gap: .5rem; }
  .nav-inline .nav-links { gap: .25rem !important; }
}


/* ===== Profile page polish ===== */
.subnav { border-bottom: 1px solid #eee; z-index: 1010; }
.custom-scroll-tabs {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  gap: .25rem;
  white-space: nowrap;
}
.custom-scroll-tabs .nav-link {
  border-radius: 9999px;
  padding: .5rem 1rem;
}
.custom-scroll-tabs .nav-link.active {
  /* color: #0d6efd !important; */
}

.card-bleed .card-body { padding: 1.25rem 1.25rem; }
.profile-avatar { max-width: 180px; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.info-line .label { color: #6c757d; font-weight: 600; margin-left: .25rem; }

@media (max-width: 576px) {
  .card-bleed .card-body { padding: 1rem; width: 100%;}
  .profile-avatar { max-width: 140px; }
}

.card-body{
  width: 100%;
}

.dropdown{
  z-index: 999999;
}

/* ===== Post view polish ===== */
.post-shell { max-width: 980px; }                  /* center content on large screens */
.object-cover { object-fit: cover; }               /* for fallback img in ratio */
.media-grid { display: grid; gap: 1rem; }          /* handles multiple files */
.media-item { width: 100%; }

.post-shell video,
.post-shell img,
.post-shell iframe {
  max-width: 100%;
  height: auto;
  border-radius: .75rem;
  display: block;
}

/* If MediaViewer outputs <video> without ratio, limit its height */
.post-shell video { max-height: 70vh; }

/* When there are multiple files, use 2 cols on md+ */
@media (min-width: 768px) {
  .media-grid { grid-template-columns: 1fr 1fr; }
  .playlistSection{
    height: 100%;
  }
}

/* ===== Post view (centered, consistent) ===== */
.post-card {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.5rem;
  border: 1px solid rgba(0,0,0,.06);
}

.post-header { text-align: center; margin-bottom: .5rem; }
.post-title  { font-weight: 800; font-size: clamp(1rem, 2vw, 1rem); margin-bottom: 20px; }
.post-meta   { color: #6c757d; font-size: .9rem; }

.post-media {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  margin: 1rem;
}

/* Wrapper that centers any media (video/img/iframe) */
.media-box {
  width: 100%;
  max-width: min(720px, 100%);
  margin: 0 auto;
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  padding: .5rem;
}

/* Ensure any direct media inside scales nicely */
.media-box video,
.media-box img,
.media-box iframe {
  width: 100% !important;
  height: auto !important;
  display: block;
  border-radius: .5rem;
  object-fit: cover;
}

/* If MediaViewer outputs a fixed width/height on <video>, override hard values */
.media-box video[width], .media-box video[height] {
  width: 100% !important;
  height: auto !important;
}

/* Body text */
.post-body { margin-top: .75rem; }
.post-text { white-space: pre-wrap; line-height: 1.85; font-size: 1rem; }

/* Tags */
.post-tags { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }

/* Actions row centered */
.post-actions {
  margin-top: 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center;
}

/* Pills */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid rgba(0,0,0,.1);
  background: #fff; border-radius: 999px;
  padding: .4rem .8rem; box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.chip.disabled { pointer-events: none; opacity: .7; }

/* Comment area spacing */
.post-comments { margin-top: 1rem; }

/* Keep anchors visible under sticky header(s) */
html { scroll-padding-top: 80px; }

@media (max-width: 576px) {
  .post-card { padding: 1rem; }
  .media-box { padding: .375rem; }
}


/* Grid used for both tabs */
.posts-grid { display: grid; gap: 1rem; }
@media (min-width: 576px) { .posts-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px){ .posts-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* Visual consistency for playlist cards */
.playlist-card .card-body { padding: .75rem .9rem 1rem; }
.object-cover { object-fit: cover; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ====== Purchased Items – Fantastic Theme (RTL-friendly) ====== */
.purchased-shell { max-width: 1100px; }

.top-stats {
  display:flex; gap:.75rem; flex-wrap:wrap; margin-bottom:1rem;
}
.chip-stat{
  display:inline-flex; align-items:center; gap:.5rem;
  background:linear-gradient(135deg,#e9f0ff,#f5f9ff);
  color:#0d6efd; border:1px solid rgba(13,110,253,.15);
  padding:.5rem .9rem; border-radius:999px; font-weight:600;
}

.seg-tabs{
  position:relative; display:grid; grid-template-columns:1fr 1fr;
  background:#f7f8fb; border:1px solid rgba(0,0,0,.06);
  border-radius:999px; padding:.25rem; margin-bottom:1rem;
}
.seg{
  border:0; background:transparent; padding:.5rem 1rem; border-radius:999px;
  font-weight:700; color:#6c757d; transition:color .2s ease;
}
.seg.active{ color:#0d6efd; }
.seg-indicator{
  position:absolute; inset-block:4px auto; height:calc(100% - 8px); width:50%;
  background:#fff; border-radius:999px; box-shadow:0 4px 18px rgba(0,0,0,.08);
  transition:inset-inline-start .25s ease;
}

.tab-area{ margin-top:.5rem; }

/* Modern grid */
.fancy-grid{
  display:grid; gap:1rem;
  grid-template-columns:1fr;
}
@media (min-width:576px){ .fancy-grid{ grid-template-columns:1fr 1fr; } }
@media (min-width:1200px){ .fancy-grid{ grid-template-columns:1fr 1fr 1fr; } }

/* Card style */
.fancy-card{
  border:1px solid rgba(0,0,0,.06);
  border-radius:1rem; background:#fff;
  overflow:hidden; display:flex; flex-direction:column; justify-content:space-between;
}
.fancy-card .card-footer{ border-top:1px dashed rgba(0,0,0,.06); padding:.6rem .8rem; }
.post-title-link{ font-weight:800; color:inherit; text-decoration:none; }
.post-title-link:hover{ color:#0d6efd; }

/* Hover lift + soft shadow */
.hover-lift{ transition: transform .15s ease, box-shadow .15s ease; }
.hover-lift:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

/* “Glassy” empty state */
.glassy{
  border:1px solid rgba(0,0,0,.06);
  border-radius:1rem; background:linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.75));
  box-shadow:0 8px 30px rgba(0,0,0,.06);
}

/* Make embedded PlayListItem blend in (no duplicate borders/padding) */
.fancy-card .card-body :where(.list-group, .list-group-item){
  border:0 !important; padding:0 !important; margin:0 !important; background:transparent !important;
}

/* Small-screen niceties */
@media (max-width:576px){
  .chip-stat{ width:100%; justify-content:center; }
}

.active-tab {
  color: #6c757d;
}

/* ===== Playlist card compact shell ===== */
.playlist-card-compact {
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
  position: relative;
}

/* soft accent on top edge */
.playlist-card-compact::before{
  content:"";
  position:absolute; inset-inline:0; inset-block-start:0;
  height: 3px; border-radius: 1rem 1rem 0 0;
  background: linear-gradient(90deg,#0d6efd 0%, #6f42c1 50%, #20c997 100%);
  opacity:.25;
}

.playlist-card-compact .card-body{ padding: .9rem .95rem; }
.pc-row{ display:flex; gap:.75rem; align-items:flex-start; }
.pc-icon{
  flex: 0 0 40px; height:40px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg,#eef4ff,#f7faff);
  color:#0d6efd; font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px rgba(13,110,253,.15);
}
.pc-main{ flex:1 1 auto; min-width:0; }
.pc-slot{ min-width:0; }

/* Remove borders/padding the inner component might add */
.playlist-card-compact .pc-slot :where(.list-group, .list-group-item){
  border:0 !important; padding:0 !important; margin:0 !important; background:transparent !important;
}

/* Hide the inner CTA/button inside PlayListItem to avoid duplicates */
.playlist-card-compact .pc-slot :where(a.btn, button.btn){
  display:none !important;
}

/* Tidy typical title/subtitle that PlayListItem outputs */
.playlist-card-compact .pc-slot h6,
.playlist-card-compact .pc-slot h5,
.playlist-card-compact .pc-slot .title{
  margin:0 0 .25rem 0; font-weight:800;
  font-size: clamp(.95rem, 2vw, 1.05rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.playlist-card-compact .pc-slot .text-muted,
.playlist-card-compact .pc-slot .subtitle{
  color:#6c757d !important; margin:0; line-height:1.5;
}

/* Footer polish */
.playlist-card-compact .card-footer{
  border-top: 1px dashed rgba(0,0,0,.08);
  padding: .6rem .8rem;
}

/* One CTA look */
.playlist-card-compact .btn.btn-primary{
  background: linear-gradient(135deg,#0d6efd,#6f42c1);
  border: none;
}
.playlist-card-compact .btn.btn-primary:hover{
  filter: brightness(1.05);
}

/* Hover motion */
.hover-lift{ transition: transform .15s ease, box-shadow .15s ease; }
.hover-lift:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}

/* compact on phones */
@media (max-width:576px){
  .playlist-card-compact .card-body{ padding:.75rem; }
  .pc-icon{ flex-basis:36px; height:36px; font-size:1rem; }
}

.z-3 {
  z-index: 999999;
}

/* Make modal fit screen width on mobile */
@media (max-width: 576px) {
    .modal-mobile {
        margin: 0 10px; /* small margin left/right */
        width: 100%;
        max-width: 100%;
    }

    .modal-body {
        padding: 1.5rem !important;
    }

    .btn {
        font-size: 0.9rem;
    }
}

.custom-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    border: none;
    font-size: 1.25rem;
    opacity: 0.7;
    z-index: 9999999;
    color: black;
}
.custom-close:hover {
    opacity: 1;
}
