/* ============================================================
   The Fudge Monkey — Shared Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700&display=swap');

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

:root {
  --bg:        #1A1008;
  --surface:   #2A1A0E;
  --text:      #E8D5B0;
  --heading:   #D4955A;
  --cta:       #C47840;
  --cta-hover: #D4884E;
  --muted:     #7A6050;
  --border:    #3A2010;
  --error:     #C0392B;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */

h1, h2, h3, .brand-name, .welcome-heading {
  color: var(--heading);
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  letter-spacing: 0.02em;
}

a {
  color: var(--heading);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--cta-hover);
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 28px;
  background: var(--cta);
  color: var(--bg);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  user-select: none;
}

.btn:hover {
  background: var(--cta-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(196,120,64,0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--muted);
  box-shadow: none;
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ── Inputs ── */

.input-field {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-field:focus {
  border-color: var(--heading);
  box-shadow: 0 0 0 3px rgba(212,149,90,0.15);
}

.input-field::placeholder {
  color: var(--muted);
}

/* ── PIN Input ── */

.pin-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.5em;
  text-align: center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-text-security: disc;
  /* fallback for browsers without -webkit-text-security */
}

.pin-input:focus {
  border-color: var(--heading);
  box-shadow: 0 0 0 3px rgba(212,149,90,0.15);
}

/* ── Error message ── */

.error-msg {
  color: var(--error);
  font-size: 0.85rem;
  min-height: 1.2em;
  text-align: center;
  margin-top: 6px;
}

/* ── Shake animation ── */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-8px); }
  30%       { transform: translateX(8px); }
  45%       { transform: translateX(-6px); }
  60%       { transform: translateX(6px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}

.shake {
  animation: shake 0.5s ease;
}

/* ── Fade-in ── */

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

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* ── Divider ── */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Utility ── */

.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.text-small  { font-size: 0.85rem; }
.w-full      { width: 100%; }
.mt-sm       { margin-top: 10px; }
.mt-md       { margin-top: 20px; }
.mt-lg       { margin-top: 32px; }

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.4s ease;
}

.login-logo {
  width: 320px;
  max-width: 90%;
  display: block;
  margin: 40px auto 30px auto;
}

.login-title {
  font-size: 1.15rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 24px;
  font-weight: 400;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pin-label {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.reset-link {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 24px;
  cursor: pointer;
  transition: color var(--transition);
}

.reset-link:hover {
  color: var(--heading);
}

/* ============================================================
   Dashboard — Header
   ============================================================ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.header-logo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.dashboard-logo {
  width: 280px;
  max-width: 80%;
  display: block;
  margin: 30px auto 20px auto;
}

.header-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  flex: 1;
}

.header-actions {
  flex-shrink: 0;
}

/* ============================================================
   Dashboard — Main
   ============================================================ */

.dashboard-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* Welcome card */

.welcome-card {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.welcome-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4CAF50;
  box-shadow: 0 0 10px rgba(76,175,80,0.6);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(76,175,80,0.6); }
  50%       { box-shadow: 0 0 14px rgba(76,175,80,0.9); }
}

.welcome-text h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--heading);
  margin-bottom: 2px;
}

.welcome-text p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Panels grid */

.panels-heading {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.panel-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.panel-card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-label {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: 0.05em;
}

.panel-title {
  font-size: 1rem;
  color: var(--heading);
  margin-bottom: 8px;
}

.panel-placeholder {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.panel-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: auto;
}

.panel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

/* ── Module cards ── */

.module-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid var(--cta);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.module-card:hover {
  border-top-color: var(--cta-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
}

.module-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.panel-badge--online {
  background: rgba(76,175,80,0.12);
  border-color: rgba(76,175,80,0.4);
  color: #6ecf72;
}

.panel-dot--online {
  background: #4CAF50;
  box-shadow: 0 0 6px rgba(76,175,80,0.7);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 600px) {
  .site-header {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 0.9rem;
  }

  .dashboard-main {
    padding: 24px 16px 48px;
  }

  .welcome-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .panels-grid {
    grid-template-columns: 1fr;
  }

  .login-logo {
    width: 130px;
  }
}
