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

body {
  font-family: 'Roboto', 'Google Sans', system-ui, sans-serif;
  background: #ffffff;
  color: #202124;
  line-height: 1.5;
}

.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Header - Google style */
.site-header {
  background: white;
  border-bottom: 1px solid #ecedef;
  padding: 0.8rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

.app-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: #1a73e8;
}

.tagline {
  font-size: 0.75rem;
  font-weight: 400;
  color: #5f6368;
  display: block;
  margin-top: 2px;
}

/* Search section - Google card style */
.search-section {
  padding: 2rem 0 1rem;
  background: white;
}

.search-card {
  max-width: 720px;
  margin: 0 auto;
  background: white;
  border-radius: 30px;
  padding: 0.5rem;
  box-shadow: 0 1px 6px rgba(32,33,36,0.12), 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}

.search-card:focus-within {
  box-shadow: 0 2px 12px rgba(32,33,36,0.2);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 30px;
  padding: 4px 8px 4px 16px;
}

.search-icon {
  color: #9aa0a6;
  font-size: 1.2rem;
}

#searchInput {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  padding: 12px 0;
  font-weight: 400;
  outline: none;
  color: #202124;
}

#searchInput::placeholder {
  color: #9aa0a6;
  font-weight: 400;
}

.btn-primary {
  background: #1a73e8;
  border: none;
  padding: 8px 20px;
  border-radius: 24px;
  font-weight: 500;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1765cc;
}

.search-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  padding-right: 8px;
}

.btn-outline {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1a73e8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.btn-outline:hover {
  background: #f1f3f4;
}

.search-stats {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #5f6368;
  padding-left: 16px;
}

/* Results area */
.results-area {
  flex: 1;
  padding: 2rem 0 3rem;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* Knowledge card - Google Material style */
.knowledge-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.1s;
  border: 1px solid #ecedef;
}

.knowledge-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-img {
  width: 100%;
  height: 180px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #ecedef;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: 1.2rem 1.2rem 1.5rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #1a73e8;
  cursor: pointer;
  display: inline-block;
  transition: text-decoration 0.1s;
}

.card-title:hover {
  text-decoration: underline;
}

.card-details {
  color: #3c4043;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  /* No truncation - full text displayed */
  overflow: visible;
  white-space: normal;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1rem 0 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #ecedef;
}

.social-btn {
  background: #f8f9fa;
  border-radius: 40px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  font-size: 1.1rem;
  text-decoration: none;
  transition: background 0.2s;
}

.social-btn:hover {
  background: #e8eaed;
  color: #1a73e8;
}

.context-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1a73e8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.context-btn:hover {
  background: #f1f3f4;
}

/* Loading, error, initial message */
.loading-state, .error-state, .empty-state, .initial-message {
  text-align: center;
  padding: 3rem 1rem;
  background: white;
  border-radius: 24px;
  margin-top: 1rem;
}

.initial-message {
  color: #5f6368;
}

.initial-message i {
  font-size: 3rem;
  color: #9aa0a6;
  margin-bottom: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #ecedef;
  border-top: 3px solid #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 520px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #ecedef;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #5f6368;
}

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Footer */
.site-footer {
  background: #f8f9fa;
  color: #5f6368;
  text-align: center;
  padding: 1.2rem 0;
  margin-top: 2rem;
  font-size: 0.8rem;
  border-top: 1px solid #ecedef;
}

.site-footer a {
  color: #1a73e8;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .knowledge-grid { grid-template-columns: 1fr; }
  .search-input-group { flex-wrap: wrap; padding: 8px; }
  #searchInput { width: 100%; padding: 10px; }
  .btn-primary { width: 100%; margin-top: 8px; }
  .card-title { font-size: 1.3rem; }
}

/* Toast message */
.toast-message {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: white;
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 0.85rem;
  z-index: 1200;
  animation: fadeInOut 2s ease forwards;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); visibility: hidden; }
}
