@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

:root {
  --primary-color: #4caf50;
  --secondary-color: #27ae60;
  --text-color: #333;
  --bg-color: #f9f9f9;
  --card-bg: #ffffff;
  --dark-gray: #495057;
  --light-gray: #f8f9fa;
  --white: #ffffff;
  --black: #000000;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
}

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

body {
  font-family: "Roboto", "Poppins", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Navigation */
.navbar {
  background-color: var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 1rem;
}

.navbar-brand img {
  height: 40px;
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: scale(1.05);
}

.nav-link {
  color: var(--dark-gray);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: color 0.2s ease, background-color 0.2s ease;
  border-radius: 5px;
}

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

.navbar-nav .dropdown-menu {
  border: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item {
  padding: 0.5rem 1.5rem;
  color: var(--dark-gray);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--light-gray);
  color: var(--primary-color);
}

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

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

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

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

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

.btn-login,
.btn-signup {
  padding: 0.5rem 1.5rem;
  font-weight: 500;
}

.btn-login {
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

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

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

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

/* Hero Section */
.hero {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: var(--white);
  text-align: center;
  padding: 8rem 0 6rem;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

/* Sections */
.section-title {
  text-align: center;
  font-size: 2rem;
  margin: 4rem 0 2rem;
}

/* Course Cards */
.courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.course-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.course-card:hover {
  transform: translateY(-5px);
}

.course-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.course-content {
  padding: 1.5rem;
}

.course-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.course-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.course-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.course-price {
  font-weight: 600;
  color: var(--primary-color);
}

/* Categories */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.category-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.category-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.category-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

/* Instructors */
.instructors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.instructor-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.instructor-card:hover {
  transform: translateY(-5px);
}

.instructor-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.instructor-content {
  padding: 1.5rem;
  text-align: center;
}

.instructor-name {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.instructor-title {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social-links a {
  color: var(--primary-color);
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: var(--secondary-color);
}

/* CTA Section */
.cta {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: var(--white);
  text-align: center;
  padding: 4rem 0;
  clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
}

.cta h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.cta p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

/* Footer */
.footer {
  background-color: var(--dark-gray);
  color: var(--white);
  padding: 2rem 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-section {
  flex: 1;
  min-width: 200px;
}

.footer-section h3 {
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: #ccc;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: var(--white);
}

.copyright {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: #ccc;
}

/* Login Page */
.login-container {
  height: 100vh;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  width: 400px;
  text-align: center;
}

.login-card h1 {
  color: var(--secondary-color);
  margin-bottom: 30px;
  font-weight: 600;
}

.input-group {
  position: relative;
  margin-bottom: 30px;
}

.input-group input {
  width: 100%;
  padding: 10px 0;
  font-size: 16px;
  color: var(--text-color);
  border: none;
  border-bottom: 2px solid #d9d9d9;
  outline: none;
  background: transparent;
  transition: 0.3s;
}

.input-group label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 10px 0;
  font-size: 16px;
  color: #666;
  pointer-events: none;
  transition: 0.3s;
}

.input-group input:focus ~ label,
.input-group input:valid ~ label {
  top: -20px;
  font-size: 12px;
  color: var(--primary-color);
}

.input-group input:focus,
.input-group input:valid {
  border-bottom: 2px solid var(--primary-color);
}

.register-link {
  margin-top: 20px;
  color: #666;
}

.register-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.register-link a:hover {
  text-decoration: underline;
}

/* Flash Messages */
#flash-messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  width: 90%;
  max-width: 400px;
}

.flash-message {
  display: inline-block;
  padding: 12px 24px;
  margin: 0 auto 15px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform: translateY(-20px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.flash-success {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: var(--white);
}

.flash-danger {
  background: linear-gradient(135deg, var(--danger-color), #f56565);
  color: var(--white);
}

.flash-info {
  background: linear-gradient(135deg, var(--info-color), #4299e1);
  color: var(--white);
}

.flash-warning {
  background: linear-gradient(135deg, var(--warning-color), #f6ad55);
  color: var(--white);
}

.flash-message-show {
  opacity: 1;
  transform: translateY(0);
}

.flash-message:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.1);
}

/* High-contrast styles */
.high-contrast .flash-message {
  background: var(--white);
  color: var(--text-color);
  text-shadow: none;
  border: 2px solid currentColor;
}

.high-contrast .flash-success {
  color: var(--primary-color);
}

.high-contrast .flash-danger {
  color: var(--danger-color);
}

.high-contrast .flash-info {
  color: var(--info-color);
}

.high-contrast .flash-warning {
  color: var(--warning-color);
}

/* Add to Home Screen Button */
.add-to-home {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.add-to-home:hover {
  background-color: var(--secondary-color);
}

/* User Dropdown */
.user-dropdown img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}

/* Responsive Design */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background-color: var(--white);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .navbar-nav {
    margin-bottom: 1rem;
  }

  .nav-item {
    margin-bottom: 0.5rem;
  }

  .btn-login,
  .btn-signup {
    display: inline-block;
    width: 60%;
    margin-bottom: 0.5rem;
  }

  .user-dropdown {
    text-align: center;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  .cta h2 {
    font-size: 2rem;
  }

  .cta p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  #flash-messages {
    width: 95%;
  }

  .flash-message {
    font-size: 14px;
    padding: 10px 20px;
  }
}

.post-form {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.post-form textarea {
  width: 100%;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  resize: none;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 16px;
}

.post-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.post {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

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

.post-author {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}

.post-meta {
  color: var(--text-secondary);
  font-size: 14px;
}

.post-content {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.6;
}

.post-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid #e4e6eb;
  padding-top: 16px;
}

.comments-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e4e6eb;
}

.comment {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 500;
  color: var(--text-primary);
}

.comment-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.comment-form {
  margin-top: 16px;
}

.comment-form textarea {
  width: 100%;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  resize: none;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.edit-form {
  display: none;
}

.edit-form.active {
  display: block;
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .post,
  .post-form {
    padding: 16px;
  }

  .post-actions {
    flex-wrap: wrap;
  }
}
