/* Theme Colors */
:root {
  --theme-color: #FF4500;
  --white: #fff;
  --light-gray: #aaa;
  --dark-gray: #666;
  --background: #fff;
}

.app {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8f9fa 0%, var(--background) 100%);
  color: var(--dark-gray);
}

.app-header {
  text-align: center;
  padding: 40px 20px;
  border-bottom: 1px solid #e9ecef;
  position: relative;
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 40px;
}

.nav-button {
  padding: 12px 20px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: #6c757d;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.nav-button:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: #495057;
}

.nav-button.active {
  background: var(--theme-color);
  color: var(--white);
  border: 1px solid var(--theme-color);
  box-shadow: 0 4px 16px rgba(255, 69, 0, 0.4);
}

.nav-button.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.5);
}

.app-header h1 {
  font-size: 48px;
  margin: 0;
  background: linear-gradient(90deg, #fff700 0%, #ff00ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header p {
  color: #6c757d;
  margin-top: 10px;
}

.user-info {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-handle {
  color: #495057;
  font-weight: bold;
  background: rgba(102, 126, 234, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #dee2e6;
}

.login-button,
.logout-button,
.backup-button,
.token-button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 8px;
}

.login-button {
  background: var(--theme-color);
  color: var(--white);
  border: 1px solid var(--theme-color);
}

.backup-button {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: 1px solid #28a745;
}

.token-button {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  color: white;
  border: 1px solid #ffc107;
}

.logout-button {
  background: rgba(108, 117, 125, 0.1);
  color: #495057;
  border: 1px solid #dee2e6;
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.4);
}

.backup-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.token-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.logout-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: rgba(108, 117, 125, 0.2);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 24px;
  color: #667eea;
}

.app-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

@media (max-width: 1000px) {
  .app .app-main {
    padding: 0px !important;
  }
}

.gacha-section {
  text-align: center;
  margin-bottom: 60px;
}

.gacha-section h2 {
  font-size: 32px;
  margin-bottom: 30px;
}

.gacha-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.gacha-button {
  padding: 20px 40px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.gacha-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.gacha-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gacha-button-premium {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  position: relative;
  overflow: hidden;
}

.gacha-button-premium::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 70%
  );
  animation: shimmer 3s infinite;
}

.collection-section h2 {
  font-size: 32px;
  text-align: center;
  margin-bottom: 30px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
  justify-items: center;
}

.empty-message {
  text-align: center;
  color: #6c757d;
  font-size: 18px;
  margin-top: 40px;
}

