@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@700&family=Libre+Franklin:wght@400&display=swap');

:root {
  --color-background: #f4f4ed;
  --color-surface: #dcdcdb;
  --color-dark: #606162;
  --color-accent: #a0a0f0;
  --color-accent-alt: #8a8ac8;
  --color-text: #434445; /* we can tweak later if you want a softer dark */
  --font-heading: 'Libre Baskerville', serif;
  --font-body: 'Libre Franklin', sans-serif;
  --font-bttn: 'Libre Franklin Bold', sans-serif;

}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  display: flex; /* makes children (sidebar and main) line up horizontally */
  height: 100vh; /* full viewport height */
  margin: 0px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

/* Sidebar styling */
#sidebar {
  min-width: 220px; /* fixed width sidebar */
  max-width: 270px;
  height: auto;
  background-color: var(--color-background);
  padding: 2rem;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

#sidebarContent{
    margin: 2rem 1rem;
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
}

/* Drop zone container */
#dropZone {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;

  aspect-ratio: 1 / 1;
  margin: 2rem auto;
  padding: 2rem;

  background-color: var(--color-surface);
  border: 2px dashed var(--color-accent);
  border-radius: 12px;

  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}
#dropZone:hover,
#dropZone:focus,
#dropZone.dragover {
  background-color: rgba(160, 160, 240, 0.15);
  border-color: var(--color-dark);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
#dropZone:focus {
  outline: none;
}
#dropZone p {
  color: var(--color-dark);
  font-size: 1rem;
  margin-top: 0.5rem;
}
#dropZone svg {
  width: 48px;
  height: 48px;
  fill: var(--color-accent);
  transition: fill 0.3s ease;
}
#dropZone:hover svg,
#dropZone.dragover svg {
  fill: var(--color-dark);
}

#controls{
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 2rem;
}


/* Main content area */
#main {
  flex: 1; /* take up all remaining space */
  display: flex;
  flex-direction: column;
    margin: 2rem clamp(1rem, 4vw, 2rem);
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

#main h1{
    display: none;
}

#canvasContainer {
    aspect-ratio: 1/1;
    position: relative;
    background-color:var(--color-surface);
    border-radius: 24px;
    min-width: 50vw;
    max-width: 70vw;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    padding: 0rem 2rem;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

input[type="file"] {
      margin-bottom: 1rem;
    }

/* Base button styling */
button {
  font-family: var(--font-bttn);
  background-color: var(--color-surface);
  color: var(--color-dark);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
button:hover {
  background-color: #8f8fdf; /* slightly darker accent */
  transform: translateY(-2px);
}
button:active {
  transform: translateY(0);
}

#canvasButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Export toggle buttons */
.canvasBtn {
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-accent);
  border-radius: 6px;
  padding: 0.5rem 1rem;
}
.canvasBtn:hover {
  background-color: var(--color-accent);
  color: var(--color-surface);
}

#downloadBtn {
    font-weight: bold;
  background-color: var(--color-accent);
  color: var(--color-background);
  border-radius: 8px;
  padding: 1rem 1rem;
}
#downloadBtn:hover {
  background-color: var(--color-accent-alt);
}

/* Slider base styling */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  margin: 0.5rem 0;
  background: transparent;
}

/* WebKit track */
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: var(--color-accent);
  border-radius: 4px;
}
/* WebKit thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-accent-alt);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  margin-top: -4px; /* centers thumb on track */
  cursor: pointer;
  transition: background-color 0.2s ease;
}
input[type="range"]:hover::-webkit-slider-thumb {
  background-color: var(--color-accent);
}

/* Mozilla track */
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 8px;
  background: var(--color-accent);
  border-radius: 4px;
}
/* Mozilla thumb */
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--color-accent-alt);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
input[type="range"]:hover::-moz-range-thumb {
  background-color: var(--color-accent);
}

/* Remove focus outline and add custom focus ring */
input[type="range"]:focus {
  outline: none;
}
input[type="range"]:focus::-webkit-slider-thumb,
input[type="range"]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(160, 160, 240, 0.5);
}

.file-info {
  position: absolute;
  bottom: 0.5rem;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

/* Mobile layout adjustments */
@media (max-width: 860px) {
  /* Stack sidebar above main and hide sidebar */
  body {
      height: 100%; /* full viewport height */

    overflow-y: auto;
    flex-direction: column-reverse;
  }
  #sidebar {
    max-width: 100%;
    height: 50vh;
    justify-content: space-around;
    padding: 1rem;
  }
  #sidebar h1 {
        display: none;
    }

#sidebarContent{
    margin: 0;
    justify-content: space-around;
}

  #dropZone{
    display: none;
  }

#browseBtn{
   visibility: visible;
   padding: 1rem;
}

  /* Main content stretches full width */
  #main {
    margin: 0rem;
  }

  #main h1{
    display: block;
  }

   #main p{
    display: none;
  }

  #canvasContainer {
    min-width: auto;
    max-width: 95%;
    padding: 1rem 0rem;
  }

  /* Header (tabs) if implemented should span full width */
  #header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
  }

  /* Controls group stacks vertically and spans full width */
  #controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  #controls div {
    display: flex;
    flex-direction: column;
  }

  /* Make sliders and buttons fill width */
  input[type="range"], button, #downloadBtn {
    width: 100%;
  }

  /* Canvas toggle buttons scroll if overflow */
  #canvasButtons {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 1rem;
    gap: 0.5rem;
  }
}