/* ------------------------------------------------------------
   ExpenseTrak Shared Stylesheet
   Used by Login, Dashboard, Expenses, Reports, Settings,
   Admin, and future pages.
------------------------------------------------------------ */

/* ------------------------------------------------------------
   Base Page Styles
------------------------------------------------------------ */

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(#eef6fb, #d7eaf5);
  color: #1f2933;
}

/* ------------------------------------------------------------
   Login Page
------------------------------------------------------------ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}

.login-card h1 {
  margin: 0;
  text-align: center;
  color: #1f5f8b;
  font-size: 34px;
}

.login-subtitle {
  text-align: center;
  margin-top: 6px;
  margin-bottom: 28px;
  color: #5b6770;
}

.login-error {
  color: #b91c1c;
  margin-top: 12px;
  min-height: 20px;
  font-weight: bold;
  text-align: center;
}

/* ------------------------------------------------------------
   Shared Form Controls
------------------------------------------------------------ */

label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-weight: bold;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px;
  border: 1px solid #b9c7d3;
  border-radius: 6px;
  font-size: 15px;
  font-family: Arial, Helvetica, sans-serif;
}

textarea {
  resize: vertical;
}

button {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(#2f83b7, #1f5f8b);
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: linear-gradient(#3a91c6, #236b9c);
}

/* ------------------------------------------------------------
   Global Top Logo Header
   Created by /js/app.js inside buildAppShell().
   This logo starts at the far left of the entire browser/page,
   above both the sidebar and the main content.
------------------------------------------------------------ */

.global-logo-header {
  width: 100%;
  min-height: 100px;
  background: #ffffff;
  border-bottom: 1px solid #d8e2ea;

  display: flex;
  align-items: center;
  justify-content: flex-start;

  padding: 8px 0 8px 18px;
  box-sizing: border-box;
}

.global-logo-img {
  display: block;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: auto;
  object-fit: contain;
  margin: 0;
}

/* ------------------------------------------------------------
   Original App Shell Layout
   Used by Dashboard/Expenses/Reports/Admin pages:
   .app-shell, .sidebar, .main-area, etc.
------------------------------------------------------------ */

.app-shell {
  display: flex;
  min-height: calc(100vh - 100px);
}

/* Sidebar is dark from top to bottom */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: linear-gradient(#1f5f8b, #16496d);
  color: white;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.sidebar-logo {
  display: none !important;
}

/* If old pages still have loose nav links directly in .sidebar */
.sidebar > .nav-link,
.sidebar > .logout-button {
  margin-left: 22px;
  margin-right: 22px;
}

.nav-link {
  display: block;
  color: white;
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 6px;
  font-weight: bold;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
}

.logout-button {
  margin-top: 30px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
}

.main-area {
  flex: 1;
  background: #f3f7fa;
}

.main-content {
  flex: 1;
  background: #f3f7fa;
  padding: 28px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.top-header {
  height: 86px;
  background: white;
  border-bottom: 1px solid #d8e2ea;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 28px;
  box-sizing: border-box;
}

.top-header h1 {
  margin: 0;
  color: #1f5f8b;
}

.tenant-name {
  color: #667085;
  margin-top: 4px;
}

.user-box {
  font-weight: bold;
  color: #1f2933;
}

.page-content {
  padding: 28px;
}

/* ------------------------------------------------------------
   New Shared Dashboard Shell Layout
   Kept for any pages that may use:
   .dashboard-shell, .dashboard-sidebar, .dashboard-main
------------------------------------------------------------ */

.dashboard-shell {
  display: flex;
  min-height: calc(100vh - 100px);
  background: linear-gradient(#eef6fb, #d7eaf5);
}

/* Sidebar is dark from top to bottom */
.dashboard-sidebar {
  width: 230px;
  min-width: 230px;
  background: linear-gradient(#1f5f8b, #16496d);
  color: white;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.dashboard-main {
  flex: 1;
  background: #f3f7fa;
  padding: 28px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ------------------------------------------------------------
   Old Page Logo / Sidebar Logo Areas
   Hidden because the logo is now global at the top of the page.
------------------------------------------------------------ */

.page-top-logo,
.sidebar-logo-area,
.dashboard-logo-wrap,
.app-logo-wrap {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.page-top-logo img,
.sidebar-logo-area img,
.dashboard-logo-wrap img,
.app-logo-wrap img,
.dashboard-shell-logo,
.app-sidebar-logo,
.sidebar-logo-img {
  display: none !important;
}

/* ------------------------------------------------------------
   Shared Sidebar Navigation
------------------------------------------------------------ */

.dashboard-nav,
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 22px 22px 22px;
  box-sizing: border-box;
}

.dashboard-nav-link,
.nav-link {
  display: block;
  color: white;
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 6px;
  font-weight: bold;
}

.dashboard-nav-link:hover,
.nav-link:hover {
  background: rgba(255,255,255,0.15);
}

.dashboard-nav-link.active,
.nav-link.active {
  background: rgba(255,255,255,0.22);
}

/* ------------------------------------------------------------
   Dashboard Cards / Existing Shared Content Styles
------------------------------------------------------------ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.summary-card,
.content-card {
  background: white;
  border: 1px solid #d8e2ea;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.summary-label {
  color: #667085;
  font-weight: bold;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 30px;
  font-weight: bold;
  color: #1f5f8b;
}

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

.card-header h2 {
  margin: 0;
  color: #1f2933;
}

/* ------------------------------------------------------------
   Shared Tables
------------------------------------------------------------ */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  background: #eef6fb;
  color: #1f2933;
  padding: 10px;
  border-bottom: 1px solid #d8e2ea;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid #e5edf3;
}

/* ------------------------------------------------------------
   Shared Tab Control
   Used by Admin and future tab-style pages.
------------------------------------------------------------ */

.tab-control,
.admin-tab-control {
  display: flex;
  align-items: flex-end;
  gap: 0;
  border-bottom: 2px solid #bfd7e6;
  margin-bottom: 0;
  padding-left: 2px;
  box-sizing: border-box;
}

.tab-button,
.admin-tab {
  appearance: none;
  width: auto;
  margin: 0 6px 0 0;
  border: 1px solid #bfd7e6;
  border-bottom: none;
  background: #e9f4fa;
  color: #1f5f8b;
  font-size: 15px;
  font-weight: bold;
  padding: 13px 22px;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  position: relative;
  top: 2px;
  box-shadow: none;
}

.tab-button:hover,
.admin-tab:hover {
  background: #dceef7;
}

.tab-button.active,
.admin-tab.active {
  background: #ffffff;
  color: #123f56;
  border-color: #bfd7e6;
  border-bottom: 2px solid #ffffff;
  z-index: 2;
}

.tab-content,
.admin-tab-content {
  display: none;
}

.tab-content.active,
.admin-tab-content.active {
  display: block;
}

.tab-panel,
.admin-tab-panel {
  background: #ffffff;
  border: 1px solid #bfd7e6;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 24px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
  box-sizing: border-box;
}

/* ------------------------------------------------------------
   Admin Page Shared Styles
------------------------------------------------------------ */

.admin-page {
  width: 100%;
}

.admin-page h1 {
  margin-top: 0;
  color: #1f5f8b;
}

.admin-subtitle {
  margin: 0 0 28px 0;
  color: #40566b;
  font-size: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.admin-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(31, 95, 127, 0.14);
  border: 1px solid rgba(31, 95, 127, 0.08);
}

.admin-tab-panel .admin-card {
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

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

.admin-card h2 {
  margin: 0;
  color: #1f5f8b;
  font-size: 24px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: end;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-form-group label {
  font-size: 13px;
  font-weight: bold;
  color: #40566b;
  margin-top: 0;
  margin-bottom: 0;
}

.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid #c7d7e2;
  font-size: 14px;
  box-sizing: border-box;
  background: #ffffff;
}

.admin-button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-btn {
  width: auto;
  margin-top: 0;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  background: #1f5f8b;
  color: #ffffff;
}

.admin-btn:hover {
  background: #174b66;
}

.admin-btn.secondary {
  background: #e6f0f6;
  color: #1f5f8b;
}

.admin-btn.secondary:hover {
  background: #d6e8f2;
}

.admin-btn.danger {
  background: #b42318;
  color: #ffffff;
}

.admin-btn.danger:hover {
  background: #8f1c13;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  background: #eef6fb;
  color: #1f5f8b;
  padding: 11px;
  border-bottom: 1px solid #c7d7e2;
  white-space: nowrap;
}

.admin-table td {
  padding: 11px;
  border-bottom: 1px solid #e3edf3;
  vertical-align: middle;
  color: #1f2933;
}

.admin-table tr:hover td {
  background: #f8fbfd;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  background: #e6f0f6;
  color: #1f5f8b;
}

.admin-pill.inactive {
  background: #f1f1f1;
  color: #777;
}

.admin-status {
  margin-top: 12px;
  font-size: 14px;
  color: #40566b;
  min-height: 20px;
}

/* ------------------------------------------------------------
   Top Right User / Logout Area
------------------------------------------------------------ */

.user-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-weight: bold;
  color: #1f2933;
}

.user-logout-link {
  color: #1f5f8b;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}

.user-logout-link:hover {
  text-decoration: underline;
  color: #16496d;
}

/* Hide old sidebar logout button if any page still has it */
.sidebar .logout-button,
.dashboard-sidebar .logout-button {
  display: none !important;
}

/* ------------------------------------------------------------
   Mobile Layout
------------------------------------------------------------ */

@media (max-width: 1000px) {
  .admin-form-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 700px) {
  .global-logo-header {
    min-height: 82px;
    padding: 8px 14px;
  }

  .global-logo-img {
    width: 300px;
    max-width: calc(100vw - 28px);
  }

  .app-shell,
  .dashboard-shell {
    flex-direction: column;
    min-height: calc(100vh - 82px);
  }

  .sidebar,
  .dashboard-sidebar {
    width: 100%;
    min-width: 100%;
    min-height: auto;
  }

  .main-area,
  .dashboard-main,
  .main-content {
    width: 100%;
  }

  .dashboard-nav,
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px 18px 18px;
  }

  .dashboard-nav-link,
  .nav-link {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }

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

  .top-header {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }

  .page-content,
  .dashboard-main,
  .main-content {
    padding: 20px;
  }

  .tab-control,
  .admin-tab-control {
    overflow-x: auto;
    white-space: nowrap;
    align-items: flex-end;
  }

  .tab-button,
  .admin-tab {
    flex: 0 0 auto;
    padding: 12px 16px;
    font-size: 14px;
  }

  .tab-panel,
  .admin-tab-panel {
    padding: 18px;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------------------------------------
   FINAL OVERRIDE
   Keep this at the very bottom.
   Ensures old sidebar/page logo blocks stay hidden everywhere.
------------------------------------------------------------ */

.sidebar-logo,
.page-top-logo,
.sidebar-logo-area,
.dashboard-logo-wrap,
.app-logo-wrap {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.page-top-logo img,
.sidebar-logo-area img,
.dashboard-logo-wrap img,
.app-logo-wrap img,
.dashboard-shell-logo,
.app-sidebar-logo,
.sidebar-logo-img {
  display: none !important;
}
/* ------------------------------------------------------------
   FINAL ADMIN TAB CONTROL OVERRIDE
   Keep this at the very bottom of expensetrak.css.
   This prevents global button styling from turning tabs into
   full-width stacked buttons.
------------------------------------------------------------ */

.admin-tab-control {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  gap: 0 !important;
  border-bottom: 2px solid #bfd7e6 !important;
  margin: 0 !important;
  padding-left: 2px !important;
  box-sizing: border-box !important;
}

.admin-tab-control .admin-tab {
  width: auto !important;
  min-width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  margin: 0 6px 0 0 !important;
  padding: 13px 22px !important;

  border: 1px solid #bfd7e6 !important;
  border-bottom: none !important;
  border-radius: 10px 10px 0 0 !important;

  background: #e9f4fa !important;
  color: #1f5f8b !important;

  font-size: 15px !important;
  font-weight: bold !important;
  line-height: 1.2 !important;

  cursor: pointer !important;
  position: relative !important;
  top: 2px !important;
  box-shadow: none !important;
}

.admin-tab-control .admin-tab:hover {
  background: #dceef7 !important;
}

.admin-tab-control .admin-tab.active {
  background: #ffffff !important;
  color: #123f56 !important;
  border-color: #bfd7e6 !important;
  border-bottom: 2px solid #ffffff !important;
  z-index: 2 !important;
}

.admin-tab-panel {
  background: #ffffff !important;
  border: 1px solid #bfd7e6 !important;
  border-top: none !important;
  border-radius: 0 0 12px 12px !important;
  padding: 24px !important;
  box-shadow: 0 3px 12px rgba(0,0,0,0.06) !important;
  box-sizing: border-box !important;
}

.admin-tab-content {
  display: none !important;
}

.admin-tab-content.active {
  display: block !important;
}

.admin-tab-panel .admin-card {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* Admin buttons inside the tab content should still behave normally */
.admin-card .admin-btn {
  width: auto !important;
  margin-top: 0 !important;
}

/* Mobile: tabs can scroll sideways instead of stacking huge */
@media (max-width: 700px) {
  .admin-tab-control {
    overflow-x: auto !important;
    white-space: nowrap !important;
  }

  .admin-tab-control .admin-tab {
    flex: 0 0 auto !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }

  .admin-tab-panel {
    padding: 18px !important;
  }
}

/* ------------------------------------------------------------
   Password Management
------------------------------------------------------------ */

.password-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 22px;
  box-sizing: border-box;
  background: rgba(14, 31, 45, 0.68);
}

.password-modal-backdrop.open {
  display: flex;
}

.password-modal-card {
  width: min(440px, 100%);
  padding: 28px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
}

.password-modal-card h2 {
  margin: 0 0 10px;
  color: #1f5f8b;
}

.password-modal-card p {
  margin: 0 0 20px;
  color: #40566b;
  line-height: 1.5;
}

.password-settings-form {
  max-width: 520px;
}

.password-settings-form .admin-form-group {
  margin-bottom: 16px;
}

.password-settings-help {
  margin: 0 0 18px;
  color: #60788d;
  line-height: 1.5;
}

.password-settings-button {
  width: auto;
  min-width: 170px;
  margin-top: 4px;
}
