/* Enhanced Index.css - Modern Design with Improved UX for Skill Carrot LMS */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --primary-color: #0b5394;
  --primary-dark: #00695c;
  --primary-light: #4db6ac;
  --secondary-color: #ff7043;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --text-primary: #212121;
  --text-secondary: #757575;
  --background-color: #fafafa;
  --surface-color: #ffffff;
  --border-color: #e0e0e0;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.12);
  --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ===== INITIAL LOADING OVERLAY ===== */
.initial-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  color: white;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.loading-content {
  text-align: center;
  padding: 2rem;
}

.loading-text {
  margin: 2rem 0 0.5rem 0;
  font-weight: 300;
  font-size: 1.8rem;
}

.loading-subtitle {
  margin: 0;
  opacity: 0.8;
  font-size: 1rem;
}

/* ===== HERO SECTION ENHANCEMENTS ===== */
.left-section {
  position: relative;
  overflow: hidden;
}

.hero-content {
  animation: fadeInUp 1s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FORM ENHANCEMENTS ===== */
.auth-form {
  animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.input-field {
  position: relative;
}

.input-field input {
  background-color: transparent;
  border: none;
  border-bottom: 2px solid var(--border-color);
  border-radius: 0;
  outline: none;
  height: 3rem;
  width: 100%;
  font-size: 1rem;
  margin: 0;
  padding: 0 0 0 3rem;
  box-shadow: none;
  transition: var(--transition);
}

.input-field input:focus {
  border-bottom: 2px solid var(--primary-color);
  box-shadow: 0 1px 0 0 var(--primary-color);
}

.input-field input.valid {
  border-bottom: 2px solid var(--success-color);
  box-shadow: 0 1px 0 0 var(--success-color);
}

.input-field input.invalid {
  border-bottom: 2px solid var(--error-color);
  box-shadow: 0 1px 0 0 var(--error-color);
}

.input-field label {
  color: var(--text-secondary);
  position: absolute;
  font-size: 1rem;
  cursor: text;
  transition: var(--transition);
  transform-origin: 0% 100%;
  text-align: initial;
  transform: translateY(0);
}

.input-field label.active {
  transform: translateY(-140%) scale(0.8);
  color: var(--primary-color);
}

.input-field input:focus + label {
  color: var(--primary-color);
}

.input-field input.valid + label {
  color: var(--success-color);
}

.input-field input.invalid + label {
  color: var(--error-color);
}

.input-field .prefix {
  position: absolute;
  width: 3rem;
  font-size: 1.2rem;
  transition: var(--transition);
  top: 0.8rem;
  color: var(--text-secondary);
}

.input-field .prefix.active {
  color: var(--primary-color);
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  display: block;
  opacity: 0;
  transform: translateY(-10px);
  transition: var(--transition);
}

.helper-text.password-help {
  opacity: 1;
  transform: translateY(0);
}

.input-field input.invalid ~ .helper-text[data-error],
.input-field input.valid ~ .helper-text[data-success] {
  opacity: 1;
  transform: translateY(0);
}

.input-field input.invalid ~ .helper-text[data-error] {
  color: var(--error-color);
}

.input-field input.valid ~ .helper-text[data-success] {
  color: var(--success-color);
}

/* ===== BUTTON ENHANCEMENTS ===== */
.auth-btn {
  width: 100%;
  margin: 0 0 0 0;
  height: 3.5rem;
  border-radius: var(--border-radius);
  text-transform: none;
  font-weight: 500;
  font-size: 1rem;
  box-shadow: var(--shadow-medium);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  border: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.auth-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.auth-btn:hover::before {
  left: 100%;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(38, 166, 154, 0.3);
}

.auth-btn:active {
  transform: translateY(0);
}

.btn {
  border-radius: var(--border-radius);
  text-transform: none;
  font-weight: 500;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

/* ===== FORM LINKS ===== */
.form-links {
  margin-top: 1.5rem;
}

.form-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.form-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.form-link:hover::after {
  width: 100%;
}

.form-link:hover {
  color: var(--primary-dark);
}

/* ===== ERROR AND SUCCESS MESSAGES ===== */
.error-message,
.success-message {
  padding: 0.75rem;
  border-radius: var(--border-radius);

  font-weight: 500;
  opacity: 0;
  transform: translateY(-10px);
  transition: var(--transition);
}

.error-message.show,
.success-message.show {
  opacity: 1;
  transform: translateY(0);
}

.error-message {
  background-color: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error-color);
}

.success-message {
  background-color: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: var(--success-color);
}

/* ===== HAMBURGER MENU - FIXED SELECTOR FOR LOGGED-IN MOBILE USERS ===== */
.hamburger-menu {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-medium);
  transition: var(--transition);
}

.hamburger-menu:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-heavy);
}

