/* ===========================
   TenaCode — index.css
   Dark terminal aesthetic,
   clean & mobile-first
=========================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #0d0f14;
  --surface:   #13161e;
  --card:      #181c26;
  --border:    #252a38;
  --accent:    #00e5a0;
  --accent2:   #0099ff;
  --text:      #e4e8f0;
  --muted:     #6b7591;
  --danger:    #ff4d6d;
  --radius:    10px;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Syne', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ===== HERO TITLE ===== */
.hero-title {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 80px 20px 60px;
  background: linear-gradient(160deg, #0d0f14 60%, #0d1a20 100%);
  border-bottom: 1px solid var(--border);
}

/* floating code snippets in background */
.code-bg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 20px 40px;
  pointer-events: none;
  overflow: hidden;
}

.code-bg span {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.4vw, 14px);
  color: var(--accent);
  opacity: 0.07;
  white-space: nowrap;
}

.code-bg span:nth-child(odd)  { transform: translateX(-6%); color: var(--accent2); }
.code-bg span:nth-child(even) { transform: translateX(4%);  }

.big-title {
  position: relative;
  font-family: var(--font-sans);
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.subtitle {
  position: relative;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--border);
}

.upload-btn {
  background: var(--accent) !important;
  color: #0d0f14 !important;
  font-weight: 700 !important;
  padding: 7px 14px !important;
  border-radius: 6px !important;
  transition: opacity 0.2s !important;
}

.upload-btn:hover { opacity: 0.85; background: var(--accent) !important; }

.logout {
  color: var(--danger) !important;
}

.user-online {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.username {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}

/* ===== HERO SECTION ===== */
.hero {
  max-width: 720px;
  margin: 60px auto 40px;
  padding: 0 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.75;
}

.my-codes-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 11px 26px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.my-codes-btn:hover {
  background: var(--accent);
  color: #0d0f14;
}

/* ===== SEARCH ===== */
.search {
  max-width: 560px;
  margin: 0 auto 56px;
  padding: 0 24px;
}

.search form {
  display: flex;
  gap: 8px;
}

.search input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); }

.search button {
  padding: 11px 22px;
  background: var(--accent);
  color: #0d0f14;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.search button:hover { opacity: 0.85; }

/* ===== SECTION TITLE ===== */
.section-title {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 24px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== CARDS GRID ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.card:hover .card-image img { transform: scale(1.03); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 6px;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.category {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent2);
  background: rgba(0, 153, 255, 0.1);
  border: 1px solid rgba(0, 153, 255, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.card p {
  padding: 0 16px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-buttons {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.card-buttons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

a.preview {
  background: var(--accent);
  color: #0d0f14;
  flex: 1;
}

a.preview:hover { opacity: 0.85; }

a.like {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
}

a.like:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== VIEW MORE ===== */
.view-more {
  text-align: center;
  margin: 28px 0 60px;
}

.view-more a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent2);
  border: 1px solid var(--border);
  padding: 10px 22px;
  border-radius: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.view-more a:hover {
  background: var(--surface);
  border-color: var(--accent2);
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 28px 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.footer span {
  color: var(--accent);
  font-weight: 700;
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .hero-title  { padding: 60px 20px 44px; }
  .navbar      { padding: 12px 16px; }
  .nav-links   { gap: 6px; }
  .nav-links a { padding: 6px 10px; font-size: 0.75rem; }
  .container   { grid-template-columns: 1fr; padding: 0 16px; }
  .hero        { margin: 40px auto 28px; }
  .search      { padding: 0 16px; margin-bottom: 40px; }
  .section-title { padding: 0 16px; }
  .view-more   { margin-bottom: 40px; }
}