/* AISA Portal - Design System */
:root {
  /* Primary Colors */
  --primary-color: #2ECC71;
  --primary-hover: #27AE60;
  --hover-color: #27AE60;
  --secondary-color: #FFFFFF;

  /* Text Colors */
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --text-accent: #BDC3C7;

  /* Background Colors */
  --bg-light: #F8F9FA;
  --bg-white: #FFFFFF;
  --bg-hover: #D4EFDF;

  /* Border Colors */
  --border-light: #EAEAEA;
  --border-medium: #BDC3C7;

  /* Notification Colors */
  --success: #27AE60;
  --warning: #F39C12;
  --error: #E74C3C;
  --info: #3498DB;

  /* Shadows */
  --shadow-light: 0px 2px 6px rgba(0,0,0,0.05);
  --shadow-medium: 0px 4px 12px rgba(0,0,0,0.1);
  --shadow-heavy: 0px 8px 24px rgba(0,0,0,0.15);

  /* Border Radius */
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 16px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Sidebar Colors - Dark Green Theme */
  --sidebar-bg: #1a4d3a;
  --sidebar-hover: #2d6a4f;
  --sidebar-active: #2ecc71;
  --sidebar-text: #e8f5e8;
  --sidebar-text-light: #f5fff9f6;
  --sidebar-text-hover: #ffffff;
  --sidebar-border: #2d6a4f;

  /* Sidebar Width */
  --sidebar-width: 240px;
}

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

body {
  font-family: 'Inter', 'Roboto', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-light);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* Layout Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.col {
  flex: 1;
  padding: 0 10px;
}

.col-1 { flex: 0 0 8.333%; }
.col-2 { flex: 0 0 16.667%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.333%; }
.col-6 { flex: 0 0 50%; }
.col-8 { flex: 0 0 66.667%; }
.col-9 { flex: 0 0 75%; }
.col-12 { flex: 0 0 100%; }

/* Cards */
.card {
  background: var(--secondary-color);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-light);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-small);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

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

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

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-small);
  font-size: 14px;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.justify-center { justify-content: center; }
.align-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .card {
    padding: 15px;
  }

  .btn {
    width: 100%;
    margin-bottom: 10px;
  }
}

/* Sidebar Styles */
.app-container {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-light);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  transition: var(--transition-normal);
  z-index: 1000;
  overflow-y: auto;
  box-shadow: var(--shadow-medium);
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .submenu-toggle {
  display: none;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 15px 10px;
}

.sidebar.collapsed .submenu {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-bg);
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #e8f5e8; /* Light green text */
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-small);
  transition: var(--transition-fast);
}

.sidebar-toggle:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.sidebar-nav {
  padding: 20px 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin-bottom: 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: var(--transition-fast);
  position: relative;
  gap: 10px;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}

.nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.nav-link.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-text-hover);
}

.nav-link i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  transition: var(--transition-fast);
  color: var(--sidebar-text-light);
}

.nav-link:hover i {
  color: var(--sidebar-text-hover);
}

.nav-link.active i {
  color: var(--sidebar-text-hover);
}

.nav-text {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
}

.has-submenu {
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.nav-link-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.submenu-toggle {
  font-size: 10px;
  transition: var(--transition-fast);
  color: #9CA3AF;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
}

.submenu {
  background-color: var(--sidebar-bg);
  border-left: 3px solid var(--sidebar-border);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: var(--transition-normal);
}

.submenu.expanded {
  max-height: 500px;
  padding: 10px 0;
}

.submenu-item {
  margin: 2px 0;
}

.submenu-link {
  display: block;
  padding: 8px 20px 8px 52px;
  color: #D1D5DB;
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}

.submenu-link:hover {
  background-color: var(--bg-hover);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

.submenu .nav-link {
  padding-left: 40px;
  color: var(--sidebar-text);
  font-size: 14px;
}

.submenu .nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.submenu .nav-link.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-text-hover);
}

.submenu .nav-link i {
  font-size: 14px;
  color: var(--sidebar-text-light);
}

.submenu .nav-link:hover i {
  color: var(--sidebar-text-hover);
}

.submenu .nav-link.active i {
  color: var(--sidebar-text-hover);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 240px;
  transition: var(--transition-normal);
}

.sidebar.collapsed + .main-content {
  margin-left: 70px;
}

.main-header {
  background-color: var(--secondary-color);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-light);
}

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

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-small);
}

.mobile-menu-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--primary-color);
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-small);
  transition: var(--transition-fast);
}

.user-menu-toggle:hover {
  background-color: var(--bg-hover);
}

.user-menu-toggle i {
  font-size: 20px;
  color: var(--text-secondary);
}

.user-menu-toggle span {
  font-size: 14px;
  color: var(--text-primary);
}

.content-wrapper {
  padding: 24px;
  max-width: 100%;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    width: 280px;
    transition: transform 0.3s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }

  .mobile-menu-toggle {
    display: block;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .content-wrapper {
    padding: 16px;
  }

  .main-header {
    padding: 12px 16px;
  }

  .page-title {
    font-size: 18px;
  }

  /* Improve touch targets on mobile */
  .nav-link,
  .submenu-link {
    padding: 12px 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
  }

  .nav-link:active,
  .submenu-link:active {
    opacity: 0.8;
  }

  /* Ensure proper touch interaction for menu items */
  .has-submenu {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .submenu-toggle {
    pointer-events: auto;
  }
}

/* Overlay for mobile - handled by JavaScript now */
@media (max-width: 768px) {
  /* Ensure sidebar is above overlay */
  .sidebar {
    z-index: 1001 !important;
  }

  /* All menu items must be clickable */
  .sidebar *,
  .sidebar .nav-link,
  .sidebar .submenu-link,
  .sidebar .submenu-toggle,
  .sidebar a {
    pointer-events: auto !important;
    cursor: pointer;
  }
}

/* Tooltips */
.nav-link[title] {
  position: relative;
}

.nav-link[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--text-primary);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  font-size: 12px;
  white-space: nowrap;
  z-index: 1001;
  margin-left: 10px;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: var(--secondary-color);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-medium);
  z-index: 1002;
  min-width: 300px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.notification i {
  font-size: 20px;
}

.notification-success i {
  color: var(--success);
}

.notification-error i {
  color: var(--error);
}

.notification-warning i {
  color: var(--warning);
}

.notification-info i {
  color: var(--info);
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Form Error Styles */
.form-control.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.field-error {
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
}

/* Table Responsive */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  min-width: 600px;
}

/* Update logo and brand text colors for dark green theme */
.sidebar-header .logo {
  color: var(--sidebar-text-hover);
  font-weight: 700;
  font-size: 20px;
}

.sidebar-header .brand {
  color: var(--sidebar-text);
  font-size: 14px;
  margin-top: 4px;
}

/* Mobile menu button styles */
.mobile-menu-btn {
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  border: 1px solid var(--sidebar-border);
}

.mobile-menu-btn:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
  border-color: var(--sidebar-active);
}

/* Custom font-face for MISTRAL (if needed) */
@font-face {
    font-family: 'Conv_MISTRAL';
    src: url('fonts/MISTRAL.eot');
    src: local('☺'), url('fonts/MISTRAL.woff') format('woff'), url('fonts/MISTRAL.ttf') format('truetype'), url('fonts/MISTRAL.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}