/* Main styles for Enhancer.work - Khan Academy inspired theme */

:root {
  /* Khan Academy inspired colors */
  --primary-color: #1865f2;
  --primary-hover: #0a47c2;
  --secondary-color: #11accd;
  --success-color: #0a7d3e;
  --error-color: #d92916;
  --warning-color: #e07c12;
  --text-primary: #21242c;
  --text-secondary: #5a5e66;
  --bg-light: #f7f8fa;
  --bg-white: #ffffff;
  --border-color: #e5e5e5;
  --nav-bg: #ffffff;
  --card-hover: #f0f1f2;
}

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

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg-light);
}

/* Loading spinner */
.spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* Tool sections */
.tool-section {
  background: white;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.tool-section:hover {
  background: var(--card-hover);
  border-color: #d6d8da;
}

.tool-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.tool-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 101, 242, 0.14);
}

.tool-output {
  background: var(--bg-light);
  padding: 16px;
  border-radius: 4px;
  margin-top: 16px;
  min-height: 100px;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--border-color);
}

/* Buttons - Khan Academy style */
.btn {
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

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

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

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: rgba(24, 101, 242, 0.06);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #085a2d;
}

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

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  transition: all 0.2s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 101, 242, 0.14);
}

.form-error {
  color: var(--error-color);
  font-size: 14px;
  margin-top: 4px;
}

/* Navigation - Khan Academy style */
.nav-header {
  background: var(--nav-bg);
  padding: 12px 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo i {
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s;
  padding: 8px 16px;
  border-radius: 4px;
}

.nav-link:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.nav-link.active {
  color: var(--primary-color);
  background: rgba(24, 101, 242, 0.08);
}

/* User menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

/* OAuth buttons */
.oauth-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  color: var(--text-secondary);
  font-size: 14px;
}

.oauth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
}

.oauth-divider span {
  background: white;
  padding: 0 16px;
  position: relative;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}

/* Google Sign-In button container */
.g-signin2 {
  width: 100% !important;
  display: flex;
  justify-content: center;
}

.g-signin2 > div {
  width: 100% !important;
  max-width: 300px;
}

.btn-oauth {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-primary);
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 15px;
}

.btn-oauth:hover {
  background: var(--bg-light);
  border-color: #d6d8da;
}

.btn-oauth img {
  width: 20px;
  height: 20px;
}

/* Page content container */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Tool cards grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.tool-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
}

.tool-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tool-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tool-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.footer {
  background: white;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 40px 0 20px;
  margin-top: 80px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-links {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--primary-color);
}

.footer-disclaimer {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(33, 36, 44, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 4px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* Usage indicator */
.usage-indicator {
  background: white;
  border-radius: 4px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.usage-bar {
  width: 200px;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.usage-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Dark mode */
body.dark-mode {
  background: #1a1d23;
  color: #e5e5e5;
}

body.dark-mode .nav-header {
  background: #21242c;
  border-bottom-color: #363940;
}

body.dark-mode .tool-section,
body.dark-mode .tool-card,
body.dark-mode .modal-content,
body.dark-mode .usage-indicator {
  background: #21242c;
  border-color: #363940;
  color: #e5e5e5;
}

body.dark-mode .tool-input,
body.dark-mode .form-input {
  background: #1a1d23;
  border-color: #363940;
  color: #e5e5e5;
}

body.dark-mode .tool-output {
  background: #1a1d23;
  border-color: #363940;
  color: #e5e5e5;
}

body.dark-mode .nav-logo,
body.dark-mode .nav-link,
body.dark-mode .modal-title,
body.dark-mode .page-title {
  color: #e5e5e5;
}

body.dark-mode .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .footer {
  background: #21242c;
  border-top-color: #363940;
}

/* Practice tool specific */
.question-card {
  background: white;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.question-card.correct {
  border-color: var(--success-color);
  background: rgba(10, 125, 62, 0.04);
}

.question-card.incorrect {
  border-color: var(--error-color);
  background: rgba(217, 41, 22, 0.04);
}

.question-text {
  font-size: 18px;
  margin-bottom: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.answer-buttons {
  display: flex;
  gap: 12px;
}

.answer-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  font-weight: 500;
}

.answer-btn:hover {
  border-color: var(--primary-color);
  background: var(--bg-light);
}

.answer-btn.selected-correct {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.answer-btn.selected-incorrect {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

.explanation {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--border-color);
}

/* Responsive design */
@media (max-width: 768px) {
  .nav-links {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .nav-link {
    padding: 6px 12px;
    font-size: 14px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 16px;
  }
  
  .tool-section {
    padding: 16px;
  }
  
  .modal-content {
    padding: 20px;
  }
  
  .usage-indicator {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .usage-bar {
    width: 100%;
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
}