/* =====================================================================
   SOLARDOOT UI FRAMEWORK — PROFESSIONAL, CLEAN, RESPONSIVE (2025)
   Colors: Atulya Solar (Navy, Gold, White, Accent Blue)
===================================================================== */

/* ----------------------- COLOR SYSTEM ----------------------- */
:root {
  --navy: #1b3b73;
  --gold: #ffb700;
  --blue: #4b8bff;
  --green: #16c47f;
  --red: #ff6363;

  --text: #0b1220;
  --muted: #6b7280;

  --bg: #f4f7fb;
  --panel: #ffffff;

  --radius: 14px;
  --shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* ----------------------- GLOBAL RESET ----------------------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

/* =====================================================================
   HEADER / TOP NAVIGATION
===================================================================== */

header.menu-header {
  background: linear-gradient(90deg, #ffffff, #f8faff);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5e9f0;
}

.menu-left,
.menu-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#menu-toggle-btn {
  background: var(--navy);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
}

.menu-brand img {
  height: 34px;
  width: auto;
}

/* ----------------------- PROFILE PILL ----------------------- */

.profile-pill {
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  max-width: 170px;
  overflow: hidden;
}

.profile-pill img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-pill div {
  min-width: 0;
}

.profile-pill div div {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.profile-pill div div:first-child {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.profile-pill i {
  font-size: 12px;
  color: var(--muted);
}

/* ----------------------- DROPDOWN MENU ----------------------- */

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 180px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  padding: 6px 0;
  display: none;
  z-index: 999;
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.dropdown-menu a:hover {
  background: #f4f7ff;
  color: var(--navy);
}

.divider {
  height: 1px;
  background: #e3e5e9;
  margin: 6px 10px;
}

/* =====================================================================
   SIDEBAR NAVIGATION
===================================================================== */

.sidebar-wrapper {
  width: 240px;
  flex-shrink: 0;
  transition: transform .25s ease;
  transform: translateX(-260px); /* hidden on mobile */
}

.sidebar-wrapper.active {
  transform: translateX(0);
}

@media (min-width: 900px) {
  .sidebar-wrapper {
    transform: none !important;
  }
}

.sidebar {
  background: var(--panel);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: max-content;
  position: sticky;
  top: 16px;
}

.sidebar-logo img {
  height: 60px;
  margin: 0 auto 12px auto;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
}

.sidebar-nav a i {
  width: 24px;
  text-align: center;
  color: var(--navy);
}

.sidebar-nav a:hover {
  background: #f4f7ff;
  transform: translateX(4px);
}

/* =====================================================================
   BUTTON SYSTEM
===================================================================== */

.btn {
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  border: none;
}

.btn-primary {
  background: var(--navy);
  color: white;
}
.btn-primary:hover {
  background: #122a55;
}

.btn-gold {
  background: var(--gold);
  color: #1b1b1b;
}
.btn-gold:hover {
  background: #e2a400;
}

.btn-outline {
  border: 2px solid var(--navy);
  background: none;
  color: var(--navy);
}
.btn-outline:hover {
  background: var(--navy);
  color: white;
}

/* =====================================================================
   CARDS & KPI BOXES
===================================================================== */

.card {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  gap: 14px;
}

.kpi {
  padding: 16px;
  border-radius: 16px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}

.kpi.gold  { background: var(--gold); }
.kpi.navy  { background: var(--navy); }
.kpi.blue  { background: var(--blue); }
.kpi.green { background: var(--green); }

.kpi .label { font-size: 12px; opacity: .9; }
.kpi .value { font-size: 22px; font-weight: 700; }

/* =====================================================================
   TABLE STYLES
===================================================================== */

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th {
  background: var(--navy);
  color: white;
  padding: 12px;
  font-size: 14px;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid #edf0f4;
  font-size: 14px;
}

.table tr:hover td {
  background: #f4f8ff;
}

/* =====================================================================
   RESPONSIVE SYSTEM
===================================================================== */

@media (max-width: 900px) {
  .sidebar-wrapper { display: block; } /* mobile slide-out */
}

@media (max-width: 480px) {

  header.menu-header {
    padding: 8px !important;
  }

  .profile-pill div,
  .profile-pill i {
    display: none;
  }

  .profile-pill {
    max-width: 40px;
    padding: 4px !important;
  }

  .menu-brand img {
    height: 26px;
  }
}


/* ===== SOLARDOOT SIDEBAR LAYOUT + MOBILE SLIDE-IN (Append to your CSS) ===== */

/* Desktop: 2-column layout */
.layout-with-sidebar {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

/* Main content area grows to fill remaining space */
.layout-main {
  flex: 1 1 auto;
  min-width: 0; /* important to avoid overflow */
}

/* Sidebar (wrapper) base */
.sidebar-wrapper {
  width: 240px;
  flex-shrink: 0;
  z-index: 40;
}

/* On desktop keep sidebar static */
@media (min-width: 900px) {
  .sidebar-wrapper {
    position: relative;
    transform: none !important;
    left: 0;
    top: 0;
    box-shadow: none;
    background: transparent;
  }
}

/* Mobile: slide-in panel with backdrop */
@media (max-width: 899px) {

  /* make sidebar fixed and off-canvas by default */
  .sidebar-wrapper {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-280px);
    transition: transform .28s cubic-bezier(.2,.9,.25,1);
    box-shadow: 0 20px 40px rgba(12,20,40,0.12);
    background: var(--panel);
    padding: 18px;
    overflow-y: auto;
    width: 280px;
  }

  /* when active, slide into view */
  .sidebar-wrapper.active {
    transform: translateX(0);
  }

  /* optional translucent overlay to dim page when sidebar open */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 35;
  }
  .sidebar-wrapper.active + .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* ensure main content is scrollable behind overlay */
  .layout-main {
    min-height: 100vh;
  }
}

/* Utility: full-width buttons in sidebar actions */
.sidebar .w-full { width: 100%; display: inline-flex; justify-content:center; gap:8px; align-items:center; }

/* Safety: ensure no overflow due to long labels */
.sidebar, .layout-main, header.menu-header { min-width: 0; }


/* ============================================
   FIX SIDEBAR + CONTENT LAYOUT (DESKTOP)
   ============================================ */
.layout-with-sidebar {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto; /* centers the total layout cleanly */
  padding: 20px;
}

.sidebar-wrapper {
  width: 240px;
  flex-shrink: 0;
}

.layout-main {
  flex: 1;
  min-width: 0; /* prevents overflow + fixes right side */
}





@media (max-width: 900px) {
  .sidebar-wrapper {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-260px);
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    z-index: 999;
    transition: transform .25s ease;
    padding: 18px;
  }

  .sidebar-wrapper.active {
    transform: translateX(0);
  }

  .layout-main {
    width: 100%;
  }
}
