@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

:root {
  --clr-primary-400: hsl(180, 66%, 49%);
  --clr-primary-800: hsl(257, 27%, 26%);
  --clr-accent-400: hsl(0, 87%, 67%);
  --clr-neutral-300: hsl(0,15%,92%);
  --clr-neutral-400: hsl(0, 0%, 75%);
  --clr-neutral-500: hsl(257, 7%, 63%);
  --clr-neutral-600: hsl(255, 11%, 22%);
  --clr-neutral-700: hsl(260, 8%, 14%);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

img {
  display: block;
  width: 100%;
}

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px;
  position: relative;
}

/* Logo */
.logo {
  width: 128px;
}

/* Hamburger menu */
.hamburger {
  width: 30px;
  height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 10;
  opacity: 0.5;
}

.hamburger span {
  height: 4px;
  background-color: #333;
  border-radius: 2px;
  transition: 0.3s ease-in-out;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Dropdown menu - mobile style */
.dropdown-menu {
  border-radius: 12px;
  background-color: var(--clr-primary-800);
  text-align: center;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 90%;
  position: absolute;
  top: 100%;
  right: 5%;
  transform: translateY(10px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 9;
}

.dropdown-menu a {
  color: white;
  text-decoration: none;
  font-family: "Poppins", serif;
  font-weight: 600;
  font-size: 1.125rem;
  padding-bottom: 10px;
}

.dropdown-menu a:nth-child(4) {
  margin-top: 10px;
}

.dropdown-hr {
  width: 100%;
  border-color: var(--clr-neutral-700);
}

/* Sign up button in dropdown */
.sign-up {
  background-color: var(--clr-primary-400);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px;
  font-size: 1.125rem;
  cursor: pointer;
}

/* Hidden class */
.hidden {
  display: none;
}

/* ===== DESKTOP STYLES ===== */
@media (min-width: 868px) {
  .dropdown-hr{
    display: none;
  }
  header {
    justify-content: space-between;
  }

  /* Hide hamburger on desktop */
  .hamburger {
    display: none;
  }

  /* Show dropdown menu as horizontal nav */
  .dropdown-menu {
    display: flex !important;  /* override hidden */
    flex-direction: row;
    background-color: transparent;
    position: static;
    width: auto;
    padding: 0;
    gap: 40px;
    box-shadow: none;
    transform: none;
    align-items: center;
  }

  .dropdown-menu a {
    color: var(--clr-neutral-700);
    font-weight: 600;
    padding: 0;
  }

  /* Push login and signup to the right */
  .dropdown-menu a:nth-last-child(2) {
    margin-left: auto;
  }

  .sign-up {
    border-radius: 24px;
    padding: 8px 24px;
    font-size: 1rem;
  }
}

/* ===== MAIN AND OTHER ELEMENTS ===== */
main {
  background-color: var(--clr-neutral-300);
  font-family: "Poppins", Arial, Helvetica, sans-serif;
  font-size: 0.938rem;
}

.area {
  padding: 20px;
}

.info-area {
  font-size: 1.125rem;
  text-align: center;
}

.info-area h1 {
  margin-bottom: 5px;
}

.info-area p {
  margin-bottom: 15px;
  color: var(--clr-neutral-500);
}

.get-started {
  background-color: var(--clr-primary-400);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px;
  font-size: 1.125rem;
  width: 150px;
}

.info-area .get-started {
  margin-bottom: 40px;
}

.shorten-area {
  background-image: url("images/bg-shorten-mobile.svg");
  display: flex;
  flex-direction: column;
  background-color: var(--clr-primary-800);
  background-repeat: no-repeat;
  background-size: contain;
  height: 200px;
  gap: 10px;
  justify-content: center;
  background-position-x: 70px;
  border-radius: 12px;
  margin: 20px;
}

.shorten-link,
.shorten-link-input {
  height: 50px;
  border-radius: 8px;
}

.shorten-link-input {
  padding: 10px;
  color: var(--clr-neutral-500);
  font-size: 1rem;
  font-family: "Poppins";
}

.shorten-link-input::placeholder {
  color: var(--clr-neutral-400);
  font-family: "Poppins";
}

.shorten-link-input:focus {
  outline: none;
  border: none;
}

.shorten-link {
  background-color: var(--clr-primary-400);
  color: white;
  font-family: "Poppins";
  font-size: 1.2rem;
}

#shortened-links {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

.statistics-area {
  text-align: center;
  margin: 20px;
  line-height: 1.25;
  color: var(--clr-neutral-500);
}

.statistics-area > h2 {
  color: black;
  margin: 50px 0 10px 0;
}

.cards-area {
  display: grid;
  grid-auto-rows: auto;
  justify-content: center;
  gap: 6rem;  /* space between cards */
  margin-inline: 20px;
  margin-block: 50px;
  color: var(--clr-neutral-500);
  position: relative;
}

.card {
  position: relative;
  background-color: white;
  border-radius: 4px;
  padding: 4rem 2rem 2rem; /* space for top image */
  max-width: 400px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: grid;
  justify-items: center;
  text-align: center;
  z-index: 10;
}

/* Card image absolutely positioned centered on top */
.card-image {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--clr-neutral-600);
  padding: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Vertical line from bottom of card image to top of next card image */
.card:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 100%;      /* start line at bottom of card */
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 6rem;    /* equal to the gap between cards */
  background-color: var(--clr-primary-400);
  z-index: 5;
}

.card-details {
  padding: 20px;
  line-height: 1.25;
}

.card h3 {
  color: var(--clr-primary-800);
  margin-bottom: 10px;
  margin-top: -30px;
}

.boost-area {
  background-image: url("images/bg-boost-mobile.svg");
  background-color: var(--clr-primary-800);
  background-repeat: no-repeat;
  background-size: contain;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.boost-area > h1 {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 15px;
}

footer {
  color: white;
  background-color: var(--clr-neutral-700);
  align-items: center;
  display: flex;
  flex-direction: column;
  text-align: center;
}

footer > h2 {
  padding: 40px;
}

.footer-nav {
  list-style-type: none;
}

.footer-nav-item {
  opacity: 0.7;
  line-height: 1.75;
}

.footer-nav-item:first-child {
  font-weight: 700;
  opacity: 1;
  margin-bottom: 15px;
}

.footer-nav-item:last-child {
  margin-bottom: 15px;
}

.socials-list {
  margin: 15px 0 30px 0;
  display: flex;
  gap: 20px;
  list-style: none;
}

/* LINKS CARD */
.hidden {
  display: none;
}

.original-url,
.shortened-url {
  margin-right: 10px; /* gap between URL and remove button */
  word-break: break-word;
  text-decoration: none;
}

.original-url {
  color: var(--clr-primary-800);
  font-weight: 600;
  
}

.shortened-url {
  color: var(--clr-primary-400);
  font-weight: 500;
  margin: 15px 0px;
  display: inline-block; /* By default anchor tags are inline so margins wont apply properly unless inline-block or block. */
}

.copy-btn {
  background-color: var(--clr-primary-400);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  align-self: flex-start;
  width: 100%;
}

.copy-btn.copied {
  background-color: var(--clr-primary-800);
}

#shortened-links {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

.links-card {
  position: relative;
  padding: 20px;
  border-radius: 8px;
  background-color: white;
  width: 100%;        /* full width on mobile */
  max-width: 100%;    /* no wider than container */
  height: auto;       /* let height adjust naturally */
  font-family: Arial, sans-serif;
  color: var(--clr-primary-800);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  overflow: hidden;
  margin: 20px 0px;      /* vertical spacing between cards */
  box-sizing: border-box;
}

/* For tablets and above, limit width */
@media (min-width: 600px) {
  .links-card {

  }
}

.url-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.remove-btn {
  background-color: var(--clr-primary-400);
  border: none;
  color: white;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.remove-btn:hover {
  background-color: var(--clr-primary-800);
  color: white;
}

.link-error{
  color: var(--clr-accent-400);
  font-style: italic;
  font-size: 0.895rem;
}