/**
 * CampusDrill Microtools - Shared Theme
 * Consistent branding across all 14 microtools
 */

:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --secondary: #764ba2;
  --success: #28a745;
  --success-light: #d4edda;
  --warning: #ffc107;
  --warning-light: #fff3cd;
  --danger: #dc3545;
  --danger-light: #f8d7da;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #333333;
  --text-muted: #666666;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-hover: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Container */
.tool-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Tool Card */
.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Tool Header */
.tool-header {
  background: var(--gradient);
  color: white;
  padding: 30px 20px;
  text-align: center;
}

.tool-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-header p {
  font-size: 1rem;
  opacity: 0.95;
}

.tool-header .subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-top: 5px;
}

/* Tool Body */
.tool-body {
  padding: 25px;
}

/* Section */
.tool-section {
  margin-bottom: 25px;
}

.tool-section h2 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 15px;
}

.tool-section h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 10px;
}

/* Labels */
.label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

/* Inputs */
textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient);
  color: white;
}

.btn-primary:hover {
  background: var(--gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #218838;
}

/* Button Group */
.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Result Box */
.result-box {
  background: #f8f9fa;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.result-box h3 {
  color: var(--primary);
  margin-bottom: 15px;
}

/* Status Boxes */
.success-box {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 15px;
  color: #155724;
}

.warning-box {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: 8px;
  padding: 15px;
  color: #856404;
}

.error-box {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 15px;
  color: #721c24;
}

/* Exam Selector */
.exam-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.exam-selector button {
  padding: 8px 16px;
  border: 2px solid var(--border);
  background: white;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.exam-selector button:hover {
  border-color: var(--primary);
}

.exam-selector button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--text-muted);
}

/* Score Badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}

.score-badge.high {
  background: var(--success);
}

.score-badge.medium {
  background: var(--warning);
}

.score-badge.low {
  background: var(--danger);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.option-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.option-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.option-card.selected {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.1);
}

/* WhatsApp CTA */
.whatsapp-cta {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border-radius: var(--radius);
  padding: 25px;
  margin-top: 30px;
  text-align: center;
}

.whatsapp-cta h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.whatsapp-cta p {
  opacity: 0.95;
  margin-bottom: 15px;
}

.whatsapp-cta ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.whatsapp-cta li {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.9rem;
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: #128C7E;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  transition: all 0.2s;
}

.whatsapp-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.share-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.share-section p {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.share-btn,
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 10px;
  transition: all 0.2s;
}

.share-btn {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.copy-btn {
  background: white;
  color: #128C7E;
}

.copy-btn:hover {
  background: #f0f0f0;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .tool-header h1 {
    font-size: 1.5rem;
  }

  .tool-body {
    padding: 15px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .exam-selector {
    justify-content: center;
  }

  .whatsapp-cta ul {
    flex-direction: column;
    align-items: center;
  }
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Fade in animation */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}