.hamburger-menu:active {
  transform: scale(0.98);
}

/* FIXED: Only show hamburger menu for logged-in users on mobile */
@media only screen and (max-width: 768px) {
  .logged-in.hamburger-menu {
    display: flex;
  }
}

/* ===== NAVIGATION STYLES ===== */
.sidenavbar {
  height: 100%;
  width: 18rem;
  position: fixed;
  top: 0;
  left: 0;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 999;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
  transition: var(--transition);
}

.sidenavbar.open {
  transform: translateX(0);
}

/* Sidebar Header */
.sidebar-header {
  padding: 2rem 1rem 1rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  line-height: normal;
}

.company-logo {
  height: 3.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: var(--transition);
  filter: brightness(0) invert(1);
}

.company-logo:hover {
  transform: scale(1.05);
}

.company-info {
  color: white;
  font-size: 0.9rem;
}

.company-info p {
  margin: 0;
  font-weight: 500;
  opacity: 0.9;
}

/* Module and Submodule Styles */
.module {
  padding: 0 1rem;
  margin: 0.1rem 1rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  text-decoration: none;
  line-height: 48px;
}

.module:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
  color: white;
}

.module:focus {
  background-color: rgba(255, 255, 255, 0.2);
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.module i {
  font-size: 1.2rem;
  width: 20px;
  text-align: center;
}

.submodule {
  padding: 0 1.5rem 0 3.5rem;
  margin: 0.05rem 1rem;
  border-radius: var(--border-radius);
  display: none;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  text-decoration: none;
  line-height: 48px;
}

.submodule::before {
  position: absolute;
  left: 2rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
}

.submodule:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(6px);
}

.submodule.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: #1e51db;
  font-weight: 500;
  box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.8);
}

.logout-btn:hover {
  background-color: rgba(244, 67, 54, 0.2);
}

/* Divider */
.divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  transition: var(--transition);
  min-height: 100vh;
  background-color: var(--background-color);
  width: -webkit-fill-available;
}

/* Desktop styles */
@media only screen and (min-width: 993px) {
  .sidenavbar.open ~ .main-content {
    margin-left: 18rem;
  }
}

/* ===== CARD ENHANCEMENTS ===== */
.card {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
}

.card-panel {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
}

/* ===== TABLE ENHANCEMENTS ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  background-color: var(--surface-color);
}

table {
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: var(--surface-color);
}

table thead {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
}

table thead th {
  color: white;
  font-weight: 500;
  padding: 1.2rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table tbody tr {
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
  background-color: rgba(38, 166, 154, 0.05);
}

table tbody td {
  padding: 1rem 1.2rem;
}

/* ===== MODAL ENHANCEMENTS ===== */
.modal {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-heavy);
}

.modal-content {
  padding: 2rem;
  text-align: center;
}

.modal-content h4,
.modal-content h5,
.modal-content p,
.modal-content div {
  text-align: center;
}

.modal-footer {
  padding: 1rem 2rem;
  background-color: var(--background-color);
  border-top: 1px solid var(--border-color);
}

/* ===== TOAST ENHANCEMENTS ===== */
.toast {
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  font-weight: 500;
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(10px);
}

/* ===== UTILITY CLASSES ===== */
.elevation-1 {
  box-shadow: var(--shadow-light);
}
.elevation-2 {
  box-shadow: var(--shadow-medium);
}
.elevation-3 {
  box-shadow: var(--shadow-heavy);
}

.rounded {
  border-radius: var(--border-radius);
}
.rounded-lg {
  border-radius: var(--border-radius-lg);
}

.transition {
  transition: var(--transition);
}

