/* Import theme files */
@import url('themes/default.css');
@import url('themes/terminal.css');
@import url('themes/live-terminal.css');
@import url('themes/dos.css');
@import url('themes/mac1984.css');
@import url('themes/liquid-glass.css');
@import url('themes/16-segment.css');

/* Hide these elements for all other themes */
.clock-title-bar,
.stripes,
.bottom-line {
  display: none;
}

html, body {
  font-family: var(--font-family);
  background: var(--bg-color);
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* Background image support */
body.has-background .clock {
  position: relative;
  background-color: var(--bg-color);
}

body.has-background .clock::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.7;
  z-index: -1;
}

/* Enhanced text visibility for background image mode */
body.has-background .hl {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
               -1px -1px 0 rgba(0, 0, 0, 0.8),
               1px -1px 0 rgba(0, 0, 0, 0.8),
               -1px 1px 0 rgba(0, 0, 0, 0.8),
               1px 1px 0 rgba(0, 0, 0, 0.8);
}

body.has-background .ho {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
               -1px -1px 0 rgba(0, 0, 0, 0.8),
               1px -1px 0 rgba(0, 0, 0, 0.8),
               -1px 1px 0 rgba(0, 0, 0, 0.8),
               1px 1px 0 rgba(0, 0, 0, 0.8);
}

body.has-background .norm {
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.clock-container {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  min-width: 0; /* Allow container to shrink */
  padding: 1rem; /* Add some padding to prevent edge touching */
}

.clock {
  font-size: min(15vh, min(3.8rem, 3.2vw));
  width: min(95vw, 1600px);
  height: auto;
  aspect-ratio: 16 / 9;
  transform: scale(0.85);
  padding: 1.8rem 2.5rem;
  max-height: 90vh;
  background: var(--bg-color);
  border: 3px solid var(--border-color);
  border-radius: var(--border-radius);
  margin: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  box-shadow: var(--box-shadow);
  position: relative;
  transform-origin: center center;
  min-width: 0;
  flex-shrink: 1;
}

.clock::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  pointer-events: none;
  border-radius: var(--border-radius);
}

.clock ul {
  flex: 1;
  min-height: 0;
  min-width: 0; /* Allow text container to shrink */
}

@media (min-width: 1600px) {
  .clock {
    flex: 1;
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .clock {
    width: 150vw;
    transform: scale(0.80);
    padding: 1.5rem 2rem;
  }
}

@media (max-width: 400px) {
  .clock {
    width: 400vw;
    transform: scale(0.65);
    padding: 0.8rem 1.2rem;
  }
}

ul {
  height: auto;
  list-style: none;
  display: flex;
  justify-content: space-between;
  padding-inline-start: .6em;
  padding-inline-end: .6em;
  margin: 0.3rem 0;
  letter-spacing: 0.03em;
  line-height: 1.3;
  word-spacing: 0.35em;
}

ul:last-child {
  word-spacing: 0.9em;
  margin-top: 0.4rem;
}

.hl {
  color: var(--active-color);
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.4);
}

.ho {
  color: var(--special-color);
  text-shadow: 0 0 2px rgba(0, 212, 191, 0.4);
}

.norm {
  color: var(--inactive-color);
  text-shadow: 0 0 0.5px rgba(42, 42, 42, 1);
}

body.has-background .norm {
  text-shadow: 0 0 0.5px rgba(42, 42, 42, 1),
               0.5px 0.5px 1px rgba(0, 0, 0, 1);
}

/* Time Controls */
.time-controls {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  display: none;
  gap: 1rem;
  align-items: center;
  font-family: var(--font-family);
  z-index: 10;
}

.time-controls.visible {
  display: flex;
}

.time-controls input {
  background: var(--bg-color);
  color: var(--active-color);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  font-family: inherit;
  width: 8.5rem;
}

.time-controls button {
  background: var(--bg-color);
  color: var(--active-color);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
}

.time-controls button:hover {
  background: var(--active-color);
  color: var(--bg-color);
}

.time-controls label {
  color: var(--active-color);
}
