/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%);
  color: #e4e6eb;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  max-width: 720px;
  width: 100%;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(74, 222, 128, 0.15);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

/* ===== HEADER ===== */
header {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  font-size: 48px;
  margin-bottom: 4px;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: -0.5px;
}

.tagline {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 4px;
}

/* ===== SHORTEN FORM ===== */
.shorten-section {
  margin-bottom: 24px;
}

#shorten-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#url-input {
  flex: 1;
  min-width: 200px;
  padding: 14px 18px;
  background: rgba(15, 20, 25, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  color: #e4e6eb;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

#url-input:focus {
  border-color: #4ade80;
}

#shorten-btn {
  padding: 14px 32px;
  background: #4ade80;
  color: #0f1419;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#shorten-btn:hover {
  background: #22c55e;
}

#shorten-btn:active {
  transform: scale(0.97);
}

.loading {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  margin-top: 12px;
}

.hidden {
  display: none;
}

/* ===== RESULT ===== */
.result {
  margin-top: 16px;
}

.result-box {
  background: rgba(15, 20, 25, 0.5);
  border: 1px solid rgba(74, 222, 128, 0.15);
  border-radius: 16px;
  padding: 20px;
}

.short-url {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#short-url {
  flex: 1;
  min-width: 150px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 10px;
  color: #4ade80;
  font-size: 15px;
  font-weight: 500;
  outline: none;
}

#copy-btn {
  padding: 10px 18px;
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

#copy-btn:hover {
  background: rgba(74, 222, 128, 0.25);
}

.qr-container {
  margin-top: 14px;
  text-align: center;
}

.qr-container img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.source {
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
}

/* ===== HISTORY ===== */
.history-section {
  margin-top: 28px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 20px;
}

.history-section h2 {
  font-size: 18px;
  color: #e4e6eb;
  margin-bottom: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-history {
  color: #64748b;
  font-size: 14px;
  text-align: center;
  padding: 12px 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(15, 20, 25, 0.4);
  border-radius: 10px;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 8px;
}

.history-item .h-short {
  color: #4ade80;
  font-weight: 500;
  word-break: break-all;
}

.history-item .h-original {
  color: #94a3b8;
  font-size: 12px;
  word-break: break-all;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .h-time {
  color: #64748b;
  font-size: 11px;
}

.clear-btn {
  margin-top: 12px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== FOOTER ===== */
footer {
  margin-top: 28px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  padding-top: 18px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
  .container {
    padding: 20px 16px;
  }

  h1 {
    font-size: 26px;
  }

  #shorten-form {
    flex-direction: column;
  }

  #shorten-btn {
    width: 100%;
  }

  .short-url {
    flex-direction: column;
    align-items: stretch;
  }

  #copy-btn {
    width: 100%;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-item .h-original {
    max-width: 100%;
    white-space: normal;
  }
}