/* ===== LOADING STATES ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--border-radius);
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

/* ===== ANIMATIONS ===== */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}
.slide-in-left {
  animation: slideInLeft 0.4s ease forwards;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet styles */
@media only screen and (max-width: 992px) {
  .right-section {
    margin: 1rem;
    padding: 2rem;
  }
}

/* Mobile styles */
@media only screen and (max-width: 768px) {
  body {
    flex-direction: column;
    min-height: 100vh;
  }

  .left-section {
    height: 45vh;
    background-size: cover;
    background-position: center;
  }

  .hero-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .hero-content p {
    font-size: 1.1rem;
  }

  .hero-content img {
    height: 4rem;
    margin-bottom: 1rem;
  }

  .right-section {
    flex: 1;
    margin: 0;
    padding: 2rem 1.5rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    min-height: 55vh;
  }

  .right-section h5 {
    font-size: 1.8rem;
  }

  .sidenavbar {
    width: 280px;
    padding-top: 0;
  }

  .main-content {
    margin-top: 0;
  }

  /* Form adjustments for mobile */
  .input-field {
    margin-bottom: 1.5rem;
  }

  .auth-btn {
    height: 3rem;
    margin: 0 0 0 0;
  }

  /* Table responsiveness */
  .table-container {
    font-size: 0.9rem;
  }

  /* Card adjustments */
  .card-content {
    padding: 1.5rem;
  }

  /* Modal adjustments */
  .modal {
    width: 95% !important;
    max-height: 90% !important;
  }

  .modal-content {
    padding: 1.5rem;
  }
}

/* Extra small mobile */
@media only screen and (max-width: 480px) {
  .right-section {
    padding: 1.5rem 1rem;
  }

  .hero-content {
    padding: 1rem;
  }

  .hero-content h2 {
    font-size: 1.8rem;
  }

  .hamburger-menu {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    top: 0.5rem;
    left: 0.5rem;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
/* Focus styles */
*:focus {
  /* outline: 2px solid var(--primary-color); */
  outline-offset: 2px;
}

.btn:focus,
.btn-floating:focus {
  outline: 2px solid #fff;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .sidenavbar {
    background: var(--primary-dark);
    border-right: 2px solid #fff;
  }

  .module,
  .submodule {
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .card,
  .card-panel {
    border: 2px solid var(--border-color);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidenavbar,
  .hamburger-menu,
  .btn-floating,
  .modal {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* ===== DARK MODE PREPARATION ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
  }

  body {
    background-color: var(--background-color);
    color: var(--text-primary);
  }

  .card,
  .card-panel {
    background-color: var(--surface-color);
    color: var(--text-primary);
  }

  .main-content {
    background-color: var(--background-color);
  }

  .right-section {
    background-color: var(--surface-color);
  }
}

/* ===== CUSTOM MATERIALIZE OVERRIDES ===== */
/* Improve color palette */
.teal.darken-2 {
  background-color: var(--primary-dark) !important;
}

.teal.lighten-1 {
  background-color: var(--primary-color) !important;
}

/* Improve input focus colors */
.input-field input[type="text"]:focus + label,
.input-field input[type="email"]:focus + label,
.input-field input[type="password"]:focus + label,
.input-field input[type="tel"]:focus + label {
  color: var(--primary-color) !important;
}

.input-field input[type="text"]:focus,
.input-field input[type="email"]:focus,
.input-field input[type="password"]:focus,
.input-field input[type="tel"]:focus {
  border-bottom: 1px solid var(--primary-color) !important;
  box-shadow: 0 1px 0 0 var(--primary-color) !important;
}

/* Improve button colors */
.btn,
.btn-large {
  background-color: var(--primary-color);
}

.btn:hover,
.btn-large:hover {
  background-color: var(--primary-dark);
}

/* Improve form validation colors */
.input-field .prefix.active {
  color: var(--primary-color);
}

/* ===== ERROR STATES ===== */
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.error-state i {
  font-size: 4rem;
  color: var(--error-color);
  margin-bottom: 1rem;
}

/* ===== SUCCESS STATES ===== */
.success-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.success-state i {
  font-size: 4rem;
  color: var(--success-color);
  margin-bottom: 1rem;
}

/* ===== SCROLL BAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== SMOOTH SCROLLING ===== */
html {
  scroll-behavior: smooth;
}

/* ===== SELECTION STYLING ===== */
::selection {
  background-color: rgba(38, 166, 154, 0.2);
  color: var(--text-primary);
}

/* ===== ADDITIONAL UTILITY CLASSES ===== */
.text-gradient {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.backdrop-blur {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* GPU acceleration for animations */
.hardware-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}
