/* ====================================
   Layout CSS - Sidebar, Header, Footer
   ==================================== */

:root {
  --primary-color: #1e40af;
  --primary-light: #2563eb;
  --primary-dark: #1e3a8a;
  --accent-color: #10b981;
  --danger-color: #dc2626;
  --border-color: #e5e7eb;
  --bg-light: #f5f7fa;
  --text-dark: #1e3a8a;
  --text-light: #6b7280;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 6px 24px rgba(2, 12, 74, 0.08);
  --sidebar-width: 220px;
  --sidebar-width-sm: 180px;
}

/* ====================================
   Body & Layout Structure
   ==================================== */

body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

body.no-sidebar {
  justify-content: center;
  align-items: center;
}

/* ====================================
   Sidebar Styles
   ==================================== */

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark), var(--primary-color));
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.sidebar-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-bottom {
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-branding {
  padding: 20px 15px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-title {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-logo {
  display: block;
  max-width: 100px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
}

.sidebar-logo:empty {
  display: none;
}

/* ====================================
   Navigation Links
   ==================================== */

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 0;
  margin: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  border-left: 4px solid transparent;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-left-color: var(--accent-color);
}

.nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-left-color: var(--accent-color);
  font-weight: 600;
}

.nav-icon {
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
}

.nav-label {
  font-size: 14px;
  white-space: nowrap;
}

/* ====================================
   Logout Button
   ==================================== */

.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  margin: 0 10px;
  background-color: var(--danger-color);
  color: #ffffff;
  text-decoration: none;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.logout-btn:hover {
  background-color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.logout-btn .nav-label {
  flex: 1;
}

/* ====================================
   Main Content Area
   ==================================== */

main {
  margin-left: var(--sidebar-width);
  padding: 30px;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main > *:first-child {
  margin-top: 0;
}

/* ====================================
   Page Footer
   ==================================== */

.page-footer {
  margin-top: auto;
  padding: 20px 30px;
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

.footer-content {
  margin: 0;
  padding: 0;
}

.footer-content p {
  margin: 4px 0;
}

.footer-text {
  font-style: italic;
}

.heart {
  color: var(--danger-color);
  animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* ====================================
   Responsive: Tablet Sizes
   ==================================== */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: var(--sidebar-width-sm);
  }

  main {
    margin-left: var(--sidebar-width-sm);
    width: calc(100% - var(--sidebar-width-sm));
    padding: 20px;
  }

  .sidebar {
    width: var(--sidebar-width-sm);
  }

  .nav-label {
    display: none;
  }

  .nav-link {
    justify-content: center;
    padding: 12px;
  }

  .sidebar-branding {
    padding: 15px;
  }

  .app-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .sidebar-logo {
    max-width: 70px;
  }
}

/* ====================================
   Responsive: Mobile Sizes
   ==================================== */

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .sidebar-top {
    flex-direction: row;
    align-items: center;
    flex: 1;
  }

  .sidebar-branding {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
  }

  .app-title {
    margin: 0;
    font-size: 16px;
  }

  .sidebar-logo {
    max-width: 50px;
    display: none;
  }

  .nav-links {
    flex-direction: row;
    gap: 0;
    padding: 0;
    flex: 1;
    overflow-x: auto;
  }

  .nav-link {
    padding: 12px 15px;
    border-left: none;
    border-bottom: 4px solid transparent;
    white-space: nowrap;
  }

  .nav-link:hover,
  .nav-link.active {
    border-left: none;
    border-bottom-color: var(--accent-color);
  }

  .nav-label {
    display: inline;
  }

  .nav-icon {
    display: none;
  }

  .sidebar-bottom {
    padding: 0;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }

  .logout-btn {
    margin: 0;
    border-radius: 0;
    padding: 12px 15px;
  }

  main {
    margin-left: 0;
    width: 100%;
    padding: 15px;
    min-height: auto;
  }

  .page-footer {
    padding: 15px;
    font-size: 12px;
  }
}

/* ====================================
   Responsive: Small Mobile
   ==================================== */

@media (max-width: 480px) {
  .sidebar-branding {
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 8px;
    padding: 10px;
  }

  .app-title {
    font-size: 14px;
  }

  .nav-links {
    overflow-x: auto;
    width: 100%;
  }

  .nav-link {
    padding: 10px 12px;
    font-size: 13px;
  }

  main {
    padding: 12px;
  }

  .page-footer {
    padding: 12px;
  }
}

/* ====================================
   Login & No-Sidebar Pages
   ==================================== */

body.no-sidebar main,
.login-container,
.reset-container {
  margin-left: 0;
  width: 100%;
}

/* ====================================
   Scrollbar Styling
   ==================================== */

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ====================================
   Print Styles
   ==================================== */

@media print {
  .sidebar,
  .page-footer,
  .logout-btn {
    display: none;
  }

  main {
    margin-left: 0;
    width: 100%;
    padding: 0;
  }

  body {
    background-color: var(--white);
  }
}
