/*
 * Common application styles
 */


/* =========================================
   Base
   ========================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: #252525;
  background: #f4f5f5;
}


/* =========================================
   Reusable Card
   ========================================= */

.card {
  background: #ffffff;
  border: 1px solid #e0ddd6;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}


/* =========================================
   Reusable Form
   ========================================= */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;

  font-size: 14px;
  font-weight: 600;
}

.form-input {
  width: 100%;
  height: 42px;

  padding: 0 12px;

  border: 1px solid #d8d8d4;
  border-radius: 7px;

  background: #ffffff;

  font-size: 14px;

  outline: none;
}

.form-input:focus {
  border-color: #777;
}

.form-input::placeholder {
  color: #aaa;
}


/* =========================================
   Reusable Buttons
   ========================================= */

.btn {
  border: 0;

  cursor: pointer;

  font-size: 14px;
  font-weight: 500;
}

.btn-primary {
  padding: 12px 20px;

  border-radius: 8px;

  background: #a96d7e;
  color: #ffffff;
}

.btn-primary:hover {
  background: #955d6e;
}


/* =========================================
   Flash Messages
   ========================================= */

.flash {
  padding: 12px 16px;

  border-radius: 8px;

  font-size: 14px;
}

.flash-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;

  color: #b42318;
}

.flash-success {
  background: #ecfdf3;
  border: 1px solid #a7f3d0;

  color: #166534;
}


/* =========================================
   Portal Layout
   ========================================= */

.portal-layout {
  min-height: 100vh;

  display: flex;

  background: #f4f5f5;
}


/* =========================================
   Sidebar
   ========================================= */

.sidebar {
  position: fixed;

  top: 0;
  left: 0;

  width: 250px;
  min-width: 250px;
  height: 100vh;

  display: flex;
  flex-direction: column;

  background: #a96d7e;
  color: #ffffff;

  z-index: 1100;

  transition:
    width 0.25s ease,
    min-width 0.25s ease;
}


/* =========================================
   Sidebar Brand / Toggle
   ========================================= */

.sidebar-brand {
  width: 100%;
  height: 72px;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 0 20px;

  border: 0;

  background: transparent;
  color: #ffffff;

  cursor: pointer;

  text-align: left;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;

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

  flex-shrink: 0;

  border-radius: 8px;

  background: #ffffff;
  color: #292929;

  font-size: 14px;
  font-weight: 700;
}

.sidebar-brand-text {
  font-size: 18px;
  font-weight: 700;
}


/* =========================================
   Sidebar Navigation
   ========================================= */

.sidebar-navigation {
  flex: 1;

  padding: 20px 12px;
}

