/* ============================================
   NETSHOP — Network Equipment Catalog
   Design System & Global Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300..800&family=Manrope:wght@300..800&family=JetBrains+Mono:wght@400..600&display=swap');

:root {
  /* Palette */
  --bg: #0a0a0b;
  --bg-elev: #121214;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-dim: #a1a1aa;
  --text-mute: #71717a;
  --accent: #00d9a3;
  --accent-dim: #00b386;
  --accent-glow: rgba(0, 217, 163, 0.15);
  --danger: #f87171;
  --warning: #fbbf24;

  /* Typography */
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --container: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 217, 163, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 217, 163, 0.04), transparent);
  background-attachment: fixed;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ============ TYPOGRAPHY ============ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: 1.35rem; }

.mono { font-family: var(--font-mono); font-size: 0.85em; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

/* ============ LAYOUT ============ */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

/* ============ NAVBAR ============ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 11, 0.7);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: var(--container);
  margin: 0 auto;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 0.92rem;
  color: var(--text-dim);
  transition: color 0.2s;
  font-weight: 500;
}

.nav-links a:hover, .nav-links a.active { color: var(--text); }

.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

/* Hamburger for mobile */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 0.5rem;
}
.hamburger span {
  width: 22px; height: 2px; background: var(--text);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-elev);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
  }
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
}
.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

/* ============ HERO ============ */

.hero {
  padding: 6rem 0 4rem;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 1.5rem 0;
}
.hero-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 540px;
  margin-bottom: 2rem;
}

.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero-visual {
  aspect-ratio: 1;
  position: relative;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(0,217,163,0.1), transparent),
    var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.hero-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,217,163,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,217,163,0.1) 1px, transparent 1px);
  background-size: 40px 40px;
  mask: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.hero-visual-icon {
  width: 60%;
  height: 60%;
  position: relative;
  z-index: 2;
  opacity: 0.9;
}

/* ============ CATEGORIES ============ */

.section {
  padding: 4rem 0;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title { margin-top: 0.5rem; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.cat-card {
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cat-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
}

.cat-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.cat-card:hover::before { opacity: 1; }

.cat-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  position: relative; z-index: 2;
}

.cat-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  position: relative; z-index: 2;
}

.cat-count {
  color: var(--text-mute);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  position: relative; z-index: 2;
}

/* ============ PRODUCTS ============ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.product-image {
  aspect-ratio: 4/3;
  background: var(--bg-elev);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}

.product-image img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.product-image-placeholder {
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.product-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }

.product-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.product-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.product-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}
.product-price .currency {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--text-dim);
  margin-right: 2px;
}

/* ============ FILTERS / CATALOG ============ */

.catalog-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  margin-top: 2rem;
}

@media (max-width: 900px) {
  .catalog-wrap { grid-template-columns: 1fr; }
}

.filter-panel {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-self: start;
  position: sticky;
  top: 90px;
}

.filter-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 0.75rem;
}

.filter-list { list-style: none; }
.filter-list li {
  padding: 0.5rem 0;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.2s;
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
}
.filter-list li:hover, .filter-list li.active { color: var(--accent); }

/* ============ FORMS ============ */

.form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field { display: flex; flex-direction: column; gap: 0.5rem; }

.field label {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
}

.input, .select, .textarea {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.textarea { min-height: 100px; resize: vertical; }

/* ============ AUTH PAGES ============ */

.auth-wrap {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.auth-card h2 {
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--text-dim);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.auth-toggle {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.auth-toggle a { color: var(--accent); font-weight: 600; }

.auth-error, .auth-success {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  display: none;
}
.auth-error { background: rgba(248,113,113,0.1); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.auth-success { background: rgba(0,217,163,0.1); color: var(--accent); border: 1px solid rgba(0,217,163,0.3); }

/* ============ ADMIN ============ */

.admin-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 73px);
}

@media (max-width: 900px) {
  .admin-wrap { grid-template-columns: 1fr; }
}

.admin-side {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
}

.admin-side-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  padding: 0 1rem;
  margin-bottom: 1rem;
}

.admin-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-nav button {
  width: 100%;
  text-align: left;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.92rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-nav button:hover { background: var(--surface); color: var(--text); }
.admin-nav button.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.admin-main { padding: 2.5rem; overflow-x: auto; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-section { display: none; }
.admin-section.active { display: block; }

/* ============ TABLES ============ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 600px;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  background: var(--bg-elev);
  font-weight: 500;
}

td { color: var(--text); }
tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255, 255, 255, 0.02); }

.row-actions { display: flex; gap: 0.5rem; }

/* ============ STATS ============ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============ MODAL ============ */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal.open { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: all 0.2s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ============ PROFILE ============ */

.profile-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2.5rem;
  padding: 3rem 0;
}

@media (max-width: 900px) {
  .profile-wrap { grid-template-columns: 1fr; }
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  align-self: start;
}

.avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--bg);
  margin: 0 auto 1rem;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-email {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  margin-bottom: 1.5rem;
}

.profile-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.profile-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

/* ============ PRODUCT DETAIL ============ */

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 3rem 0;
}

@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
}

.product-detail-img {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.product-detail-img img { width: 100%; height: 100%; object-fit: cover; }

.product-detail-name {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1.05;
  margin: 1rem 0;
}

.product-detail-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.5rem 0;
}

.specs-list {
  list-style: none;
  margin: 2rem 0;
}

.specs-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.specs-list li:last-child { border-bottom: none; }
.specs-list .label { color: var(--text-dim); }
.specs-list .val { font-family: var(--font-mono); }

/* ============ FOOTER ============ */

.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  color: var(--text-mute);
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: 1rem;
}

.footer ul { list-style: none; }
.footer li { padding: 0.3rem 0; }
.footer a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ============ UTILITY ============ */

.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-mute);
}

.empty .mono { display: block; margin-top: 0.5rem; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Animation on load */
.fade-in {
  animation: fadeUp 0.6s ease-out backwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
