
/* ==============================
   GLOBAL STYLES
================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #ecfdf5;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --background: #f8fafc;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--background);
  color: var(--text);
  padding: 35px 5%;
  min-height: 100vh;
}

/* ==============================
   HEADING & BUTTON
================================ */

h1 {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 750;
  letter-spacing: -1px;
  margin-bottom: 22px;
  color: #0f172a;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 13px 25px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.25s ease;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.25);
}

button:active {
  transform: scale(0.97);
}

/* ==============================
   MAIN RESULTS LAYOUT
================================ */

.results {
  margin-top: 35px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
  gap: 22px;
}

.results > * {
  min-width: 0;
  border-radius: 16px;
  padding: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: none;
}

/* ==============================
   LOCATION INFORMATION
================================ */

.location {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.location > * {
  flex: 1 1 150px;
  text-align: center;
  padding: 11px 15px;
  border-radius: 50px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid #a7f3d0;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
  display: grid;
  place-content: center;
}

/* ==============================
   CITY INFORMATION
================================ */

.city-section {
  margin-top: 25px;
}

.city-container,
.country-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.city-container > *,
.country-container > * {
  min-width: 0;
  text-align: center;
  padding: 17px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  transition: 0.2s ease;
}

.city-container > *:hover,
.country-container > *:hover {
  border-color: #6ee7b7;
  background: var(--primary-light);
  transform: translateY(-2px);
}

.city-container p:first-child,
.country-container p:first-child {
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
  color: var(--text);
}

.label {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: capitalize;
}

/* ==============================
   COUNTRY INFORMATION
================================ */

.country-section {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px solid var(--border);
}

.country-section h2 {
  font-size: 27px;
  margin-bottom: 5px;
  color: #0f172a;
}

.country-section h2 + p {
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}

.country-section > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 18px;
}

.country-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.flag-img {
  margin-bottom: 18px;
}

.flag-img img {
  display: block;
  width: min(100%, 280px);
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* ==============================
   COUNTRY DETAILS
================================ */

.country-container {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 25px;
}

/* ==============================
   BORDER COUNTRIES
================================ */

.borders-result {
  padding-top: 24px;
}

.borders-result h3 {
  font-size: 19px;
  margin-bottom: 20px;
}

.border-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.border {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  transition: 0.25s ease;
}

.border:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  border-color: #6ee7b7;
}

.border-img {
  width: 100%;
  height: 100px;
  background: #f1f5f9;
  overflow: hidden;
}

.border-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.border > *:not(.border-img) {
  padding: 5px 10px;
  overflow-wrap: anywhere;
}

.border-name {
  font-size: 15px;
  font-weight: 700;
  padding-top: 12px !important;
}

.border-capital,
.border-subregion {
  font-size: 12px;
  color: var(--muted);
}

.border-subregion {
  padding-bottom: 12px !important;
}

button:disabled{
  opacity: 0.7;
  cursor: not-allowed;
}

/* ==============================
   TABLET RESPONSIVENESS
================================ */

@media (max-width: 1000px) {
  body {
    padding: 30px 4%;
  }

  .results {
    grid-template-columns: 1fr;
  }

  .border-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ==============================
   MOBILE RESPONSIVENESS
================================ */

@media (max-width: 600px) {
  body {
    padding: 22px 15px;
  }

  h1 {
    margin-bottom: 18px;
  }

  .results {
    margin-top: 25px;
    gap: 16px;
  }

  .results > * {
    padding: 17px;
    border-radius: 13px;
  }

  .location {
    gap: 8px;
  }

  .location > * {
    flex-basis: 100%;
  }

  .city-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .country-container {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .city-container > *,
  .country-container > * {
    padding: 14px 8px;
  }

  .country-section h2 {
    font-size: 24px;
  }

  .border-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .border-img {
    height: 85px;
  }
}

/* ==============================
   SMALL MOBILE
================================ */

@media (max-width: 360px) {
  .border-container {
    grid-template-columns: 1fr;
  }

  .border-img {
    height: 120px;
  }
}
