/* TeleBlog - Production CSS */
/* Clean, responsive, Telegram Mini Web App optimized */

:root {
  --bg-color: #f8f8f8;
  --text-color: #222;
  --text-secondary-color: #777;
  --accent-color: #978366;
  --accent-dark: #463d31;
  --surface-color: #ffffff;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f0f0f;
    --text-color: #eee;
    --text-secondary-color: #aaa;
    --accent-color: #c0a676;
    --accent-dark: #e7e4d0;
    --surface-color: #1c1c1c;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
}


/* ------------------ CSS for Loading State ------------------ */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
  color: white;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
  margin-bottom: 16px;
}

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

/* ------------------ Layout ------------------ */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  padding-bottom: 60px;
}

.page {
  display: none;
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

.page.active {
  display: block;
}

/* ------------------ Auth / Loading ------------------ */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading-overlay.active {
  display: flex;
}

.loader {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--accent-dark);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 0.9s linear infinite;
}

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

/* ------------------ Buttons ------------------ */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--accent-color);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.9;
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

/* ------------------ Posts ------------------ */

.post-card {
  background: var(--surface-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
}

.post-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-secondary-color);
}

.post-title {
  font-size: 1.15rem;
  margin: 6px 0;
  font-weight: 600;
}

.post-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary-color);
  margin-bottom: 8px;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary-color);
}

/* ------------------ Bottom Nav ------------------ */

nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface-color);
  border-top: 1px solid rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

nav button {
  background: none;
  border: none;
  outline: none;
  color: var(--text-secondary-color);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

nav button.active,
nav button:hover {
  color: var(--accent-dark);
}

/* ------------------ Empty State ------------------ */

.empty-state {
  text-align: center;
  padding: 40px 0;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

/* ------------------ Toasts ------------------ */

#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.toast {
  background: var(--surface-color);
  color: var(--text-color);
  padding: 10px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  animation: fadeIn 0.3s ease;
}

.toast-success {
  border-left: 5px solid var(--success-color);
}

.toast-error {
  border-left: 5px solid var(--error-color);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-secondary-color);
  font-size: 1.1rem;
  cursor: pointer;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------ Auth Section ------------------ */

.auth-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 85vh;
  text-align: center;
  padding: 20px;
}

.auth-section h2 {
  margin-bottom: 12px;
  font-size: 1.4rem;
}

.auth-section p {
  color: var(--text-secondary-color);
  margin-bottom: 20px;
}

/* ------------------ Profile ------------------ */

.profile-section {
  text-align: center;
  padding-top: 30px;
}

.profile-section img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.profile-section h3 {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 600;
}

/* ------------------ Utility ------------------ */

.text-center { text-align: center; }
.hidden { display: none !important; }

@media screen and (max-width: 480px) {
  .page { padding: 12px; }
  .post-title { font-size: 1.05rem; }
  .post-excerpt { font-size: 0.9rem; }
}
