/* ==========================================================================
   CREAMY CUP POS
   GLOBAL UI FOUNDATION
   ========================================================================== */

/* ==========================================================================
   VARIABLES
   ========================================================================== */

:root {
  --primary-green: #16a34a;
  --light-green: #dcfce7;
  --dark-green: #15803d;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;

  --text-dark: #0f172a;
  --text-muted: #64748b;

  --border-color: #e2e8f0;

  --blue: #3b82f6;
  --blue-light: #dbeafe;

  --red: #ef4444;
  --red-light: #fee2e2;

  --amber: #f59e0b;
  --amber-light: #fef3c7;

  --purple: #8b5cf6;
  --purple-light: #f3e8ff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);

  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.12);

  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --header-height: 58px;

  --navigation-width: 300px;
}

/* ==========================================================================
   RESET
   ========================================================================== */

* {
  margin: 0;

  padding: 0;

  box-sizing: border-box;
}

html {
  min-width: 320px;

  scroll-behavior: smooth;
}

body {
  min-height: 100vh;

  background: var(--bg-main);

  color: var(--text-dark);

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;

  font-size: 14px;

  line-height: 1.5;
}

body.navigation-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */

.app-header {
  position: sticky;

  top: 0;

  z-index: 100;

  width: 100%;

  min-height: var(--header-height);

  display: grid;

  grid-template-columns:
    1fr
    minmax(240px, 1.1fr)
    1fr;

  align-items: center;

  gap: 16px;

  padding: 8px 18px;

  background: #ffffff;

  border-bottom: 1px solid var(--border-color);
}

.app-header-left {
  min-width: 0;

  display: flex;

  align-items: center;

  gap: 9px;
}

.app-header-center {
  min-width: 0;

  display: flex;

  align-items: center;

  justify-content: center;
}

.app-header-right {
  min-width: 0;

  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 10px;
}

/* ==========================================================================
   MENU BUTTON
   ========================================================================== */