.error {
  color: #ff4757;
  text-align: center;
  margin-top: 20px;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

/* Comment System Styles */
.comment-section {
  max-width: 800px;
  margin: 0 auto;
  /* padding: 20px; - removed to avoid double padding */
}

.auth-section {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.atproto-button {
  background: var(--theme-color);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.atproto-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.4);
}

.username-input-section {
  margin: 15px 0;
}

.handle-input {
  width: 300px;
  max-width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.auth-hint {
  color: #6c757d;
  font-size: 14px;
  margin: 10px 0 0 0;
}

.user-section {
  background: #e8f5e8;
  border: 1px solid #4caf50;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.user-section .user-info {
  position: static;
  display: block;
  margin-bottom: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #4caf50;
}

.user-details h3 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 18px;
}

.user-section .user-info h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.user-section .user-handle {
  background: rgba(76, 175, 80, 0.1);
  color: #2e7d32;
  border: 1px solid #4caf50;
}

.user-section .user-did {
  font-family: monospace;
  font-size: 0.8em;
  color: #666;
  background: #f1f3f4;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 5px;
  word-break: break-all;
}

.comment-form {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.comment-form h3 {
  margin: 0 0 15px 0;
  color: #333;
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
  min-height: 100px;
}

.comment-form textarea:focus {
  border-color: #1185fe;
  outline: none;
  box-shadow: 0 0 0 2px rgba(17, 133, 254, 0.1);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.char-count {
  color: #666;
  font-size: 0.9em;
}

.post-button {
  background: var(--theme-color);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.post-button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.4);
}

.post-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.comments-list {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.comments-header h3 {
  margin: 0;
  color: #333;
}

.comments-controls {
  display: flex;
  gap: 10px;
}

.comments-toggle-button {
  background: var(--theme-color);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.comments-toggle-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.4);
}

.comment-item {
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  background: #fff;
}

.comment-item:last-child {
  margin-bottom: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ddd;
}

.comment-author-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.comment-author {
  font-weight: bold;
  color: #333;
  font-size: 0.95em;
}

.comment-handle {
  color: #666;
  font-size: 0.8em;
}

.comment-date {
  color: #666;
  font-size: 0.9em;
  margin-left: auto;
}

.delete-button {
  background: #dc3545;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
  margin-left: 8px;
}

.delete-button:hover {
  background: #c82333;
  transform: scale(1.05);
}

.comment-content {
  line-height: 1.5;
  color: #333;
  margin-bottom: 10px;
}

.comment-meta {
  padding: 8px;
  background: #f1f3f4;
  border-radius: 4px;
  font-size: 0.8em;
  color: #666;
}

.comment-meta small {
  font-family: monospace;
}

.no-comments {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px;
}

.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 10px;
  margin-top: 10px;
}

/* Admin Section Styles */
.admin-section {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.admin-section h3 {
  margin: 0 0 15px 0;
  color: #1976d2;
  font-size: 16px;
}

.user-list-form {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
}

.user-list-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
  min-height: 80px;
}

.user-list-form textarea:focus {
  border-color: #2196f3;
  outline: none;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.admin-hint {
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

/* User List Records Styles */
.user-list-records {
  margin-top: 20px;
}

.user-list-records h4 {
  margin: 0 0 15px 0;
  color: #1976d2;
  font-size: 14px;
}

.no-user-lists {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

.user-list-item {
  border: 1px solid #e3f2fd;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}

.user-list-item:last-child {
  margin-bottom: 0;
}

.user-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.user-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-list-date {
  color: #666;
  font-size: 0.9em;
  font-weight: 500;
}

.user-list-content {
  margin-top: 8px;
}

.user-handles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.user-handle-tag {
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pds-info {
  color: #666;
  font-size: 0.75em;
  font-weight: normal;
}

.user-list-meta {
  font-size: 0.8em;
  color: #666;
  background: #f8f9fa;
  padding: 6px 8px;
  border-radius: 4px;
  line-height: 1.4;
}

.user-list-meta small {
  font-family: monospace;
}

/* JSON Display Styles */
.json-button {
  background: var(--theme-color);
  color: var(--white);
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.json-button:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.json-display {
  margin-top: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.json-display h5 {
  margin: 0;
  padding: 8px 12px;
  background: #f1f3f4;
  border-bottom: 1px solid #ddd;
  font-size: 0.9em;
  color: #333;
}

.json-content {
  margin: 0;
  padding: 12px;
  background: #f8f9fa;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.8em;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
  max-height: 400px;
  overflow-y: auto;
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  border-bottom: 2px solid #e1e5e9;
  margin-bottom: 20px;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #656d76;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-button:hover {
  color: var(--theme-color);
  background: #f6f8fa;
}

.tab-button.active {
  color: var(--theme-color);
  border-bottom-color: var(--theme-color);
  background: #f6f8fa;
}

/* AI Chat History */
.ai-chat-list {
  max-width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
}

.chat-item {
  border: 1px solid #d1d9e0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #ffffff;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-type-button {
  background: var(--theme-color);
  color: var(--white);
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: default;
  font-size: 12px;
  font-weight: 500;
  margin-left: 4px;
}

.chat-type-text {
  font-size: 16px;
  margin-left: 4px;
}


.chat-date {
  color: #656d76;
  font-size: 12px;
}

.chat-content {
  background: #f6f8fa;
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid #d1d9e0;
  margin-bottom: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.chat-meta {
  font-size: 11px;
  color: #656d76;
}

.no-chat {
  text-align: center;
  padding: 40px 20px;
  color: #656d76;
  font-style: italic;
}