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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

#auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#user-name {
  color: #a855f7;
  font-weight: 600;
}

.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-login {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  padding: 10px 24px;
  font-weight: 600;
}

.btn-login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary {
  background: #6366f1;
  color: white;
  padding: 12px 24px;
  font-weight: 600;
  align-self: flex-end;
}

.btn-primary:hover {
  background: #5558e6;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  background: #2a2a3a;
  color: #aaa;
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-small:hover {
  background: #3a3a4a;
}

.hidden {
  display: none !important;
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#description {
  flex: 1;
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  padding: 14px;
  color: #e0e0e0;
  font-size: 0.95rem;
  resize: vertical;
  font-family: inherit;
}

#description:focus {
  outline: none;
  border-color: #6366f1;
}

#ai-status {
  text-align: center;
  color: #a855f7;
  font-size: 0.85rem;
  margin-top: 10px;
  animation: pulse 1.5s infinite;
}

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

#login-prompt {
  text-align: center;
  color: #666;
  padding: 60px 0;
}

#todo-input {
  margin-bottom: 28px;
}

#todo-list {
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a2e;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.todo-item:hover {
  background: #1e1e34;
}

.todo-item.completed .todo-title {
  text-decoration: line-through;
  color: #555;
}

.todo-item.completed .todo-desc {
  color: #444;
}

.todo-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #444;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.todo-check:hover {
  border-color: #6366f1;
}

.todo-check.checked {
  background: #6366f1;
  border-color: #6366f1;
}

.todo-check.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.todo-desc {
  font-size: 0.8rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.todo-delete {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.todo-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

#empty-state {
  text-align: center;
  color: #555;
  padding: 40px 0;
}

/* Layout with detail panel */
.main-content {
  display: flex;
  gap: 20px;
}

.todo-list-section {
  flex: 1;
  min-width: 0;
}

/* Detail Panel */
#detail-panel {
  width: 340px;
  flex-shrink: 0;
  background: #1a1a2e;
  border-radius: 12px;
  padding: 24px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  border: 1px solid #2a2a3a;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-header h2 {
  font-size: 1.1rem;
  color: #e0e0e0;
  word-break: break-word;
}

#detail-close {
  font-size: 1.2rem;
  padding: 4px 10px;
  line-height: 1;
  flex-shrink: 0;
}

.detail-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.8rem;
}

#detail-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

#detail-status.status-pending {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

#detail-status.status-done {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

#detail-date {
  color: #666;
  display: flex;
  align-items: center;
}

.detail-body {
  margin-bottom: 24px;
}

.detail-body h3 {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

#detail-description {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-full {
  width: 100%;
  text-align: center;
}

.btn-danger {
  background: #2a1a1a;
  color: #ef4444;
  padding: 10px 24px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #3a1a1a;
}

.todo-item {
  cursor: pointer;
}

.todo-item.active {
  background: #1e1e34;
  border: 1px solid #6366f1;
}

/* Mobile: panel below list */
@media (max-width: 700px) {
  .main-content {
    flex-direction: column;
  }

  #detail-panel {
    width: 100%;
    position: static;
  }
}
