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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

header h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

header p {
  opacity: 0.9;
  font-size: 14px;
}

.tabs {
  display: flex;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
  flex: 1;
  padding: 15px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.3s;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  background: #e8e8e8;
}

.tab-btn.active {
  background: white;
  border-bottom-color: #667eea;
  color: #667eea;
  font-weight: 500;
}

.tab-content {
  padding: 30px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.input-section {
  margin-bottom: 20px;
}

textarea {
  width: 100%;
  min-height: 150px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-group button {
  flex: 1;
}

#json-format, #base64-encode, #base64-decode, #ts-to-date, #date-to-ts, #regex-test {
  background: #667eea;
  color: white;
}

#json-minify {
  background: #764ba2;
  color: white;
}

#json-clear, #base64-clear, #refresh-ts {
  background: #f5f5f5;
  color: #666;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.output-section {
  position: relative;
}

.output-section pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 20px;
  border-radius: 8px;
  min-height: 100px;
  max-height: 400px;
  overflow: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.error {
  color: #e74c3c;
  padding: 12px;
  background: #fee;
  border-radius: 6px;
  margin-top: 10px;
  display: none;
}

.error.show {
  display: block;
}

/* Timestamp Styles */
.timestamp-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.input-group input[type="text"],
.input-group input[type="datetime-local"] {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.input-group input:focus {
  outline: none;
  border-color: #667eea;
}

.current-time {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 14px;
}

.current-time code {
  background: #1e1e1e;
  color: #4ec9b0;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: monospace;
}

#refresh-ts {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 12px;
}

/* Regex Styles */
.regex-inputs {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.regex-inputs label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin-left: 15px;
}

.regex-inputs input[type="checkbox"] {
  cursor: pointer;
}

.regex-inputs input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Consolas', 'Monaco', monospace;
}

#regex-text {
  min-height: 80px;
}

#regex-matches {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 20px;
  border-radius: 8px;
  min-height: 60px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
}

.match-item {
  padding: 8px;
  margin: 4px 0;
  background: #2d2d2d;
  border-radius: 4px;
  border-left: 3px solid #4ec9b0;
}

.match-highlight {
  background: #264f78;
  padding: 2px 4px;
  border-radius: 3px;
}

.no-matches {
  color: #888;
  font-style: italic;
}

/* Footer */
footer {
  background: #f5f5f5;
  padding: 20px;
  text-align: center;
  border-top: 1px solid #e0e0e0;
}

footer a {
  color: #666;
  text-decoration: none;
  font-size: 14px;
}

footer a:hover {
  color: #667eea;
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    border-radius: 0;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1 1 50%;
  }

  .timestamp-inputs {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .btn-group button {
    flex: 1 1 100%;
    min-width: 120px;
  }
}
