/* ===============================
   Viewport & Layout Foundation
   =============================== */

   html, body {
    height: 100%;
  }
  
  body {
    display: flex;
    flex-direction: column;
    margin: 0;
    font-family: Inter, system-ui, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
  }
  
  header {
    flex-shrink: 0;
    padding-left: 15px;
    padding-top: 2px;
  }
  
  footer.site-footer {
    flex-shrink: 0;
  }
  
  .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Critical: contains layout within viewport */
    padding: 16px;
    padding-bottom: 40px;
    margin-top: 10px;
  }
  
  .geminar-layout {
    flex: 1;
    display: flex;
    gap: 16px;
    min-height: 0; /* Allows child flex containers (like chat) to scroll properly */
  }
  
  /* ===============================
     Geminars – Global Theme
     =============================== */
  
  :root {
    --bg: #0f172a;
    --panel: #020617;
    --card: #111827;
    --border: #1e293b;
  
    --accent: #38bdf8;
    --accent-soft: #0ea5e9;
  
    --text: #e5e7eb;
    --muted: #94a3b8;
  
    --chat-me: #2563eb;
    --chat-other: #374151;
    --chat-system: #7c2d12;
  }
  
  * {
    box-sizing: border-box;
  }
  
  html {
    scrollbar-gutter: stable;
    overflow-x: hidden;
  }
  
  a {
    color: var(--accent);
    text-decoration: none;
  }
  
  h1, h2, h3, h4 {
    margin: 0;
    font-weight: 500;
  }
  
  /* ===============================
     Layout
     =============================== */
  
  /* Removed old .container rules — now handled above */
  
  /* ===============================
     Video Column
     =============================== */
  
  .video-column {
    flex: 3;
    display: flex;
    flex-direction: column;
  }
  
  .video-title {
    font-size: 20px;
    margin-bottom: 8px;
  }
  
  .video-wrapper {
    background: black;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 63vh;
  }
  
  .video-actions {
    display: flex;
    gap: 16px;
    margin: 8px 0;
    font-size: 14px;
    color: var(--muted);
  }
  
  .video-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
  }
  
  /* ===============================
     Chat Column (Desktop)
     =============================== */
  
  .chat-column {
    flex: 1;
    background: var(--card);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .chat-header {
    padding: 10px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
  }
  
  .chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #020617;
  }
  
  .chat-message {
    max-width: 80%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    z-index: 1200;
  }
  
  .chat-me {
    background: var(--chat-me);
    margin-left: auto;
  }
  
  .chat-other {
    background: var(--chat-other);
  }
  
  .chat-system {
    background: var(--chat-system);
    font-style: italic;
  }
  
  .chat-input-area {
    padding: 8px;
    border-top: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    gap: 6px;
  }
  
  .chat-input-area input {
    flex: 1;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    color: var(--text);
  }
  
  .chat-input-area button {
    background: var(--accent);
    border: none;
    color: #020617;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
  }
  
  /* Emoji button */
  .emoji-btn {
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    cursor: pointer;
    color: var(--text);
  }
  
  /* ===============================
     Mobile Chat Drawer
     =============================== */
  
  .chat-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent);
    color: #020617;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 22px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
  }
  
  /* Slide-in drawer */
  .chat-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 360px;
    height: 100%;
    background: var(--card);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 200;
  }
  
  .chat-drawer.open {
    right: 0;
  }
  
  .chat-drawer .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .chat-close {
    cursor: pointer;
    font-size: 14px;
    right: 0px;
  }
  
  #sendBtn2 {
    z-index: 250;
  }
  
  /* ===============================
     Responsive
     =============================== */
  
  @media (max-width: 900px) {
    .geminar-layout {
      flex-direction: column;
    }
  
    .chat-column {
      display: none;
    }
  
    .chat-toggle {
      display: flex;
    }
  }
  
  /* ===============================
     Profile Icon
     =============================== */
  
  #profileIcon {
    position: fixed;
    top: 4px;
    right: 16px;
    cursor: pointer;
    color: var(--muted);
    z-index: 300;
  }
  
  #profileIcon:hover {
    color: var(--accent);
  }
  
  /* ===============================
     Profile Modal
     =============================== */
  
  #profileModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
  }
  
  #profileModalOverlay.open {
    display: flex;
  }
  
  #profileModal {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.6);
    animation: modalIn .2s ease-out;
  }
  
  @keyframes modalIn {
    from { transform: scale(.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
  
  .modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .modal-body {
    padding: 16px;
    overflow-y: auto;
  }
  
  .modal-body label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
  }
  
  .modal-body input {
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
  }
  
  .modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    text-align: right;
  }
  
  .modal-close {
    cursor: pointer;
  }
  .modal-close:hover {
    color: var(--accent);
  }
  
  /* =========================================================
     Modal Base (used by Author + Profile)
     ========================================================= */
  
  #geminarModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
  }
  
  #geminarModalOverlay.open {
    display: flex;
  }
  
  #geminarModal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    display: flex;
    flex-direction: column;
    animation: modalFadeIn .18s ease-out;
    overflow: hidden;
  }
  
  #othergems {
    width: 185px;
  }
  
  /* =========================================================
     Modal Animation
     ========================================================= */
  
  @keyframes modalFadeIn {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  /* =========================================================
     Modal Sections
     ========================================================= */
  
  .modal-body textarea,
  .modal-body select {
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
  }
  
  .modal-body textarea {
    resize: vertical;
  }
  
  /* =========================================================
     Dashboard Compact Cards
     ========================================================= */
  
  .dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }
  
  .dash-card {
    background: var(--card);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
  }
  
  .dash-card-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
  }
  
  /* =========================================================
     Dashboard Inner Tiles
     ========================================================= */
  
  .dash-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  
  /* individual tile */
  .dash-tile {
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    transition: border-color 0.15s ease;
  }
  
  .dash-tile:hover {
    border-color: var(--accent);
  }
  
  .dash-tile a {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .dash-tile .meta {
    font-size: 11px;
    color: var(--muted);
  }
  
  /* =========================================================
     Geminar Modal – Form Tiles
     ========================================================= */
  
  .geminar-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  
  /* individual tile */
  .form-tile {
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
  }
  
  /* tiles that span full width */
  .form-tile.span-2 {
    grid-column: span 2;
  }
  
  .form-tile label {
    display: block;
    font-size: 13px;
    color: var(--muted);
  }
  
  .form-tile input,
  .form-tile textarea,
  .form-tile select {
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
  }
  
  /* thumbnail slot */
  .thumbnail-slot {
    margin-top: 8px;
    width: 100%;
    height: 120px;
    background: #020617;
    border: 1px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
  }
  
  /* mobile fallback */
  @media (max-width: 700px) {
    .geminar-form-grid {
      grid-template-columns: 1fr;
    }
    .form-tile.span-2 {
      grid-column: span 1;
    }
  }
  
  img[loading="lazy"] {
    animation: fadeIn 0.5s ease-in-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  /* =========================================================
     Author Geminar Tiles (CRUD Listing)
     ========================================================= */
  
  .author-geminar-tile {
    background: var(--card);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
  }
  
  /* thumbnail area */
  .author-geminar-thumb {
    height: 120px;
    background: #020617;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
  }
  
  .author-geminar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  /* title */
  .author-geminar-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* meta line */
  .author-geminar-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
  }
  
  /* actions */
  .author-geminar-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .author-geminar-actions button {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  /* =========================================================
     Author Geminar Grid (Responsive Tiles)
     ========================================================= */
  
  .author-geminar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
  }
  
  /* buttons  */
  button {
    border-radius: 5px;
    background-color: khaki;
  } 
  
  /* 
  Tag buttons 
  */
  
  .tag-btn {
    font-size: 6pt;
    background-color: #94a3b8;
    cursor: pointer;
  }
  
  /* =========================================================
     Search Bar
     ========================================================= */
  
  .search-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
  }
  
  .search-bar input {
    width: 220px;
    max-width: 100%;
    padding: 8px 10px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
  }
  
  .search-bar input:focus {
    outline: none;
    border-color: var(--accent);
  }
  
  .search-bar button {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--accent);
    border: none;
    color: #020617;
    cursor: pointer;
    font-size: 14px;
  }
  
  .search-bar button:hover {
    opacity: 0.9;
  }
  
  /* Mobile: full width */
  @media (max-width: 600px) {
    .search-bar {
      justify-content: stretch;
    }
    .search-bar input {
      flex: 1;
    }
  }
  
  /* =========================================================
     Truncated Description (Tile-safe)
     ========================================================= */
  
  .geminar-description {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    margin: 6px 0 8px 0;
  
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* =========================================================
     Auth Page – Emphasis & Centering
     ========================================================= */
  
  #streamid {
    font-size: 10px;
    color: var(--muted);
  }

  .auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
  }
  
  .auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    padding: 28px 26px;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,.55);
  }
  
  .auth-card h3 {
    font-size: 22px;
    margin-bottom: 18px;
    text-align: center;
  }
  
  /* Large, confident inputs */
  .auth-card input {
    width: 100%;
    margin-bottom: 14px;
    padding: 14px 14px;
    font-size: 15px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
  }
  
  .auth-card input:focus {
    outline: none;
    border-color: var(--accent);
  }
  
  /* Primary action */
  .auth-card button {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
  }
  
  /* Subtle links */
  .auth-links {
    margin-top: 10px;
    font-size: 13px;
    text-align: center;
  }
  
  .checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
  }
  
  .checkbox-line input {
    flex-shrink: 0;
  }
  
  .modal-body input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
  }
  
  /* =========================================================
     Auth Modals Overlay
     ========================================================= */
  
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 600;
  }
  
  .modal-overlay.open {
    display: flex;
  }
  
  /* =========================================================
     Generic Modal Container
     ========================================================= */
  
  .modal {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.6);
    animation: modalFadeIn .18s ease-out;
    overflow: hidden;
  }
  
  /* =========================================================
     Listing Controls (Pagination + Search)
     ========================================================= */
  
  .list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }
  
  .pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
  }
  
  .pagination button {
    padding: 6px 10px;
    border-radius: 8px;
    background: #020617;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
  }
  
  .pagination button:disabled {
    opacity: 0.4;
    cursor: default;
  }
  
  #pageInfo {
    color: var(--muted);
  }
  
  /* Mobile stacking */
  @media (max-width: 700px) {
    .list-controls {
      flex-direction: column;
      align-items: stretch;
    }
    .pagination {
      justify-content: center;
    }
  }
  
  #credits, #earned {
    font-size: 8pt;
  }
  
  .hlplnk {
    font-size: 10pt;
  }
  
  .site-footer {
    position: fixed;
    bottom: 2px;
    font-size: 8pt;
    width: 100%;
    text-align: center;
  }
  
  /* =========================================================
     Search Row
     ========================================================= */
  
  .search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }
  
  /* =========================================================
     User Tag Search – Pill Mode
     ========================================================= */
  
  .user-tag-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .user-tag-search input {
    width: 200px;
    padding: 8px 12px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
  }
  
  .user-tag-search button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--accent-soft);
    color: #020617;
    font-weight: bold;
    cursor: pointer;
  }
  
  .user-tag-search button:hover {
    opacity: 0.9;
  }
  
  /* =========================================================
     Tag Pill Panel
     ========================================================= */
  
  .tag-pill-box {
    position: absolute;
    top: 115%;
    left: 0;
    width: 260px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,.6);
    padding: 10px;
    display: none;
    z-index: 300;
  }
  
  .tag-pill {
    display: inline-block;
    padding: 6px 10px;
    margin: 4px;
    border-radius: 999px;
    background: #020617;
    border: 1px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    color: var(--text);
  }
  
  .tag-pill:hover {
    border-color: var(--accent);
  }
  
  /* Mode indicator */
  
  #modeIndicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    background: #38bdf8;
    opacity: 0;
  }
  
  /* =========================================================
     Add Credits Modal
     ========================================================= */
  
  .credits-text {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
  }
  
  .credits-links {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
  }
  
  .credits-links a {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    border-radius: 10px;
    background: #020617;
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 14px;
    text-decoration: none;
  }
  
  .credits-links a:hover {
    border-color: var(--accent);
  }
  
  .credits-note {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
  }
  
  #paymentReceiptInput {
    width: 100%;
    padding: 12px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
  }
  
  #paymentReceiptInput:focus {
    outline: none;
    border-color: var(--accent);
  }
  
  /* ===============================
     Wide modal (iframe content)
     =============================== */
  
  .modal-wide {
    max-width: 520px;
    height: 80vh;
    display: flex;
    flex-direction: column;
  }
  
  .iframe-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
  }
  
  .iframe-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
  }
  
  /* ===============================
     Profile View (iframe)
     =============================== */
  
  .profileviewing {
    cursor: pointer;
  }
  
  .authdashurl{
    font-size: 8pt;
    padding-top:0px;
  }

  .profile-desc{
    font-size: 9pt;
    color: var(--muted);
    margin-bottom: 10px;
    font-style: italic;
  }

  .profile-title{
     padding-bottom: 20px;
  }

  .profile-view-card {
    padding: 24px;
    text-align: center;
  }
  
  .profile-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    margin-bottom: 14px;
  }
  
  .profile-name {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 6px;
  }
  
  .profile-byline {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
    font-style: italic;
  }
  
  .profile-website {
    font-size: 13px;
    margin-bottom: 14px;
  }
  
  .profile-website a {
    color: var(--accent);
    word-break: break-all;
  }
  
  .profile-about {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-line;
  }
  
  /* ===============================
     Profile Availability Status
     =============================== */
  
  .profile-status {
    display: inline-block;
    margin: 6px auto 10px auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.3px;
    border: 1px solid var(--border);
  }
  
  .profile-status.available {
    color: #22c55e; /* soft green */
    border-color: rgba(34,197,94,0.4);
  }
  
  .profile-status.busy {
    color: var(--muted);
    border-color: var(--border);
  }

  /* ===============================
   Full-Page Scroll Override (for landing/index pages)
   =============================== */

body.allow-full-scroll {
  display: block; /* Undo flex column */
  height: auto;   /* Allow natural growth */
}

body.allow-full-scroll .container {
  display: block;
  overflow: visible;
  height: auto;
  min-height: auto;
  flex: none;
  padding-bottom: 60px; /* Optional: ensure space for footer if still fixed */
}

/* If you also want the footer to stay at bottom only when needed */
body.allow-full-scroll .site-footer {
  position: static;
}