$body-bg: #efeeda;
$input-bg: rgba(255, 255, 0, 0.3);
$input-bg-hover: rgba(255, 255, 0, 0.4);
$box-shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
$box-shadow-medium: 0 6px 8px rgba(0, 0, 0, 0.2);
$font-size-input: 14px;
$border-radius-input: 4px;
$new-note-bg: rgba(255, 255, 0, 0.5);

body {
  font-family: 'Open Sans', sans-serif;
  padding: 10px;
  background-color: $body-bg;
}

#header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;

  input {
    flex: 1;
    padding: 8px;
    font-size: $font-size-input;
  }
}

#global-reminder {
  flex: 1;
  padding: 10px;
  font-size: $font-size-input;
  border: none;
  border-radius: 10px;
  background-color: $input-bg;
  backdrop-filter: blur(10px);
  box-shadow: $box-shadow-light;
  outline: none;
  transition: all 0.3s ease;

  &:hover,
  &:focus {
    background-color: $input-bg-hover;
    box-shadow: $box-shadow-medium;
  }
}

#search-container {
  flex: 1;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 10px 35px 10px 10px;
  font-size: $font-size-input;
  border: none;
  border-radius: 10px;
  background-color: $input-bg;
  backdrop-filter: blur(10px);
  box-shadow: $box-shadow-light;
  outline: none;
  transition: all 0.3s ease;
  box-sizing: border-box;

  &:hover,
  &:focus {
    background-color: $input-bg-hover;
    box-shadow: $box-shadow-medium;
  }
}

#search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;

  &:hover {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    border-color: rgba(0, 0, 0, 0.2);
  }

  &:active {
    transform: translateY(-50%) scale(0.9);
    background-color: rgba(255, 255, 255, 1);
  }
}

#notes-container {
  position: relative;
  min-height: calc(100vh - 100px);
  width: 100%;
}

/* Note card styling */
.note {
  min-width: 330px;
  min-height: 280px;
  box-sizing: border-box;
  background-color: #fffab3;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  position: absolute;
  transition: box-shadow 0.2s ease;
  resize: both;
  overflow: auto;
  cursor: move;
  
  &.dragging {
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    transform: rotate(2deg);
    opacity: 0.9;
  }
  
  // Resize handle styling
  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: linear-gradient(-45deg, transparent 30%, rgba(0,0,0,0.1) 30%, rgba(0,0,0,0.1) 70%, transparent 70%);
    cursor: se-resize;
    pointer-events: auto;
  }

  &:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .delete-button {
    position: absolute;
    right: 8px;
    top: 8px;
    cursor: pointer;
    color: black;
    font-size: 16px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
  }

  .note-title {
    width: 100%;
    font-size: 18px;
    font-weight: bold;
    padding: 5px;
    border: none;
    background-color: transparent;

    &:focus {
      outline: none;
    }
  }

  .note-tags {
    width: 100%;
    font-size: 12px;
    padding: 3px 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-bottom: 5px;
    color: #666;

    &:focus {
      outline: none;
      background-color: rgba(255, 255, 255, 0.5);
    }

    &::placeholder {
      color: #999;
      font-style: italic;
    }
  }

  .tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;

    .tag {
      background-color: #4CAF50;
      color: white;
      padding: 2px 6px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: bold;
      display: inline-block;
    }
  }

  .reminder-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;

    .reminder-label {
      font-size: 14px;
      color: #666;
    }

    .note-reminder {
      flex: 1;
      font-size: 11px;
      padding: 2px 4px;
      border: 1px solid #ddd;
      border-radius: 3px;
      background-color: rgba(255, 255, 255, 0.7);

      &:focus {
        outline: none;
        border-color: #007bff;
        background-color: rgba(255, 255, 255, 0.9);
      }

      &:not(:placeholder-shown) {
        background-color: #fff3cd;
        border-color: #ffc107;
      }
    }
  }

  .created {
    font-size: 10px;
    color: #777;
    margin-bottom: 3px;
  }

  textarea {
    flex-grow: 1;
    width: 100%;
    border: none;
    resize: none;
    background-color: transparent;
    font-size: 14px;
    outline: none;
    transition: filter 0.3s ease;
  }

  .preview {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px;
    background-color: transparent;
    border: none;
  }
}


/* Utility class to hide elements */
.hidden {
  display: none !important;
}

/* Content container */
.content-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Button container styling */
.button-container {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.toggle-button {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;

  img {
    width: 20px;
    height: 20px;
  }
}

/* Fixed button styles */
#new-note {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: $new-note-bg;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

#menu-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;

  img {
    width: 30px;
    height: 30px;
  }
}

/* Side menu styling */
#side-menu {
  position: fixed;
  bottom: 15%;
  right: -30%;
  width: 30%;
  background-color: #f9f9c6;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
  transition: right 0.3s ease-in-out;
  z-index: 1100;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 2rem;
}

/* When side menu is open */
#side-menu.open {
  right: 0;
}

/* Side menu internal button/link styling */
#side-menu button,
#side-menu a {
  margin: 10px 0;
  height: 40px;
  border: none;
  cursor: pointer;
  background-color: transparent;

  img {
    width: 100%;
    height: 100%;
  }
}
