/* styles.css - responsive adjustments + bug fixes */

/* Theme variables */
:root {
  --bg: #0f1724;
  --card: #0b1220;
  --accent: #4f46e5;
  --muted: #9ca3af;
  --green: #10b981;
  --red: #ef4444;
  --text: #e6eef8;
  --gap: 14px;
  --radius: 12px;
}

/* Base reset */
* {
  box-sizing: border-box;
  font-family: Inter, system-ui, Arial, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(180deg, #071029 0%, #081025 100%);
  color: var(--text);
  padding: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 80px; /* for floating footer */
}

header {
  margin-bottom: 12px;
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.muted {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Main layout: mobile-first column stacked, switches to row at >= 880px */
.main-layout {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* left / right panels */
.left {
  flex: 1 1 auto;
}

.right {
  flex: 0 0 auto;
  width: 100%;
}

/* Video card */
.video-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.6);
}

/* Responsive video: keep aspect ratio, scalable height */
#video {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 60vh;
  background: #000;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

/* Controls - responsive layout */
.controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* control rows (labels + inputs) */
.control-row,
.server-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* make inputs flexible */
.controls input[type="number"] {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: inherit;
  width: 86px;
}

.controls input[type="text"] {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: inherit;
  min-width: 0;
  width: 100%;
}

/* Button row groups */
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.controls .btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.controls .btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
}

/* Status area */
.status {
  margin-top: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  color: var(--muted);
}

.status strong {
  color: var(--text);
}

/* History item layout - make sure content is vertically centered */

/* Space between history items */
.history {
  display: flex;
  flex-direction: column;
  gap: 14px; /* increased gap between outputs (was 8px earlier) */
  margin-top: 10px;
  padding-right: 6px;
  max-height: 56vh;
  overflow: auto;
}

/* Each item card */
.history .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 12px; /* small internal padding */
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}


/* make thumbnail fixed and no shrink */
.history .item .thumb {
  width: 92px;
  height: 60px;
  flex-shrink: 0;
}

/* meta area (title + date) */
.history .item .meta {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 8px;
}

/* pill badge: centered text, prevent wrapping */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;    /* pill width */
  height: 42px;       /* vertically align and consistent height */
  padding: 0 12px;    /* horizontal breathing room */
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap; /* keep "No Save" on one line */
  text-align: center;
  box-sizing: border-box;
}

/* colors */
.badge.ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.09);
}

.badge.warn {
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.06);
}

/* thumb responsive size */
.thumb {
  width: 88px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: #111;
  flex-shrink: 0;
}

/* meta text */
.meta {
  flex: 1 1 auto;
  min-width: 0;
}

.meta .label {
  font-weight: 600;
}

.meta .small {
  font-size: 0.85rem;
  color: var(--muted);
}

/* badges */
.badge {
  padding: 4px 6px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge.ok {
  background: rgba(16, 185, 129, 0.14);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.09);
}

.badge.warn {
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.06);
}

/* --- Footer centered below the page content --- */
.footer {
  position: relative;          /* stays in normal flow */
  bottom: 0;
  width: 100%;
  text-align: center;
  margin-top: 30px;            /* space above it */
  padding: 12px 0;
  background: linear-gradient(90deg, #1e293b, #0f172a);
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
  animation: fadeIn 1.5s ease-in-out;
}

.footer .heart {
  color: #e11d48;
  display: inline-block;
  animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
  0%, 40%, 80%, 100% { transform: scale(1); }
  20%, 60% { transform: scale(1.3); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}


/* --- Prevent overlap with page content on very small screens --- */
@media (max-width: 480px) {
  .footer {
    right: 8px;
    bottom: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}


/* Media queries - tablet & desktop */
@media (min-width: 880px) {
  .main-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 18px;
  }

  .left {
    flex: 2;
  }

  .right {
    flex: 1;
    width: 360px;
  }

  .controls input[type="text"] {
    width: 320px;
  }
}

/* smaller phones - tighten paddings */
@media (max-width: 420px) {
  body { padding: 12px; }
  .thumb { width: 72px; height: 48px; }
  .controls input[type="number"] { width: 68px; }
  header h1 { font-size: 1.25rem; }
}
