/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light Mode */
body.light {
  background-color: #f8fafc;
  color: #1e293b;
}

/* Dark Mode */
body.dark {
  background-color: #0f172a;
  color: #e2e8f0;
}

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

/* Header */
.header {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dark .header {
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(90deg, #3b82f6, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  float: right;
  display: flex;
  align-items: center;
}

.nav-link {
  color: #475569;
  margin-left: 24px;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.dark .nav-link {
  color: #cbd5e1;
}

.nav-link:hover {
  color: #3b82f6;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 24px;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.dark .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sun-icon, .moon-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.light .moon-icon, .dark .sun-icon {
  display: none;
}

.light .sun-icon, .dark .moon-icon {
  display: block;
}

/* Alerts */
.alert {
  padding: 16px;
  margin: 24px auto;
  max-width: 600px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
}

.dark .alert-success {
  background-color: #064e3b;
  color: #6ee7b7;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.dark .alert-error {
  background-color: #7f1d1d;
  color: #f87171;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(90deg, #3b82f6, #a855f7);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(90deg, #2563eb, #9333ea);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background-color: #1e293b;
  color: #ffffff;
}

.dark .btn-secondary {
  background-color: #475569;
}

.btn-secondary:hover {
  background-color: #111827;
  transform: translateY(-2px);
}

.btn-outline {
  border: 2px solid #3b82f6;
  color: #3b82f6;
  background: transparent;
}

.dark .btn-outline {
  border-color: #a855f7;
  color: #a855f7;
}

.btn-outline:hover {
  background-color: #3b82f6;
  color: #ffffff;
}

.dark .btn-outline:hover {
  background-color: #a855f7;
}

/* Form Groups (Generic) */
.form-group {
  margin-bottom: 24px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #475569;
}

.dark .form-group label {
  color: #cbd5e1;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  background: #f8fafc;
  transition: all 0.3s ease;
}

.dark .form-group input, .dark .form-group textarea {
  border-color: #334155;
  background: #334155;
  color: #e2e8f0;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .form-group input:focus, .dark .form-group textarea:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

/* Dashboard */
.dashboard-header {
  background: #ffffff;
  padding: 16px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 48px;
}

.dark .dashboard-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.user-profile {
  float: right;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(45deg, #3b82f6, #a855f7);
  padding: 2px;
}

.username {
  font-weight: 600;
  font-size: 18px;
}

.dashboard-main {
  padding: 48px 0;
}

.dashboard-title {
  font-size: 44px;
  font-weight: 800;
  margin-bottom: 16px;
}

.dashboard-subtitle {
  font-size: 20px;
  color: #64748b;
  margin-bottom: 40px;
}

.dark .dashboard-subtitle {
  color: #94a3b8;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dark .project-card {
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.project-form {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 48px;
}

.dark .project-form {
  background: #1e293b;
}

.project-actions {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.code-preview {
  background: #f1f5f9;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  max-height: 100px;
  overflow: auto;
}

.dark .code-preview {
  background: #334155;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.dark .tab-button {
  color: #94a3b8;
}

.tab-button:hover, .tab-button.active {
  background: linear-gradient(90deg, #3b82f6, #a855f7);
  color: #ffffff;
}

.dark .tab-button:hover {
  background: linear-gradient(90deg, #3b82f6, #a855f7);
}

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

.modal-content {
  background: #ffffff;
  padding: 32px;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  position: relative;
}

.dark .modal-content {
  background: #1e293b;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  color: #475569;
}

.dark .modal-close {
  color: #cbd5e1;
}

.modal-close:hover {
  color: #3b82f6;
}

#modal-code, #edit-code-editor {
  width: 100%;
  height: 400px;
}

/* CodeMirror Overrides */
.CodeMirror {
  height: 400px !important;
  border-radius: 8px;
  font-size: 14px;
}

.cm-s-dracula {
  background: #282a36 !important;
  color: #f8f8f2 !important;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 0;
  background: #f1f5f9;
  color: #475569;
}

.dark .footer {
  background: #1e293b;
  color: #cbd5e1;
}

.footer-links {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.footer-links a {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}

.dark .footer-links a {
  color: #cbd5e1;
}

.footer-links a:hover {
  color: #3b82f6;
}

.dark .footer-links a:hover {
  color: #a855f7;
}

/* Animations */
@keyframes slideIn {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes cardReveal {
  from { transform: translateY(40px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes gradientText {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes gradientBorder {
  0% { border-color: #3b82f6; }
  50% { border-color: #a855f7; }
  100% { border-color: #3b82f6; }
}

.animate-slide-in {
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fade-in {
  animation: fadeIn 1s ease-in;
}

.animate-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-card-reveal {
  animation: cardReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-pulse {
  animation: pulse 2s infinite ease-in-out;
}

.animate-gradient-text {
  background: linear-gradient(90deg, #3b82f6, #a855f7, #3b82f6);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientText 4s linear infinite;
}

.animate-gradient-border {
  animation: gradientBorder 3s linear infinite;
}