@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;

    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;

    --primary: 222.2 47.4% 11.2%; /* Primary for light mode (dark text) */
    --primary-foreground: 210 40% 98%; /* Foreground for light mode primary (light text) */

    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 217.2 32.6% 17.5%;

    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;

    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;

    --global-radius: 20px; /* Replaced --radius */
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;

    --primary: 210 40% 98%; /* Primary for dark mode (light text/elements) */
    --primary-foreground: 222.2 47.4% 11.2%; /* Foreground for dark mode primary (dark text) */

    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 210 40% 96.1%;

    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62.8% 30.6%; /* Destructive for dark mode (e.g. a less intense red) */
    --destructive-foreground: 210 40% 98%; /* Text on destructive elements */

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 215 20.2% 65.1%;
  }
}

/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden; /* Prevent horizontal scroll from shapes */
}

/* Layout & Main Container (Glassmorphism) */
#mainContainer {
    width: 100%;
    max-width: 600px;
    margin: 20px;
}

#cardContainer {
    /* Glassmorphism for .dark theme. --card for dark is 222.2 84% 4.9% (approx rgb(21,20,25)) */
    /* --border for dark is 217.2 32.6% 17.5% (approx rgb(35,42,49)) */
    background-color: rgba(21, 20, 25, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(35, 42, 49, 0.5);
    border-radius: var(--global-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: hsl(var(--card-foreground));
    position: relative;
    z-index: 1;
}

#cardHeader {
    padding: 24px;
    border-bottom: 1px solid hsl(var(--border));
}

#cardContent {
    padding: 24px;
}
#cardContent > * + * {
    margin-top: 24px;
}

/* Typography */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: hsl(var(--primary)); /* This will be light in dark mode */
}

h3 { /* For "Transkription" title */
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--card-foreground)); /* General card foreground color */
}
p {
    color: hsl(var(--muted-foreground));
}
#transcriptionResult {
    color: hsl(var(--muted-foreground));
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 60px;
}

/* Buttons */
button {
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--global-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#startButton {
    background-color: hsl(var(--primary)); /* Light in dark mode */
    color: hsl(var(--primary-foreground)); /* Dark in dark mode */
}
#startButton:hover:not(:disabled) {
    background-color: hsl(210, 40%, 90%);
}
#stopButton {
    background-color: hsl(var(--destructive)); /* Dark mode destructive */
    color: hsl(var(--destructive-foreground)); /* Light text */
}
#stopButton:hover:not(:disabled) {
    background-color: hsl(0, 62.8%, 25.6%);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.remove-file-button { /* Class for dynamically added button */
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    padding: 8px 12px;
    margin-top: 10px;
}
.remove-file-button:hover {
     background-color: hsl(0, 62.8%, 25.6%); /* Same as stopButton hover */
}

/* Flex container for main buttons */
#cardContent > div:has(#startButton) {
    display: flex;
    gap: 16px;
}
#cardContent > div:has(#startButton) > button {
    flex: 1;
}

/* Progress Bars */
#progressContainer {
    height: 8px;
    width: 100%;
    border-radius: 9999px;
    background-color: hsl(var(--muted));
    overflow: hidden;
}
#progressBar {
    height: 100%;
    border-radius: 9999px;
    background-color: hsl(var(--primary)); /* Light in dark mode */
    transition: width 0.15s ease-linear;
    width: 0%;
}
#uploadProgressBarContainer {
    height: 8px;
    width: 100%;
    border-radius: 9999px;
    background-color: hsl(var(--muted));
    overflow: hidden;
    margin-top: 8px;
    display: none;
}
#uploadProgressBar {
    height: 100%;
    border-radius: 9999px;
    background-color: hsl(var(--primary)); /* Light in dark mode */
    transition: width 0.15s ease-linear;
    width: 0%;
}

/* Other Elements */
#timeDisplay {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 8px;
    text-align: center;
}
#transcriptionCard {
    margin-top: 16px;
    border-radius: var(--global-radius);
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card)); /* Opaque, not glass */
    color: hsl(var(--card-foreground));
}
#transcriptionCard > div:first-of-type { /* Header part */
    padding: 16px;
    border-bottom: 1px solid hsl(var(--border));
}
#transcriptionCard > div:last-of-type { /* Content part */
    padding: 16px;
}

#fileInput.hidden { /* From previous HTML where it was kept */
    display: none;
}

#dropArea {
    margin-top: 16px;
    padding: 32px;
    border: 2px dashed hsl(var(--muted));
    border-radius: var(--global-radius);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
    background-color: hsl(var(--card)); /* Opaque */
}
#dropArea:hover {
    /* Primary in dark is 210 40% 98%. Use this for border with some opacity. */
    border-color: hsla(210, 40%, 98%, 0.7);
    background-color: hsl(var(--muted));
}
#dropArea.dragover {
    background-color: hsl(var(--muted)); /* Same as hover, or slightly different */
    border-color: hsl(var(--primary)); /* More prominent border, using primary color */
}
#dropArea p {
    color: hsl(var(--muted-foreground));
}
#fileInfo {
    margin-top: 8px;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}
#uploadStatus {
    margin-top: 4px;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Colorful Geometric Background Elements */
#bg-shape-circle-1, #bg-shape-rect-1, #bg-shape-tri-1, #bg-shape-circle-2, #bg-shape-rect-2 {
    position: fixed;
    z-index: 0;
    opacity: 0.2;
    pointer-events: none;
}

#bg-shape-circle-1 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #ff7e5f, #feb47b);
    border-radius: 50%;
    top: 10vh; left: 10vw;
}
#bg-shape-rect-1 {
    width: 250px; height: 400px;
    background: linear-gradient(to right, #6dd5ed, #2193b0);
    top: 50vh; left: 5vw;
    transform: rotate(15deg);
}
#bg-shape-tri-1 {
    width: 200px; height: 200px;
    background: linear-gradient(45deg, #f7971e, #ffd200);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    bottom: 15vh; right: 10vw;
}
#bg-shape-circle-2 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, #8e2de2, #4a00e0);
    border-radius: 50%;
    top: 60vh; right: 15vw;
}
#bg-shape-rect-2 {
    width: 350px; height: 200px;
    background: linear-gradient(to bottom, #00b09b, #96c93d);
    bottom: 5vh; left: 25vw;
    transform: rotate(-5deg);
}

#audioVisualizer {
  display: block; /* Ensures proper margin handling */
  width: 100%; /* Make it take full width of its container */
  /* height is set in JS: canvasElement.height = 100; */
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: var(--global-radius);
  margin-top: 16px;
  margin-bottom: 16px;
}