:root {
      --primary: #F9F9FA;
      --accent: #f53333;
      --text: #1E1E2F;
      --secondary: #2C2C3E;
      --primary-bg: #fefefe;
      --secondary-bg: #ffffff;
      --tertiary-bg: #f8f9fa;
      --card-bg: rgba(255, 255, 255, 0.95);
      --glass-bg: rgba(255, 255, 255, 0.8);
      --accent-primary: #ef4444;
      --accent-secondary: #dc2626;
      --accent-tertiary: #b91c1c;
      --accent-coral: #f97316;
      --accent-pink: #ec4899;
      --text-primary: #1f2937;
      --text-secondary: #6b7280;
      --text-muted: #9ca3af;
      --border-primary: rgba(239, 68, 68, 0.15);
      --border-secondary: rgba(0, 0, 0, 0.06);
      --shadow-primary: 0 8px 32px rgba(239, 68, 68, 0.08);
      --shadow-secondary: 0 8px 32px rgba(220, 38, 38, 0.08);
      --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.04);
      --shadow-glow: 0 0 20px rgba(239, 68, 68, 0.15);
      --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    *, *::before, *::after {
      box-sizing: border-box;
    }

    body {
      font-family:'Segoe UI', sans-serif;
      background-color: #EFF2F7;
      color: var(--text);
      margin: 0;
      padding: 0;
    }

    .header {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      background-color: var(--text);
      color: var(--primary);
      border-bottom: 1px solid var(--primary);
      z-index: 3000;
      padding: 0 5rem;
      display: flex;
      justify-content: space-between;
      box-sizing: border-box;
      align-items: center;
      height: 100px;   
    }

    .landing-page-container-codemate-logo a {
      display: flex;
      align-items: center;
      flex: 1;
      text-decoration: none;
      color: inherit;
      pointer-events: auto;
    }

    .landing-page-container-codemate-logo a img,
    .landing-page-container-codemate-logo a h2 {
      pointer-events: auto; 
    }

    .landing-page-container-codemate-logo,
    .navbar,
    .buttons {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center; 
    }

    .logo {
      font-family: 'JetBrains Mono', monospace;
      font-size: 1.6rem;
      font-weight: 600;
      color: #FFFFFF;
      text-shadow: 0 0 20px rgba(248, 248, 248, 0.363);
      letter-spacing: -0.5px;
    }

    .landing-page-codemate-logo {
      height: 100px;
      width: auto;
      object-fit: contain;
      margin-left: 6.5em;
      position: relative;
      bottom: 0.8rem;
      margin-right: -1rem;
    }



    .landing-page-container-codemate-logo h2 {
      font-size: 1.6rem;
      margin: 0;
      position: static;
      white-space: nowrap;
    }

    .navbar {
      gap: 25px;
      flex-wrap: wrap;
    }

    .nav-link {
      text-decoration: none;
      color: inherit;
    }

    .nav-link:hover, .header .login-button:hover {
      color: var(--accent);
    }

    .header-profile {
      flex: 1;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 0.5rem;
    }

    .header-profile-pic {
      border-radius: 50%;
      width: 40px;
      height: 40px;
      display: block;
      border: 2px solid #fff;
      transition: var(--transition-smooth);
      cursor: pointer;
    }


    .dropdown {
      position: absolute;
      top: 80px;
      right: 5rem;
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 6px 12px rgba(0,0,0,0.1);
      width: 220px;
      display: none;
      z-index: 999;
      padding: 0.8rem 0.5rem;
    }

    .dropdown.show {
      display: block;
    }



    .dropdown a {
      display: flex;
      align-items: center;
      padding: 0.8rem 1rem;
      text-decoration: none;
      color: #333;
      transition: background 0.2s;
      cursor: pointer;
    }

    .dropdown a:hover {
      background: #f0f0f0;
    }

    .dropdown a i {
      margin-right: 10px;
      color: #666;
    }

    hr {
      margin: 0.5rem 0.7rem;
    }


    .topnav { 
      display: none;
      cursor: pointer;
    }

    .playground-header {
      text-align: center;
      margin-bottom: 2rem;
      padding-top: 8rem;
    }

    .playground-heading {
      font-size: 3.5rem;
      color: black;
    }

    .playground-subtitle {
      font-size: 1.2rem;
      color: var(--secondary);
      max-width: 600px;
      margin: 0 auto;
    }

    .projects-container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 2rem 2rem 1rem;
      margin-bottom: 5.5rem;
    }

    .projects-toolbar {
      display: flex;
      gap: 1rem;
      margin-bottom: 2rem;
      align-items: center;
    }

    .new-project-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.75rem;
      background: #eb1717c5;
      color: white;
      border: none;
      padding: 0.9rem 1.8rem;
      border-radius: 12px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: all var(--transition-smooth);
      box-shadow: var(--shadow-primary);
      white-space: nowrap;
    }

    .new-project-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 40px rgba(239, 68, 68, 0.15);
    }

    .new-project-btn i {
      font-size: 1.2rem;
    }

    .empty-state {
      text-align: center;
      padding: 4rem 2rem;
      background: var(--card-bg);
      border-radius: 20px;
      box-shadow: var(--shadow-card);
      border: 1px solid var(--border-secondary);
      margin-top: 2rem;
      transition: all var(--transition-smooth);
      animation: fadeInUp 0.5s var(--transition-smooth);
      margin-bottom: 5.5rem;
    }

    .empty-state:hover {
      transform: translateY(-4px);
      box-shadow: 0 20px 50px rgba(239, 68, 68, 0.08);
      border-color: var(--accent-primary);
    }

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

    .empty-state-icon {
      font-size: 4rem;
      color: var(--accent-primary);
      margin-bottom: 1.5rem;
      opacity: 0.8;
    }

    .empty-state h2 {
      font-size: 2rem;
      color: var(--text-primary);
      margin: 0 0 0.5rem;
    }

    .empty-state p {
      color: var(--text-secondary);
      font-size: 1.1rem;
      margin: 0 0 2rem;
      max-width: 400px;
      margin-left: auto;
      margin-right: auto;
    }

    .search-input {
      flex: 1;
      padding: 15px;
      border: 2px solid #e1e5e9;
      border-radius: 25px;
      font-size: 1rem;
      transition: all var(--transition-smooth);
      background: #fff;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    }

    .search-input:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 40px rgba(239, 68, 68, 0.08);
      border-color: var(--accent-primary);
    }

    .search-input:focus {
      outline: none;
      border-color: var(--accent-primary);
      box-shadow: 0 12px 40px rgba(239, 68, 68, 0.15);
      transform: translateY(-3px);
    }

    .projects-header {
      margin-bottom: 1.5rem;
    }

    .projects-count {
      color: var(--text-secondary);
      font-size: 1rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .projects-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
      gap: 1.5rem;
      margin-top: 2rem;
      
    }

     .project-card {
      background: var(--card-bg);
      border-radius: 20px;
      padding: 1.5rem;
      z-index: 1000;
      box-shadow: var(--shadow-card);
      transition: all var(--transition-smooth);
      border: 1px solid var(--border-secondary);
      position: relative;
      display: flex;
      flex-direction: column;
      height: 200px; /* Fixed height to prevent expansion */
    }

    .project-card:hover {
      transform: translateY(-6px);
      z-index: 1000;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    }

      .project-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 1rem;
      min-height: 60px; /* Reserve space for title area */
      position: relative;
    }
    


     .project-title {
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--text-primary);
      margin: 0;
      flex: 0 1 auto;
      max-width: 240px; /* Adjust this number */
      /* Limit to 2 lines with ellipsis */
      /*display: -webkit-box;*/
      /*-webkit-line-clamp: 2;*/
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.4;
      max-height: 3.5rem; /* 2 lines * 1.4 line-height * 1.25rem font-size */
      word-break: break-word;
      padding-right: 0.5rem;
    }

    .project-menu-btn {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 1.3rem;
      color: var(--text-secondary);
      transition: all var(--transition-smooth);
      padding: 6px;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
    }

    .project-menu-btn:hover {
      background: rgba(239, 68, 68, 0.1);
      color: var(--accent-primary);
    }

    .project-menu {
      position: absolute;
      top: 35px;
      right: 40px;
      background: var(--secondary-bg);
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
      z-index: 1500;
      min-width: 200px;
      display: none;
      overflow: hidden;
    }

    .project-menu.show {
      display: block;
      animation: slideDown 0.2s ease;
    }

    @keyframes slideDown {
      from {
        opacity: 0;
        transform: translateY(-10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .menu-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      background: none;
      border: none;
      cursor: pointer;
      width: 100%;
      text-align: left;
      color: var(--text-primary);
      transition: all var(--transition-smooth);
      font-size: 0.95rem;
    }

    .menu-item:hover {
      background: rgba(239, 68, 68, 0.08);
      color: var(--accent-primary);
      padding-left: 20px;
    }

    .menu-item i {
      width: 16px;
      text-align: center;
    }

    .menu-divider {
      height: 1px;
      background: var(--border-secondary);
      margin: 4px 0;
    }

     .project-info {
      color: var(--text-secondary);
      font-size: 0.9rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 1rem;
      margin-top: auto; /* Push to bottom of flex container */
    }

    .project-info i {
      color: var(--accent-primary);
      opacity: 0.7;
    }

    .project-footer {
      display: flex;
      gap: 1rem;
      margin-top: auto; /* Ensure it stays at bottom */
    }

    .project-btn {
      flex: 1;
      padding: 0.7rem 1rem;
      border: none;
      border-radius: 10px;
      font-weight: 600;
      cursor: pointer;
      transition: all var(--transition-smooth);
      font-size: 0.95rem;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
    }

    .project-edit {
      background: #eb1717c5;
      color: white;
    }

    .project-edit:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-primary);
    }


    .pin-badge {
      position: absolute;
      top: 0;
      right: 40px; /* Position it next to the menu button */
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #ef4444;
      background: rgba(239, 68, 68, 0.1);
      border: 1.5px solid rgba(239, 68, 68, 0.3);
      padding: 6px 8px;
      border-radius: 8px;
      font-size: 1rem;
      width: 32px;
      height: 32px;
      margin: 0;
      box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
      transition: all var(--transition-smooth);
      cursor: pointer;
    }

    .pin-badge:hover {
      background: rgba(239, 68, 68, 0.15);
      border-color: rgba(239, 68, 68, 0.4);
      transform: scale(1.05);
    }
    .modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      z-index: 2000;
      align-items: center;
      justify-content: center;
    }

    .modal.show {
      display: flex;
    }

    
    .modal-content {
      background: var(--secondary-bg, #fff);
      border-radius: 16px;
      padding: 2.5rem;
      text-align: center;
      max-width: 420px;
      width: 90%;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    }

    
    .modal-header {
      color: var(--text-primary, #1a1a1a);
      margin: 0 0 1.5rem 0;
      font-size: 1.5rem; /* 24px */
      font-weight: 700;
    }

    .modal-body {
      color: var(--text-secondary, #666);
      margin: 0 0 1.5rem 0;
      font-size: 1rem; /* 16px */
      line-height: 1.5;
    }


    .modal-input {
      width: 100%;
      padding: 10px 12px;
      border: 2px solid var(--border-secondary);
      border-radius: 10px;
      margin-bottom: 2rem;
      font-size: 0.95rem;
    }

    .modal-buttons {
      display: flex;
      gap: 1rem;
      justify-content: center;
    }

    .modal-btn {
      padding: 12px 32px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      font-size: 1rem; /* 16px */
      transition: all 0.3s ease;
    }

    /* Cancel Button */
    .modal-cancel {
      background: transparent;
      color: var(--text-secondary, #666);
      border: 2px solid var(--border-secondary, #e1e5e9);
    }

    .modal-cancel:hover {
      border-color: var(--border-hover, #ccc);
    }

    /* Confirm (Delete) Button */
    .modal-confirm {
      background: var(--accent-danger, #eb1717c5);
      color: #fff;
      border: none;
    }

    .modal-confirm:hover {
      background: var(--accent-danger-hover, #d01010);
    }
    
    .loading-spinner {
      display: inline-block;
      width: 40px;
      height: 40px;
      border: 4px solid rgba(239, 68, 68, 0.1);
      border-top: 4px solid var(--accent-primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

    .project-menu {
  position: absolute;
  top: 50px;
  right: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 100;
  min-width: 180px;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.project-menu.show {
  display: block;
  animation: slideDown 0.2s ease;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: #1f2937;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  font-family:'Segoe UI', sans-serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.menu-item:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  padding-left: 20px;
}

.menu-item i {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

.menu-item.delete-item {
  color: #ef4444;
}

.menu-item.delete-item:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 4px 0;
}

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

/* ===== HAMBURGER ===== */
.topnav {
  display: none;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-icon {
  width: 28px;
  height: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.menu-icon span {
  background-color: white;
  display: block;
  height: 3px;
  width: 100%;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.menu-icon.active .bar1 { transform: translateY(9px) rotate(45deg); }
.menu-icon.active .bar2 { opacity: 0; transform: scaleX(0); }
.menu-icon.active .bar3 { transform: translateY(-9px) rotate(-45deg); }

#myLinks {
  display: none;
  position: fixed;
  top: 100px;
  left: 0;
  width: 100%;
  background: #1E1E2F;
  z-index: 998;
  flex-direction: column;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

#myLinks.show { display: flex; }

#myLinks a {
  padding: 1rem 2rem;
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.2s;
}

#myLinks a:hover { background: rgba(255,255,255,0.05); }

/* ===== RESPONSIVE ===== */
@media (min-width: 1000px) and (max-width: 1406px) {
  .header { padding: 0 2rem; }
  .navbar { flex-wrap: nowrap; white-space: nowrap; gap: 15px; }
}

@media (max-width: 1000px) {
  .header { padding: 0 1rem; padding-left: 2rem; }
  .navbar { flex-wrap: nowrap; white-space: nowrap; gap: 15px; }
  .landing-page-container-codemate-logo { flex: 0 0 250px; margin-right: 2rem; }
  .landing-page-container-codemate-logo a span { font-size: 1.5rem !important; }
  .landing-page-container-codemate-logo a img { height: 48px !important; width: 48px !important; }
}

@media (max-width: 1024px) {
  .header { padding: 0 2rem; }
  .dropdown { right: 2rem; }
  .landing-page-container-codemate-logo a span { font-size: 1.4rem !important; }
}

@media (max-width: 900px) {
  .landing-page-container-codemate-logo { margin-right: 0.5rem; }
}

@media (max-width: 850px) {
  .header { padding: 0 1.2rem; height: 70px; }
  .landing-page-container-codemate-logo { flex: 1; }
  .navbar { display: none; }
  .header-profile { flex: 0; margin-right: 1rem; }
  .topnav { display: flex; }
  #myLinks { top: 70px; }
  .dropdown { right: 1rem; top: 60px; }

  .playground-header { padding-top: 5rem; }
  .playground-heading { font-size: 2.2rem; }
  .playground-subtitle { font-size: 1rem; padding: 0 1rem; }

  .projects-container { padding: 1rem; }
  .projects-toolbar { flex-direction: column; align-items: stretch; }
  .new-project-btn { width: 100%; justify-content: center; }
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .header { padding: 0 1rem; }
  .playground-heading { font-size: 1.8rem; }
  .project-card { height: auto; }
}