:root {
  /* --primary-blue: #2563eb;
  --primary-green: #10b981;
  --primary-bckgr-green: #ecfdf5;
  --primary-bckgr-blue: #e8effa;
  --gray-border: #d1d5db;
  --label-color: #1a1b1f;

  --button-blue: #cbddfa;
  --darkMode-bckgr-navy: #0f172a; */

  /* We'll use a deep navy for text to make it pop against the background */
  --label-color: #0f172a;

  /* A slightly more professional blue and green */
  --primary-blue: #2563eb;
  --primary-green: #059669; /* Darkened slightly for better visibility */

  /* CRITICAL CHANGE: We're making these much lighter so the black text stands out */
  --primary-bckgr-green: #f0fdf4;
  --primary-bckgr-blue: #eff6ff;

  /* Borders need to be a bit darker to define the boxes on mobile */
  --gray-border: #cbd5e1;

  --button-blue: #bfdbfe;
  --darkMode-bckgr-navy: #0f172a;
}

body {
  font-family: "Poppins", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  background-color: #f1f5f9;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h3 {
  text-align: center;
  margin: 15px 0 5px 0;
  color: var(--primary-green);
  font-weight: 300;
}

.form-container {
  width: 100%;
  max-width: 360px;
  font-size: 16px;
}

/* .hidden {
  visibility: hidden;
  transform: translate(calc(-100% - 290px));
} */

.input-group {
  position: relative;
  margin-top: 24px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 320px;
}

.input-group input {
  width: 100%;
  padding: 16px 12px 8px;
  border: 1px solid var(--gray-border);
  border-radius: 12px;
  font-size: 18px;
  outline: none;
  transition: all 0.2s ease;
  background: var(--primary-bckgr-green);
  color: black;
}

.input-group label {
  position: absolute;
  left: 12px;
  top: 14px;
  color: var(--label-color);
  font-size: 16px;
  transition: all 0.2s ease;
  pointer-events: none;
  background: var(--primary-bckgr-green);
  padding: 0 4px;
}

/* Floating Animation: Trigger on Focus or when not empty */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: -8px; /* Moves the label above the top border*/
  left: 10px;
  font-size: 12px;
  color: var(--primary-green);

  font-weight: 700; /* Increased from 600 for mobile clarity */
  background: white; /* This "cuts" the border so the label is super clear */
}

.input-group input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.exp-group {
  position: relative;
  margin-top: 25px;
  margin-bottom: 15px;
  width: 100%;
  max-width: 220px;
}

.exp-group input {
  width: 100%;
  padding: 16px 12px 8px;
  border: 1px solid var(--gray-border);
  border-radius: 12px;
  font-size: 18px;
  outline: none;
  transition: all 0.2s ease;
  background: var(--primary-bckgr-blue);
  color: black;
}
.exp-group label {
  position: absolute;
  left: 12px;
  top: 16px;
  color: var(--label-color);
  font-size: 16px;
  transition: all 0.2s ease;
  pointer-events: none;
  background: var(--primary-bckgr-blue);
  padding: 0 4px;
}
.exp-button {
  position: absolute;
  font-size: 32px;
  right: -25px;
  height: 51px;
  width: 51px;
  border-radius: 12px;
  border: none;
  background-color: var(--button-blue);
  top: 50%;
  transform: translateY(-50%);
}

.exp-group input:focus + label,
.exp-group input:not(:placeholder-shown) + label {
  top: -8px; /* Moves the label above the top border*/
  left: 10px;
  font-size: 12px;
  color: var(--primary-blue);
  font-weight: 600;
}

.exp-group input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

ul {
  width: 100%;
  max-width: 320px;
  list-style-type: none;
  padding: 0;
  margin: 0;
}

li {
  text-align: right;
}

.exp-btn {
  height: 100%;
  margin-right: 20px;
  background: transparent;
  border: 2px solid var(--primary-bckgr-blue);
  border-radius: 12px;
}

i.bi {
  pointer-events: none; /* this make the button event listner work*/
  color: rgb(255, 102, 102);
  font-size: 16px;
}

.results {
  width: 100%;
  display: flex; /* Makes the direct children flex items arranged in a row */
  justify-content: space-between; /* Optional: Distributes space evenly between the items (pushing one to the far right) */
  align-items: center; /* Optional: Aligns items vertically in the center */
  max-width: 320px;
}

#expense-list {
  margin-top: 20px;
}
#net-sales {
  border-bottom: 1px solid #000;
  padding-bottom: 2px; /* Small space between text and line */
  display: inline-block; /* Allows width customization */
  padding-left: 3px; /* Extends line slightly left */
  padding-right: 3px; /* Extends line slightly right */
}
#net-cash {
  border-bottom: 1px solid #000;
  padding-bottom: 2px; /* Small space between text and line */
  display: inline-block; /* Allows width customization */
  padding-left: 3px; /* Extends line slightly left */
  padding-right: 3px; /* Extends line slightly right */
}
#total-drawer {
  border-bottom: 3px double #000;
  padding-bottom: 1px;
  display: inline-block;
  padding-left: 4px;
  padding-right: 4px;
}

.difference {
  margin-top: 20px;
}