.app-menu-button {
  width: 42px;

  height: 42px;

  flex: 0 0 42px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border: 0;

  border-radius: 10px;

  background: transparent;

  color: #475569;

  cursor: pointer;

  font-size: 1.2rem;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.app-menu-button:hover {
  background: #f1f5f9;

  color: var(--dark-green);
}

.app-menu-button:active {
  transform: scale(0.95);
}

.app-menu-button:focus-visible {
  outline: 2px solid var(--primary-green);

  outline-offset: 2px;
}

/* ==========================================================================
   BRAND
   ========================================================================== */

.app-brand {
  display: inline-flex;

  align-items: center;

  gap: 9px;

  min-width: 0;

  color: var(--text-dark);

  text-decoration: none;
}

.app-brand-logo {
  width: 60px;

  height: 60px;

  flex: 0 0 60px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  overflow: hidden;

  border-radius: 50%;

  color: #ffffff;

  font-size: 0.82rem;

  font-weight: 700;
}

.app-brand-logo img {
  width: 100%;

  height: 100%;

  display: block;

  padding: 2px;

  object-fit: contain;

  border-radius: 50%;
}

.app-brand-name {
  overflow: hidden;

  color: var(--text-dark);

  font-size: 0.98rem;

  font-weight: 700;

  text-overflow: ellipsis;

  white-space: nowrap;
}

/* ==========================================================================
   HEADER BACK
   ========================================================================== */

.app-back-trigger {
  width: 38px;

  height: 38px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  margin-left: 3px;

  border: 0;

  border-radius: 9px;

  background: transparent;

  color: var(--text-muted);

  cursor: pointer;

  font-size: 1rem;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.app-back-trigger:hover {
  background: #f1f5f9;

  color: var(--text-dark);
}

/* ==========================================================================
   SEARCH
   ========================================================================== */

.app-search {
  width: min(420px, 100%);

  min-height: 38px;

  display: flex;

  align-items: center;

  gap: 9px;

  padding: 0 12px;

  border: 1px solid var(--border-color);

  border-radius: 7px;

  background: #f8fafc;

  color: var(--text-muted);
}

.app-search i {
  flex: 0 0 auto;

  font-size: 0.82rem;
}

.app-search input {
  width: 100%;

  min-width: 0;

  border: 0;

  outline: 0;

  background: transparent;

  color: var(--text-dark);

  font-size: 0.78rem;
}

.app-search input::placeholder {
  color: #94a3b8;
}

.app-search:focus-within {
  border-color: var(--primary-green);

  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* ==========================================================================
   USER
   ========================================================================== */

.app-user-info {
  min-width: 0;

  display: flex;

  flex-direction: column;

  align-items: flex-end;

  line-height: 1.15;
}

.app-user-name {
  overflow: hidden;

  max-width: 180px;

  color: var(--text-dark);

  font-size: 0.78rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.app-user-role {
  margin-top: 3px;

  color: var(--text-muted);

  font-size: 0.66rem;
}

.app-user-avatar {
  width: 36px;

  height: 36px;

  flex: 0 0 36px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border-radius: 50%;

  background: var(--light-green);

  color: var(--dark-green);

  font-size: 0.82rem;

  font-weight: 700;
}

/* ==========================================================================
   FLOATING NAVIGATION OVERLAY
   ========================================================================== */

.app-navigation-overlay {
  position: fixed;

  inset: 0;

  z-index: 500;

  background: rgba(15, 23, 42, 0.38);

  backdrop-filter: blur(1.5px);

  opacity: 0;

  visibility: hidden;

  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.app-navigation-overlay.is-visible {
  opacity: 1;

  visibility: visible;

  pointer-events: auto;
}

/* ==========================================================================
   FLOATING NAVIGATION
   ========================================================================== */

.app-navigation {
  position: fixed;

  top: 10px;

  bottom: 10px;

  left: 10px;

  z-index: 600;

  width: var(--navigation-width);

  display: flex;

  flex-direction: column;

  overflow: hidden;

  border: 1px solid rgba(226, 232, 240, 0.95);

  border-radius: 14px;

  background: #ffffff;

  box-shadow: var(--shadow-lg);

  transform: translateX(calc(-100% - 24px));

  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-navigation.is-open {
  transform: translateX(0);
}

/* ==========================================================================
   NAV HEADER
   ========================================================================== */

.app-navigation-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  padding: 15px;

  border-bottom: 1px solid var(--border-color);
}

.app-navigation-brand {
  min-width: 0;

  display: flex;

  align-items: center;

  gap: 10px;
}

.app-navigation-brand-logo {
  width: 38px;

  height: 38px;

  flex: 0 0 38px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border-radius: 50%;

  background: var(--primary-green);

  color: #ffffff;

  font-size: 0.82rem;

  font-weight: 700;
}

.app-navigation-brand-text {
  min-width: 0;

  display: flex;

  flex-direction: column;
}

.app-navigation-brand-text strong {
  color: var(--text-dark);

  font-size: 0.9rem;
}

.app-navigation-brand-text span {
  margin-top: 2px;

  color: var(--text-muted);

  font-size: 0.65rem;
}

.app-navigation-close {
  width: 34px;

  height: 34px;

  flex: 0 0 34px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border: 0;

  border-radius: 8px;

  background: transparent;

  color: var(--text-muted);

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.app-navigation-close:hover {
  background: #f1f5f9;

  color: var(--text-dark);
}

/* ==========================================================================
   NAVIGATION CONTENT
   ========================================================================== */

.app-navigation-content {
  flex: 1;

  overflow-y: auto;

  padding: 12px 10px;

  scrollbar-width: thin;
}

.app-navigation-content::-webkit-scrollbar {
  width: 5px;
}

.app-navigation-content::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background: #cbd5e1;
}

/* ==========================================================================
   NAV SECTION
   ========================================================================== */

.app-nav-section {
  margin-bottom: 17px;
}

.app-nav-section-title {
  padding: 3px 9px 7px;

  color: var(--text-muted);

  font-size: 0.62rem;

  font-weight: 700;

  letter-spacing: 0.09em;
}

/* ==========================================================================
   NAV LINK
   ========================================================================== */

.app-nav-link {
  min-height: 39px;

  display: flex;

  align-items: center;

  gap: 10px;

  margin-bottom: 3px;

  padding: 8px 9px;

  border-radius: 8px;

  color: var(--text-muted);

  text-decoration: none;

  font-size: 0.79rem;

  font-weight: 600;

  transition:
    background-color 0.18s ease,
    color 0.18s ease;
}

.app-nav-link:hover {
  background: #f1f5f9;

  color: var(--text-dark);
}

.app-nav-link.active {
  background: var(--light-green);

  color: var(--dark-green);
}

.app-nav-icon {
  width: 19px;

  flex: 0 0 19px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  font-size: 0.82rem;
}

.app-nav-link.active .app-nav-icon {
  color: var(--primary-green);
}

.app-nav-label {
  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;
}

/* ==========================================================================
   LOGOUT
   ========================================================================== */

.app-navigation-footer {
  padding: 10px;

  border-top: 1px solid var(--border-color);
}

.app-navigation-footer form {
  margin: 0;
}

.app-nav-logout {
  width: 100%;

  min-height: 39px;

  display: flex;

  align-items: center;

  gap: 10px;

  padding: 8px 9px;

  border: 0;

  border-radius: 8px;

  background: transparent;

  color: var(--text-muted);

  cursor: pointer;

  font-size: 0.79rem;

  font-weight: 600;

  text-align: left;

  transition:
    background-color 0.18s ease,
    color 0.18s ease;
}

.app-nav-logout:hover {
  background: var(--red-light);

  color: var(--red);
}

/* ==========================================================================
   GLOBAL BACK BUTTON
   ========================================================================== */

.app-back-button {
  display: inline-flex;

  align-items: center;

  gap: 8px;

  min-height: 35px;

  padding: 7px 11px;

  border: 1px solid var(--border-color);

  border-radius: 7px;

  background: #ffffff;

  color: var(--text-muted);

  font-size: 0.78rem;

  font-weight: 600;

  text-decoration: none;

  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.app-back-button:hover {
  border-color: #cbd5e1;

  background: #f8fafc;

  color: var(--text-dark);
}

/* ==========================================================================
   GLOBAL UTILITIES
   ========================================================================== */

.text-muted {
  color: var(--text-muted);
}

.text-green {
  color: var(--primary-green);
}

.text-danger {
  color: var(--red);
}

.text-amber {
  color: var(--amber);
}

.text-center {
  text-align: center;
}

.font-bold {
  font-weight: 700;
}

/* ==========================================================================
   GLOBAL BUTTON
   ========================================================================== */

.btn {
  display: inline-flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  min-height: 36px;

  padding: 8px 14px;

  border: 1px solid transparent;

  border-radius: var(--radius-sm);

  font-size: 0.8rem;

  font-weight: 600;

  text-decoration: none;

  cursor: pointer;

  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-solid {
  background: var(--primary-green);

  color: #ffffff;
}

.btn-solid:hover {
  background: var(--dark-green);
}

.btn-outline {
  border-color: var(--border-color);

  background: transparent;

  color: var(--text-dark);
}

.btn-outline:hover {
  background: #f1f5f9;
}

/* ==========================================================================
   GLOBAL FORM
   ========================================================================== */

.form-label {
  display: block;

  margin-bottom: 5px;

  color: var(--text-dark);

  font-size: 0.76rem;

  font-weight: 600;
}

.form-input {
  width: 100%;

  min-height: 40px;

  padding: 8px 11px;

  border: 1px solid var(--border-color);

  border-radius: var(--radius-sm);

  outline: 0;

  background: #ffffff;

  color: var(--text-dark);

  font-size: 0.8rem;
}

.form-input:focus {
  border-color: var(--primary-green);

  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* ==========================================================================
   GLOBAL CARD
   ========================================================================== */

.app-card {
  background: var(--bg-card);

  border: 1px solid var(--border-color);

  border-radius: var(--radius-md);

  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   RESPONSIVE - TABLET
   ========================================================================== */

@media (max-width: 900px) {
  .app-header {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(180px, 1fr)
      auto;

    padding: 8px 14px;
  }

  .app-user-name {
    max-width: 120px;
  }

  .app-navigation {
    width: 290px;
  }
}

/* ==========================================================================
   RESPONSIVE - MOBILE
   ========================================================================== */

@media (max-width: 620px) {
  .app-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 8px;

    min-height: 58px;

    padding: 7px 10px;
  }

  .app-header-left {
    flex: 1;

    min-width: 0;
  }

  .app-header-center {
    display: none;
  }

  .app-header-right {
    flex: 0 0 auto;
  }

  .app-menu-button {
    width: 44px;

    height: 44px;

    flex-basis: 44px;

    font-size: 1.25rem;
  }

  .app-brand-logo {
    width: 34px;

    height: 34px;

    flex-basis: 34px;
  }

  .app-brand-name {
    font-size: 0.92rem;
  }

  .app-user-info {
    display: none;
  }

  .app-user-avatar {
    width: 34px;

    height: 34px;

    flex-basis: 34px;
  }

  .app-back-trigger {
    width: 36px;

    height: 36px;
  }

  .app-navigation {
    top: 8px;

    bottom: 8px;

    left: 8px;

    width: min(300px, calc(100vw - 16px));

    border-radius: 13px;
  }

  .app-navigation-brand-text span {
    font-size: 0.64rem;
  }

  .app-nav-link,
  .app-nav-logout {
    min-height: 42px;
  }

  .app-nav-link {
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;

    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
  }
}
