/* === SUNSWEEP Dashboard Theme (Dark Mode Only) === */

/* === COLOR VARIABLES === */
:root {
  --bg: #0f1623;
  --panel: #121b2b;
  --muted: #2a3752;
  --text: #e8eefc;
  --accent: #8fb1ff;
  --danger: #b34a4a;
}

/* === GLOBAL RESET === */
* { box-sizing: border-box; }

body, html {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* === LINKS & BUTTONS === */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #0b1220;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn:hover { background: #a3c2ff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #d95a5a; }

/* === TOPBAR === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #0b1220;
  border-bottom: 1px solid var(--muted);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.brand {
  font-weight: 800;
  letter-spacing: .5px;
  font-size: 1.1rem;
}
.topnav a { margin-left: 12px; }

/* === LAYOUT === */
.layout {
  display: flex;
  min-height: calc(100vh - 52px);
  width: 100%;
  overflow-x: hidden;
}

/* === SIDEBAR (Desktop Default) === */
.sidebar {
  width: 240px;
  background: #0b1220;
  border-right: 1px solid var(--muted);
  padding: 12px;
  display: flex;
  flex-direction: column;
  position: fixed;   /* ← Fixed to the left */
  top: 52px;
  bottom: 0;
  left: 0;
  z-index: 200;
  transition: left 0.3s ease;
}
.sidebar .item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.sidebar .item:hover { background: var(--panel); }
.sidebar .item.active {
  background: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

/* === MAIN CONTENT AREA === */
.content {
  flex: 1;
  padding: 18px 24px;
  margin-left: 240px;    /* ← prevents overlap */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* === RESPONSIVE SIDEBAR (Mobile) === */
.menu-btn {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .menu-btn { display: block; }

  .sidebar {
    left: -260px;        /* hide offscreen by default */
    width: 240px;
    height: calc(100vh - 52px);
  }

  .sidebar.active {
    left: 0;             /* slide in when active */
  }

  .content {
    margin-left: 0;      /* content uses full width on mobile */
    padding: 16px;
  }
}

/* === OVERLAY FOR MOBILE SIDEBAR === */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 150;
}
.overlay.show { display: block; }


/* === GRID & CARDS === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  width: 100%;
}
.card {
  background: var(--panel);
  border: 1px solid var(--muted);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, background 0.3s ease;
  min-width: 0;
}
.card:hover { transform: translateY(-3px); background: #16233b; }
.card.wide { grid-column: span 2; }

@media (max-width: 1200px) {
  .card.wide { grid-column: span 1; }
}
@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .card, .card.wide { grid-column: span 1; }
}

/* === TABLES === */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td {
  padding: 10px;
  border-bottom: 1px solid var(--muted);
  text-align: left;
}

/* === FORMS === */
.form input, .form select, .form textarea {
  width: 100%;
  background: #0b1220;
  border: 1px solid var(--muted);
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  margin: 8px 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* === LOGIN PAGE === */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--muted);
  padding: 18px;
  border-radius: 14px;
}
.login-box h1 { margin: 0 0 10px 0; }
.login-box input, .login-box button {
  width: 100%;
  margin: 8px 0;
}
.login-box button {
  background: var(--accent);
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: #0b1220;
  font-weight: 700;
  cursor: pointer;
}
.login-box button:hover { background: #a3c2ff; }

/* === ALERTS & LISTS === */
.alert {
  background: #3b1e1e;
  color: #ffdcdc;
  border: 1px solid #7a3a3a;
  padding: 8px 10px;
  border-radius: 10px;
  margin: 8px 0;
}
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--muted);
}

/* === UTILITIES === */
.text-center { text-align: center; }
.hide { display: none !important; }


/* === PAGINATION === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pagination a.btn {
  padding: 6px 14px;
  font-size: 0.9rem;
}
.pagination span {
  font-size: 0.9rem;
  color: var(--text);
}
