@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

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

body, h1, h2, p, textarea, input, button {
  font-family: 'Inter', sans-serif;
}

/* ===== Main Layout ===== */
body {
  font-size: 14px;
  font-weight: 400;
  background-color: #f9fafb;
  color: #111827;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  background: white;
  max-width: 720px;
  margin: 2rem auto;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  width: calc(100% - 2rem);
}

.result {
  margin-top: 0;
  margin-bottom: 0;
  background-color: lightgreen;
}

/* ===== Typography ===== */
h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #1f2937;
  text-align: center;
}

h2 {
  margin-top: 1.5rem;
  font-size: 1.25rem;
  color: #374151;
}

p {
  margin: 0.75rem 0;
  color: #4b5563;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
}

.tab {
  flex: 1;
  padding: 0.75rem 1rem;
  text-align: center;
  background-color: #eef2ff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #4338ca;
  transition: background 0.2s, color 0.2s;
}

.tab:hover {
  background-color: #e0e7ff;
}

.tab.active {
  background-color: #4f46e5;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Forms ===== */
textarea, input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
}

textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

button {
  background-color: #6366f1;
  color: white;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background-color: #4f46e5;
}

button:active {
  transform: scale(0.97);
}

/* ===== Cards ===== */
.card {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.card h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: #111827;
}

.card-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  background-color: #f9fafb;
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  margin-top: 8px;
}

.error-card {
  border-color: #ef4444;
  background-color: #fef2f2;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  margin-top: auto;
  font-size: 0.9rem;
  color: #6b7280;
}

.footer a {
  color: #6366f1;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===== Utility Classes ===== */
.char-count {
  font-size: 0.85rem;
  color: #6b7280;
  font-family: monospace;
  background-color: #f3f4f6;
  padding: 4px 8px;
  border-radius: 6px;
}

.char-count span {
  font-weight: bold;
  color: #111827;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

#row-count {
  transition: all 0.3s ease;
}

#row-count.updated {
  transform: scale(1.1);
  color: #22c55e;
}

/* ===== Connection Status ===== */
.connection-status {
  position: fixed;
  bottom: 10px;
  right: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background-color: #f3f4f6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  z-index: 1000;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #9ca3af;
}

.connection-status.connected .status-indicator {
  background-color: #22c55e;
}

.connection-status.disconnected .status-indicator {
  background-color: #ef4444;
}

.connection-status.reconnecting .status-indicator {
  background-color: #f59e0b;
  animation: pulse 1.5s infinite;
}

.info-icon {
  position: relative;
  cursor: help;
  font-size: 16px;
}

.info-icon:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip {
  visibility: hidden;
  background-color: #111827;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1001;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #111827 transparent transparent transparent;
}

.reconnect-btn {
  margin-left: auto;
  padding: 4px 10px;
  background-color: #e5e7eb;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.reconnect-btn:hover {
  background-color: #d1d5db;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ===== Logo ===== */
.logo {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.logo img {
  height: 120px;
  width: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    font-size: 12px;
  }

  .container {
    padding: 1rem;
  }

  .tabs {
    flex-direction: column;
  }
}
