/* 
 * AppGrowthSuite - Main Stylesheet
 * A clean, modern design for the dashboard
 */

/* ===== Variables ===== */
:root {
  --primary: #4a6cf7;
  --primary-dark: #3a5bd9;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --light: #f8f9fa;
  --dark: #343a40;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  
  --font-family-sans-serif: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --border-radius: 0.25rem;
  --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  
  --sidebar-width: 250px;
  --footer-height: 60px;
}

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

body {
  font-family: var(--font-family-sans-serif);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--gray-700);
  background-color: var(--gray-100);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gray-900);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-light { color: var(--light) !important; }
.text-dark { color: var(--dark) !important; }
.text-muted { color: var(--gray-600) !important; }

/* ===== Layout ===== */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--dark);
  color: var(--light);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: all 0.3s;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.1);
  text-align: center;
}

.sidebar-header h3 {
  color: var(--light);
  margin: 0;
  font-size: 1.5rem;
}

.sidebar-logo-link {
  color: var(--light);
  text-decoration: none;
  display: block;
  transition: all 0.2s ease;
}

.sidebar-logo-link:hover {
  color: var(--light);
  opacity: 0.9;
  transform: scale(1.02);
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Sidebar Footer with Logout */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
}

.sidebar-footer .logout-link {
  color: var(--light);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background-color: var(--danger);
  border-radius: var(--border-radius);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-footer .logout-link:hover {
  background-color: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-footer .logout-link i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* Compact sidebar footer */
.sidebar.compact .sidebar-footer {
  padding: 0.75rem 0.5rem;
}

.sidebar.compact .sidebar-footer .logout-link {
  padding: 0.5rem 0;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border-radius: 50%;
}

.sidebar.compact .sidebar-footer .logout-link span {
  display: none;
}

.sidebar.compact .sidebar-footer .logout-link i {
  margin-right: 0;
  font-size: 1rem;
}

.sidebar.compact .sidebar-footer .logout-link::after {
  content: attr(data-title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 101;
  pointer-events: none;
  margin-left: 10px;
}

.sidebar.compact .sidebar-footer .logout-link:hover::after {
  opacity: 1;
  visibility: visible;
}

.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  padding: 1rem 1.5rem 0.5rem;
  margin-top: 0.5rem;
}

.sidebar-nav .nav-item {
  padding: 0;
}

.sidebar-nav .nav-link {
  padding: 0.5rem 1.5rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
  color: var(--light);
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
  color: var(--light);
  background-color: var(--primary);
}

.sidebar-nav .nav-link i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
  transition: all 0.2s;
}

.sidebar-nav .nav-link:hover i {
  opacity: 1;
  transform: translateX(2px);
}

.sidebar-nav .nav-link.active i {
  opacity: 1;
  color: var(--light);
}

/* Compact sidebar mode */
.sidebar.compact {
  width: 60px;
}

.sidebar.compact .sidebar-header h3 {
  display: none;
}

.sidebar.compact .sidebar-header {
  padding: 0.75rem 0;
}

.sidebar.compact .sidebar-logo-link {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar.compact .sidebar-logo-link::before {
  content: "";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f015"; /* fa-home icon */
  font-size: 1.5rem;
}

.sidebar.compact .sidebar-heading {
  text-align: center;
  padding: 0.75rem 0 0.25rem;
  font-size: 0.6rem;
  overflow: hidden;
  text-indent: -9999px; /* Hide the text */
  height: 30px; /* Set fixed height for consistency */
  position: relative;
}

.sidebar.compact .sidebar-heading::after {
  content: attr(data-initial);
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-400);
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-indent: 0; /* Reset text-indent for the initials */
}

.sidebar.compact .sidebar-nav .nav-link {
  padding: 0.75rem 0;
  justify-content: center;
  position: relative;
}

.sidebar.compact .sidebar-nav .nav-link span {
  display: none;
}

.sidebar.compact .sidebar-nav .nav-link i {
  margin-right: 0;
  font-size: 1.1rem;
}

/* Tooltip for compact sidebar */
.sidebar.compact .sidebar-nav .nav-link::after {
  content: attr(data-title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 101;
  pointer-events: none;
  margin-left: 10px;
}

.sidebar.compact .sidebar-nav .nav-link:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Adjust tooltip position for mobile */
@media (max-width: 768px) {
  .sidebar {
    width: 60px; /* Always show in compact mode */
  }
  
  .main-content {
    margin-left: 60px;
  }
  
  /* Force compact mode on mobile */
  .sidebar {
    transform: none !important; /* Override any transform */
  }
  
  .sidebar.compact {
    width: 60px;
  }
}

@media (min-width: 769px) {
  .sidebar {
    transition: width 0.3s ease;
  }
  
  .sidebar.hidden {
    width: 0;
    overflow: hidden;
  }
  
  .main-content {
    transition: margin-left 0.3s ease;
  }
  
  .sidebar.hidden + .main-content {
    margin-left: 0;
  }
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s;
}

/* Adjust main content when sidebar is compact */
.sidebar.compact + .main-content {
  margin-left: 60px;
}

/* Content */
.content {
  flex: 1;
  padding: 1.5rem;
  background-color: var(--gray-100);
}

.page-title {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title h1 {
  margin: 0;
  font-size: 1.75rem;
}

/* Footer */
.footer {
  height: var(--footer-height);
  background-color: white;
  border-top: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* ===== Components ===== */

/* Cards */
.card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 1rem 1.25rem;
  background-color: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  background-color: white;
  border-top: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  border-radius: var(--border-radius);
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

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

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

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

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

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

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

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

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.btn-lg {
  padding: 0.5rem 1rem;
  font-size: 1.1rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--gray-700);
  background-color: white;
  background-clip: padding-box;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  color: var(--gray-700);
  background-color: white;
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(74, 108, 247, 0.25);
}

/* Tables */
.table {
  width: 100%;
  margin-bottom: 1rem;
  background-color: transparent;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: top;
  border-top: 1px solid var(--gray-200);
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--gray-200);
  background-color: var(--gray-100);
  color: var(--gray-700);
  font-weight: 500;
}

.table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* Alerts */
.alert {
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
}

.alert-primary {
  color: #004085;
  background-color: #cce5ff;
  border-color: #b8daff;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: var(--border-radius);
}

.badge-primary { background-color: var(--primary); color: white; }
.badge-secondary { background-color: var(--secondary); color: white; }
.badge-success { background-color: var(--success); color: white; }
.badge-danger { background-color: var(--danger); color: white; }
.badge-warning { background-color: var(--warning); color: var(--dark); }
.badge-info { background-color: var(--info); color: white; }

/* ===== Utilities ===== */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--gray-100);
}

.login-form {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Dashboard Widgets ===== */
.stats-card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
}

.stats-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(74, 108, 247, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-right: 1rem;
}

.stats-info {
  flex: 1;
}

.stats-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.stats-label {
  color: var(--gray-600);
  font-size: 0.875rem;
}

.chart-container {
  position: relative;
  height: 300px;
  margin-bottom: 1.5rem;
}

/* ===== Animation ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

/* Country flag styles */
.country-flag {
    font-size: 1.5rem;
    display: inline-block;
    transition: transform 0.2s ease;
}