.keypad-container {
  /* width: 100%;
  margin: 0 auto;*/
  display: none;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 768px) {
  /* 1. Freeze the background so only the form moves */
  html,
  body {
    height: 100dvh; /* Dynamic Viewport Height */
    width: 100vw;
    overflow: hidden; /* This kills the horizontal scroll globally */
    margin: 0;
    padding: 0;
    display: block;
    background-color: #f1f5f9; /* Your background color */
  }

  .form-container {
    width: 100%;
    /* Start at full height */
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 20px 40px 20px;
    /* Smoothly adjust height when keypad pops up */
    /* transition: height 0.3s ease; */

    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Helps with 'stuttery' scrolling on iPhones */
    -webkit-overflow-scrolling: touch;
  }

  /* When keypad is active, shrink the form to make room */
  body.keypad-open .form-container {
    height: calc(100dvh - 246.5px);
    padding-bottom: 60px;
  }

  /* Ensure your results bars still span the width */
  .results {
    width: 100%;
    max-width: 320px;
  }

  .keypad-container {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 246.5px;
    z-index: 9999;
    background: white;

    /* THE GHOST LOGIC: Keypad is invisible and unclickable by default */
    visibility: hidden;
    pointer-events: none;

    /* transition:
      transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
      visibility 0.3s;
    transform: translateY(100%); */

    /* THE EXIT ANIMATION: 
       This cubic-bezier creates a "pull back" or "slight raise" 
       before it drops down. */
    transform: translateY(100%);
    transition:
      transform 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045),
      visibility 0.4s;
  }

  .keypad-container.active {
    /* THE GHOST LOGIC: Keypad becomes a real, clickable object */
    visibility: visible;
    pointer-events: auto;

    /* THE ENTRANCE ANIMATION:
       This is your original "Bounce" timing. */
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .input-group {
    margin-top: 18px;
    margin-bottom: 15px;
    padding: 4px 4px 4px;
    height: 20px;
  }

  .input-group input {
    width: 100%;
    height: 80%;
    padding: 8px 8px 8px;
  }

  .input-group label {
    position: absolute;
    left: 20px;
    top: 12px;
    color: var(--label-color);
    font-size: 16px;
    transition: all 0.2s ease;
    pointer-events: none;
    background: var(--primary-bckgr-green);
    padding: 0 4px;
  }

  /* Floating Animation: Trigger on Focus or when not empty */
  .input-group input:focus + label,
  .input-group input:not(:placeholder-shown) + label {
    top: -6px; /* Moves the label above the top border*/
    left: 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
  }

  .exp-group {
    width: 100%; /* Full width for mobile */
    text-align: center; /* Center horizontally */
    padding: 4px 0; /* Small padding for touch space */
    background: #f5f5f5;
  }

  .exp-group input {
    width: 100%;
    height: 100%;
    padding: 16px 8px 8px;
    box-sizing: border-box;
    display: inline-block; /* Allow horizontal centering */
    vertical-align: middle; /* Align with other inline elements */
    height: 28px; /* Small height for mobile */
    font-size: 16px; /* Readable text size */
    padding: 2px 6px; /* Minimal padding */
    border: 1px solid #ccc;
    border-radius: 4px;
  }
  .exp-group label {
    left: 20px;
    top: 5px;
    padding: 0px 4px;
  }
  .exp-button {
    font-size: 18px;
    right: 0px;
    height: 26px;
    width: 26px;
    border-radius: 4px;
  }
  i.bi {
    font-size: 16px;
  }
  .difference {
    margin-top: 10px;
  }
}

.keypad {
  background: #ffffff;
  margin: auto;
  position: relative;
  width: 300px;
  margin-top: 2em;
  margin-bottom: 2em;
  overflow: hidden;
  border-radius: 5px;
  transition: all 0.25s ease;
  box-shadow: 0 0 40px 0px rgba(0, 0, 0, 0.3);
}

.funcKeys {
  display: flex;
  width: 100%;
}
.funcKeys > button {
  flex: 1;
  aspect-ratio: 4;
  border-radius: 5px;
  font-size: 1.25rem;
  border-color: var(--gray-border);
}

.numpad {
  display: grid;
  grid-gap: 0px;
  grid-template-columns: repeat(3, 1fr);
}

.num {
  width: 100%;
  aspect-ratio: 3;
  border-radius: 12px;
  font-size: 1.25rem;
  border-color: rgba(from var(--primary-green) r g b / 0.1);

  /* The inner shadow effect */
  box-shadow:
    inset 5px 5px 25px 1px rgba(from var(--primary-green) r g b / 0.1),
    inset -5px -5px 25px 1px rgba(from var(--primary-green) r g b / 0.1); /*Adjust values as needed*/
}
.num:active {
  box-shadow:
    inset 5px 5px 5px 15px rgba(from var(--primary-blue) r g b / 0.1),
    inset -5px -5px 5px 15px rgba(from var(--primary-blue) r g b / 0.1);
}
/* .num:nth-child(10) {
  grid-column: 2;
}
.num:nth-child(11) {
  grid-column: 3;
} */
.period {
  font-weight: 900;
}

.mode-toggle {
  font-size: 0.8rem;
  font-weight: bold;
  background-color: #e2e8f0; /* Default light gray */
  transition: all 0.2s ease;
}

/* Style for when Add Mode is active */
.mode-toggle.active-mode {
  background-color: var(--button-blue); /* Blue background */

  /* border-color: #2563eb; */
  border: none;
}

.num:active,
#clear:active,
#backB:active,
.mode-toggle:active {
  background-color: var(--primary-bckgr-blue);
  transform: scale(0.92); /* Shrinks the button slightly when pressed */
  transition: transform 0.05s linear; /* Makes it feel instant */
}

input,
button,
select,
textarea {
  font-family: inherit;
}
