/* style.css */
:root {
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.1);
  --text-primary: #1e1e2f;
  --text-secondary: #4a4a68;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --danger: #ff6584;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --radius: 16px;
  --transition: 0.25s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--text-primary);
}

/* Main glass card */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  width: 100%;
  max-width: 600px;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  transition: all 0.3s ease;
}

/* Logo & header */
.logo {
  font-size: 2.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.2rem;
}
.logo span {
  background: linear-gradient(135deg, #fff, #e0e0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline {
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  font-weight: 300;
}

/* Input area */
.shorten-box {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
#longUrl {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(5px);
  color: #fff;
  font-size: 1rem;
  outline: none;
  border: 1px solid rgba(255,255,255,0.3);
  transition: var(--transition);
}
#longUrl::placeholder {
  color: rgba(255,255,255,0.7);
}
#longUrl:focus {
  border-color: #fff;
  background: rgba(255,255,255,0.3);
}
.custom-code-row {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0 0 0 1rem;
  border: 1px solid rgba(255,255,255,0.25);
}
.base-url {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  white-space: nowrap;
}
#customCode {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.9rem 0.8rem;
  color: white;
  font-size: 1rem;
  outline: none;
}
#customCode::placeholder {
  color: rgba(255,255,255,0.5);
}

/* Buttons */
.btn-primary {
  background: #fff;
  color: #6c63ff;
  border: none;
  padding: 0.9rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-primary:hover {
  background: #f0f0ff;
  transform: translateY(-2px);
}
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: white;
  padding: 0.6rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  align-self: center;
}
.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.error {
  color: #ffb3b3;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Result box */
.result-box {
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  animation: fadeSlide 0.3s ease;
}
.hidden {
  display: none !important;
}
.result-label {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}
.copy-row {
  display: flex;
  gap: 0.5rem;
}
#shortUrlDisplay {
  flex: 1;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: white;
  font-size: 0.95rem;
  outline: none;
}
.btn-copy {
  background: white;
  border: none;
  border-radius: 8px;
  padding: 0 1rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-copy:hover {
  background: #f0f0ff;
}
.test-link {
  color: #ffd966;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.test-link:hover {
  text-decoration: underline;
}

/* History */
.history-section h2 {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 300px;
  overflow-y: auto;
}
.history-item {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  transition: var(--transition);
}
.history-item:hover {
  background: rgba(255,255,255,0.15);
}
.short-code {
  font-weight: 700;
  color: #ffd966;
  margin-right: auto;
  word-break: break-all;
}
.original-url {
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  flex-basis: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-actions {
  display: flex;
  gap: 0.3rem;
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}
.icon-btn:hover {
  background: rgba(255,255,255,0.3);
}
.delete-btn:hover {
  background: #ff6584;
}

/* Redirect overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.redirect-card {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(25px);
  padding: 2rem 3rem;
  border-radius: 20px;
  text-align: center;
  color: white;
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to {transform: rotate(360deg);} }

footer {
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}