:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.75);
  --ink: #1b1a17;
  --muted: #6e6b64;
  --soft: #9c9990;
  --line: #e8e6df;
  --line-focus: #c2beb3;

  /* Brand and Accent Colors */
  --brand: #1e5fcc;
  --brand-hover: #164da8;
  --brand-soft: #eaf1fc;
  
  --accent: #d47a1c;
  --accent-hover: #b36310;
  --accent-soft: #faf0e3;

  --purple: #7047cc;
  --purple-hover: #5b36ad;
  --purple-soft: #f1ecfb;

  --green: #1e7a55;
  --green-soft: #eaf6ef;
  
  --red: #b5392b;
  --red-soft: #faeeec;

  --shadow: 0 1px 3px rgba(27,26,23,0.02), 0 10px 40px rgba(27,26,23,0.06);
  --shadow-hover: 0 4px 6px rgba(27,26,23,0.04), 0 16px 48px rgba(27,26,23,0.1);
  --radius: 16px;
  --radius-sm: 8px;
  
  --font-title: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 0% 0%, hsla(217, 75%, 90%, 0.4) 0px, transparent 50%),
    radial-gradient(at 100% 0%, hsla(34, 75%, 92%, 0.4) 0px, transparent 50%),
    radial-gradient(at 50% 100%, hsla(270, 75%, 92%, 0.3) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header styling */
.app-header {
  padding: 48px 0 24px;
  text-align: center;
}

.header-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 2.2rem;
  animation: float 4s ease-in-out infinite;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.logo-text b {
  color: var(--brand);
  font-weight: 800;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 580px;
  margin: 0 auto;
}

/* Layout container */
.app-container {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.features-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Card design */
.card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.glass-card {
  background-color: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-focus);
}

.wide-card {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .wide-card {
    grid-column: span 1;
  }
}

.card-header {
  margin-bottom: 24px;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 10px 0 6px;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  width: fit-content;
}

.badge-d1 {
  background-color: var(--brand-soft);
  color: var(--brand);
}

.badge-kv {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.badge-ai {
  background-color: var(--purple-soft);
  color: var(--purple);
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--brand);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--brand-hover);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-purple {
  background-color: var(--purple);
  color: #ffffff;
}

.btn-purple:hover {
  background-color: var(--purple-hover);
}

.btn-danger {
  background-color: transparent;
  color: var(--red);
  border: 1px solid transparent;
  padding: 6px;
  border-radius: 4px;
}

.btn-danger:hover {
  background-color: var(--red-soft);
  border-color: var(--red-soft);
}

.btn-align-bottom {
  align-self: flex-end;
  height: 44px;
}

/* Inputs & Forms */
.form-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.form-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.input-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="url"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  height: 44px;
}

input[type="text"]:focus,
input[type="url"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 95, 204, 0.15);
}

/* Todo list style */
.todo-list-container {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.4);
  max-height: 250px;
  overflow-y: auto;
  flex: 1;
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  transition: background-color 0.15s ease;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item:hover {
  background-color: rgba(255, 255, 255, 0.7);
}

.todo-checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
  user-select: none;
}

.todo-checkbox-label input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-custom {
  height: 20px;
  width: 20px;
  background-color: var(--surface);
  border: 2px solid var(--line-focus);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.todo-checkbox-label:hover .checkbox-custom {
  border-color: var(--brand);
}

.todo-checkbox-label input:checked ~ .checkbox-custom {
  background-color: var(--green);
  border-color: var(--green);
}

.checkbox-custom::after {
  content: "";
  display: none;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.todo-checkbox-label input:checked ~ .checkbox-custom::after {
  display: block;
}

.todo-text {
  color: var(--ink);
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.todo-checkbox-label input:checked ~ .todo-text {
  text-decoration: line-through;
  color: var(--soft);
}

/* Link list style */
.shortened-container {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 6px;
}

.shortened-container h3 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.link-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.link-code {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-title);
  font-size: 0.92rem;
}

.link-code:hover {
  text-decoration: underline;
}

.link-orig {
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
}

.btn-copy {
  background-color: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy:hover {
  background-color: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* Empty, Loading states */
.loading-state, .empty-state {
  padding: 24px;
  text-align: center;
  color: var(--soft);
  font-size: 0.9rem;
  list-style: none;
}

/* AI Explainer box styling */
.ai-response-box {
  background-color: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 180px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ai-response-placeholder {
  text-align: center;
  color: var(--soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ai-icon {
  font-size: 2.2rem;
}

.ai-response-placeholder p {
  margin: 0;
  max-width: 320px;
  font-size: 0.88rem;
}

.ai-response-content {
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-line;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--purple);
  font-weight: 600;
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid var(--purple-soft);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Footer styling */
.app-footer {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.88rem;
  margin-top: 48px;
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}