.sidebar-link {
  height: 46px;

  display: flex;
  align-items: center;

  gap: 14px;

  padding: 0 14px;

  margin-bottom: 5px;

  border-radius: 9px;

  color: #ffffff;

  text-decoration: none;

  font-size: 13px;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.sidebar-link:hover {
  background: #985f70;
  color: #ffffff;
}

.sidebar-link.active {
  background: #ffffff;
  color: #a96d7e;
  font-weight: 600;
}

.sidebar-icon {
  width: 20px;

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

  flex-shrink: 0;

  font-size: 16px;
}

.sidebar-link-text {
  white-space: nowrap;
}


/* =========================================
   Sidebar Bottom
   ========================================= */

.sidebar-bottom {
  padding: 15px 12px 20px;

  border-top: 1px solid #3e3e3e;
}

.sidebar-user {
  display: flex;
  align-items: center;

  gap: 10px;

  padding: 8px 10px 14px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;

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

  flex-shrink: 0;

  border-radius: 50%;

  background: #ffffff;
  color: #292929;

  font-size: 13px;
  font-weight: 700;
}

.sidebar-user-info {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 3px;
}

.sidebar-user-info strong {
  color: #ffffff;

  font-size: 11px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-info span {
  color: #F8F8F8;
  opacity: 0.9;
  font-size: 12px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================
   Logout
   ========================================= */

.sidebar-logout {
  width: 100%;
  height: 44px;

  display: flex;
  align-items: center;

  gap: 14px;

  padding: 0 14px;

  border: 0;
  border-radius: 9px;

  background: transparent;

  color: #ffffff;

  font-size: 13px;

  cursor: pointer;

  text-align: left;
}

.sidebar-logout:hover {
  background: #985f70;
  color: #ffffff;
}


/* =========================================
   Main Content
   ========================================= */

.portal-main {
  width: calc(100% - 250px);
  min-height: 100vh;
  background: #f4eaee;

  margin-left: 250px;

  transition:
    width 0.25s ease,
    margin-left 0.25s ease;
}


/* =========================================
   Collapsed Sidebar
   ========================================= */

body.sidebar-collapsed .sidebar {
  width: 72px;
  min-width: 72px;
}

body.sidebar-collapsed .portal-main {
  width: calc(100% - 72px);

  margin-left: 72px;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;

  padding: 0;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .sidebar-user-info {
  display: none;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;

  padding: 0;
}

body.sidebar-collapsed .sidebar-user {
  justify-content: center;

  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar-logout {
  justify-content: center;

  padding: 0;
}


/* =========================================
   Portal Container
   ========================================= */

.portal-container {
  width: 100%;
  min-height: 100vh;

  padding: 32px 36px;

  background: #f4eaee;
}


/* =========================================
   Page Header
   ========================================= */

.portal-page-header {
  width: 100%;

  margin-bottom: 24px;
}

.portal-page-header h1 {
  margin: 0;

  font-size: 28px;
  font-weight: 600;

  color: #252525;
}

.portal-page-header p {
  margin: 6px 0 0;

  color: #737373;

  font-size: 13px;
}


/* =========================================
   Page Content
   ========================================= */

.portal-page-content {
  width: 100%;
}


/* =========================================
   Reusable Content Card
   ========================================= */

.content-card {
  width: 100%;

  padding: 28px;

  background: #ffffff;

  border: 1px solid #e1e1dc;
  border-radius: 16px;

  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.04);
}


/* =========================================
   Mobile Header
   ========================================= */

.mobile-header {
  display: none;
}


/* =========================================
   Sidebar Overlay
   ========================================= */

.sidebar-overlay {
  display: none;
}


/* =========================================
   Mobile
   ========================================= */

@media (max-width: 768px) {

  .mobile-header {
    position: fixed;

    top: 0;
    left: 0;
    right: 0;

    width: 100%;
    height: 60px;

    display: flex;
    align-items: center;

    padding: 0 16px;

    background: #a96d7e;
    color: #ffffff;

    z-index: 1200;
  }


  .mobile-menu-button {
    width: 36px;
    height: 36px;

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

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #ffffff;

    font-size: 22px;

    cursor: pointer;
  }


  .mobile-brand {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-left: 8px;

    font-size: 16px;
    font-weight: 700;
  }


  .mobile-brand-icon {
    width: 28px;
    height: 28px;

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

    border-radius: 7px;

    background: #ffffff;
    color: #292929;

    font-size: 12px;
    font-weight: 700;
  }


  /* Sidebar */

  .sidebar {
    position: fixed;

    top: 0;
    left: 0;

    width: 250px !important;
    min-width: 250px !important;
    height: 100vh;

    transform: translateX(-100%);

    transition: transform 0.25s ease;

    z-index: 1300;
  }


  .sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }


  /* Overlay */

  .sidebar-overlay {
    display: none;

    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.45);

    z-index: 1250;
  }


  body.sidebar-mobile-open .sidebar-overlay {
    display: block;
  }


  /* Main */

  .portal-main {
    width: 100% !important;

    margin-left: 0 !important;

    padding-top: 60px;
  }


  .portal-container {
    width: 100%;

    min-height: calc(100vh - 60px);

    padding: 20px 16px;
  }


  /* Important:
     Mobile should NEVER use
     desktop collapsed sidebar.
  */

  body.sidebar-collapsed .sidebar {
    width: 250px !important;
    min-width: 250px !important;

    transform: translateX(-100%);
  }


  body.sidebar-collapsed.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }


  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-link-text,
  body.sidebar-collapsed .sidebar-user-info {
    display: block;
  }


  body.sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;

    padding: 0 20px;
  }


  body.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;

    padding: 0 14px;
  }


  body.sidebar-mobile-open {
    overflow: hidden;
  }

}

@media (max-width: 768px) {

  .sidebar {
    position: fixed !important;

    top: 0 !important;
    left: 0 !important;

    width: 250px !important;
    min-width: 250px !important;
    height: 100vh !important;

    transform: translate3d(-100%, 0, 0) !important;

    z-index: 1300 !important;
  }


  body.sidebar-mobile-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
  }


  .mobile-header {
    position: fixed !important;

    top: 0 !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;
    height: 60px !important;

    z-index: 1200 !important;
  }


  .portal-main {
    width: 100% !important;
    margin-left: 0 !important;

    padding-top: 60px !important;
  }


  .sidebar-overlay {
    display: none;

    position: fixed !important;

    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    z-index: 1250 !important;

    background: rgba(0, 0, 0, 0.45);
  }


  body.sidebar-mobile-open .sidebar-overlay {
    display: block !important;
  }

}