/**
 * AI Study & Task Planner - Component Design System
 */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background-color: var(--color-bg-surface-elevated);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background-color: var(--color-bg-surface-hover);
  border-color: var(--color-text-muted);
}

.btn-accent {
  background-color: var(--color-accent-emerald);
  color: #070B14;
  font-weight: 600;
}
.btn-accent:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow-emerald);
}

.btn-danger {
  background-color: var(--color-accent-rose-subtle);
  color: var(--color-accent-rose);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background-color: var(--color-accent-rose);
  color: #FFFFFF;
}

.btn-ghost {
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background-color: var(--color-bg-surface-hover);
  color: var(--color-text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-md);
}

/* Cards & Bento Grid */
.card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards */
.stat-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text-main);
  line-height: 1.1;
}

.stat-subtext {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Circular Progress Ring */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease-in-out;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Horizontal Progress Bar */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background-color: var(--color-bg-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-cyan));
  transition: width 0.4s ease;
}

.progress-bar-fill.emerald {
  background: linear-gradient(90deg, #10B981, #059669);
}
.progress-bar-fill.purple {
  background: linear-gradient(90deg, #8B5CF6, #6366F1);
}
.progress-bar-fill.amber {
  background: linear-gradient(90deg, #F59E0B, #D97706);
}
.progress-bar-fill.pink {
  background: linear-gradient(90deg, #EC4899, #F43F5E);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  background-color: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-main);
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  background-color: var(--color-bg-surface-elevated);
}

/* Checkboxes & Custom Inputs */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xs);
  background-color: var(--color-bg-base);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all var(--transition-fast);
}

.custom-checkbox:checked {
  background-color: var(--color-accent-emerald);
  border-color: var(--color-accent-emerald);
}

.custom-checkbox:checked::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #070B14;
  border-bottom: 2px solid #070B14;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

/* Mobile Touch Targets & Usability */
@media (max-width: 768px) {
  .btn {
    min-height: 38px;
    touch-action: manipulation;
  }
  .btn-sm {
    min-height: 34px;
    padding: 6px 12px;
  }
  .btn-xs {
    min-height: 30px;
    padding: 4px 8px;
  }
  .form-input, .form-select, .form-textarea, input[type="date"] {
    min-height: 40px;
    font-size: 16px; /* Prevents auto-zoom while maintaining ideal touch target */
  }
  .custom-checkbox {
    width: 20px;
    height: 20px;
  }
}


