:root {
  /* Colors */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-color: #ffffff;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;

  /* Status Colors */
  --status-completed-bg: #dcfce7;
  --status-completed-text: #166534;
  --status-inprogress-bg: #fef08a;
  --status-inprogress-text: #854d0e;
  --status-ready-bg: #dbeafe;
  --status-ready-text: #1e40af;
  --status-new-bg: #f3e8ff;
  --status-new-text: #6b21a8;

  /* Layout */
  --sidebar-width: 250px;
  --header-height: 70px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Application Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--primary-color);
}

.mobile-close {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
}

.sidebar-nav {
  padding: 24px 0;
  flex: 1;
}

.sidebar-nav ul {
  list-style: none;
}


.nav-item {
  display: block;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background-color: #eff6ff;
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--header-height);
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
}

.profile-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-name {
  font-weight: 500;
  font-size: 14px;
}

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

/* Content Area */
.content {
  padding: 32px;
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Welcome Section */
.welcome-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--card-bg);
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.welcome-text h2 {
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 700;
}

.welcome-text p {
  color: var(--text-muted);
  font-size: 15px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

/* Upload Message */
.upload-message {
  background-color: #eff6ff;
  color: #1e3a8a;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 32px;
  font-size: 14px;
  border: 1px solid #bfdbfe;
  transition: opacity 0.3s;
}

.upload-message.hidden {
  display: none;
}

/* Recent Materials */
.recent-materials-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  font-weight: 600;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* Material Card */
.material-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  cursor: pointer;
}

.material-card:hover {
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-type {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: var(--bg-color);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.card-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Status Badges */
.status-completed {
  background-color: var(--status-completed-bg);
  color: var(--status-completed-text);
}

.status-inprogress {
  background-color: var(--status-inprogress-bg);
  color: var(--status-inprogress-text);
}

.status-ready {
  background-color: var(--status-ready-bg);
  color: var(--status-ready-text);
}

.status-new {
  background-color: var(--status-new-bg);
  color: var(--status-new-text);
}

.card-content h4 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-main);
  font-weight: 600;
}

.card-content p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.card-footer {
  margin-top: auto;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* Interactive Flashcards Styles */
.flashcards-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
}

.flashcards-container {
  width: 100%;
  max-width: 520px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard-header {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.card-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 20px;
}

/* 3D Flip Card Effect */

.flashcard-wrapper{
  perspective: 1000px;
  width: 100%;
  height: 240px;
  cursor: pointer;
  margin-bottom: 24px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-face{
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.card-type-tag{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary-color);
  text-transform: uppercase;
}

.card-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
}

.flashcard-back {
  transform: rotateY(180deg);
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.flashcard-back .card-type-tag {
  color: #1e40af;
}

.btn-reveal {
  background-color: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-reveal:hover {
  background-color: #e2e8f0;
}

/* Dots and Controls */
.progress-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #cbd5e1;
  transition: background-color 0.3s, transform 0.3s;
}

.dot.active {
  background-color: var(--primary-color);
  transform: scale(1.3);
}

.flashcard-controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.btn-nav {
  flex: 1;
  background-color: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
  }

  .mobile-close {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .topbar {
    padding: 0 20px;
  }

  .content {
    padding: 20px;
  }

  .welcome-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
  }

  .welcome-text h2 {
    font-size: 22px;
  }
  
  .btn-primary {
    width: 100%;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;

}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;

}

.modal-content {
  background-color: var(--bg-color);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(0) scale(1);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 20px;

}

.modal-overlay.hidden .modal-content {
  transform: translateY(20px) scale(0.95);

}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);

}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;

}

.close-btn:hover {
  color: var(--text-main);
  background-color: #f1f5f9;

}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;

}

.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  background-color: #f8fafc;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;

}

.drop-zone:hover {
  border-color: var(--primary-color);
  background-color: #eff6ff;

}

.drop-zone.dragover {
  border-color: var(--primary-color);
  background-color: #eff6ff;
  transform: scale(1.02);

}

.hidden-file-input {
  display: none;

}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

}

.upload-icon {
  color: var(--primary-color);
  margin-bottom: 8px;

}

.drop-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);

}

.text-muted {
  color: var(--text-muted);

}

.text-primary {
  color: var(--primary-color);
  font-weight: 600;

}

.file-types {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;

}

.file-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 12px 16px;
  border-radius: 8px;
  width: 100%;

}

.file-display.hidden {
  display: none;

}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;

}

.file-icon {
  color: var(--primary-color);
  flex-shrink: 0;

}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e3a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

}

.remove-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #94a3b6;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;

}

.remove-btn:hover {
  color: #ef4444;

}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;

}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;

}

.divider:not(:empty)::before {
  margin-right: 0.5em;

}

.divider:not(:empty)::after {
  margin-left: 0.5em;

}

.text-input-area textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 0px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;

}

.text-input-area textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 249, 0.1);

}

.validation-message.hidden {
  display: none;

}

.w-full {
  width: 100%;

}

.btn-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;

}

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

.hidden {
  display: none !important;
}