/* ========== Admin Panel CSS ========== */
/* Modern, clean, responsive design with minimalistic approach */

/* CSS Variables for consistent theming */
:root {
    /* Color Palette */
    --color-primary: #4a6cf7;
    --color-primary-hover: #3a5ce4;
    --color-danger: #e53e3e;
    --color-danger-hover: #c53030;
    --color-success: #38a169;
    --color-success-hover: #2f855a;
    --color-background: #f8fafc;
    --color-sidebar: #1e293b;
    --color-header: #0f172a;
    --color-text: #334155;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-input-border: #cbd5e1;
    --color-input-focus: #4a6cf7;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Sidebar Width */
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 70px;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
  }
  
  /* ========== Base Styles ========== */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.5;
    font-size: 16px;
    min-height: 100vh;
  }
  
  /* ========== Layout Components ========== */
  /* Header */
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--color-header);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--spacing-lg);
    z-index: 100;
    box-shadow: var(--shadow-sm);
  }
  
  /* Sidebar */
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 60px);
    background-color: var(--color-sidebar);
    overflow-y: auto;
    transition: width var(--transition-normal);
    z-index: 90;
    box-shadow: var(--shadow-md);
  }
  
  .sidebar a {
    display: block;
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    text-decoration: none;
    transition: background-color var(--transition-fast);
    border-left: 3px solid transparent;
  }
  
  .sidebar a:hover, 
  .sidebar a.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--color-primary);
  }
  
  /* Main Content */
  .main-content {
    margin-left: var(--sidebar-width);
    margin-top: 60px;
    padding: var(--spacing-xl);
    min-height: calc(100vh - 60px);
    transition: margin-left var(--transition-normal);
  }
  
  /* ========== Card Component ========== */
  .card {
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    animation: cardEntry 0.3s ease-out;
  }
  
  .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
  }
  
  @keyframes cardEntry {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* ========== Form Elements ========== */
  form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
  }
  
  /* Label styling */
  label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--color-text);
  }
  
  /* Input fields */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--color-text);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }
  
  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="password"]:focus,
  input[type="date"]:focus,
  input[type="number"]:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: var(--color-input-focus);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
  }
  
  /* Select styling */
  select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
  }
  
  /* Multiple select */
  select[multiple] {
    height: 150px;
    padding: var(--spacing-sm);
    background-image: none;
    overflow-y: auto;
  }
  
  select[multiple] option {
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
  }
  
  select[multiple] option:checked {
    background-color: rgba(74, 108, 247, 0.1);
    color: var(--color-primary);
  }
  
  /* Buttons */
  button {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    font-size: 1rem;
  }
  
  button:hover {
    transform: translateY(-1px);
  }
  
  button:active {
    transform: translateY(1px);
  }
  
  /* Primary button (green) */
  button.primary,
  button[type="submit"] {
    background-color: var(--color-primary);
    color: white;
  }
  
  button.primary:hover,
  button[type="submit"]:hover {
    background-color: var(--color-primary-hover);
  }
  
  /* Danger button (red) */
  button.danger {
    background-color: var(--color-danger);
    color: white;
  }
  
  button.danger:hover {
    background-color: var(--color-danger-hover);
  }
  
  /* Secondary button (outline) */
  button.secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
  }
  
  button.secondary:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
  
  /* ========== Table Styling ========== */
  .table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
  }
  
  .table thead {
    background-color: var(--color-sidebar);
    color: white;
  }
  
  .table th {
    text-align: left;
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
  }
  
  .table tbody tr {
    background-color: white;
    transition: background-color var(--transition-fast);
  }
  
  .table tbody tr:hover {
    background-color: rgba(74, 108, 247, 0.05);
  }
  
  .table tbody tr:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
  }
  
  .table td {
    padding: var(--spacing-md) var(--spacing-lg);
    vertical-align: middle;
  }
  
  /* ========== Message Styling ========== */
  /* Error messages */
  div[style*="color: red"] {
    color: var(--color-danger) !important;
    background-color: rgba(229, 62, 62, 0.1);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-danger);
    margin-bottom: var(--spacing-md);
  }
  
  /* Success messages */
  div[style*="color: green"] {
    color: var(--color-success) !important;
    background-color: rgba(56, 161, 105, 0.1);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-success);
    margin-bottom: var(--spacing-md);
  }
  
  /* ========== Responsive Design ========== */
  /* Tablet */
  @media (max-width: 1024px) {
    :root {
      --sidebar-width: 200px;
    }
    
    .main-content {
      padding: var(--spacing-lg);
    }
  }
  
  /* Mobile */
  @media (max-width: 768px) {
    :root {
      --sidebar-width: 0;
    }
    
    .header {
      justify-content: flex-start;
    }
    
    .sidebar {
      transform: translateX(-100%);
      box-shadow: var(--shadow-lg);
      width: 250px;
    }
    
    .sidebar.open {
      transform: translateX(0);
    }
    
    .main-content {
      margin-left: 0;
      padding: var(--spacing-md);
    }
    
    .table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
    
    /* Mobile menu toggle button */
    .menu-toggle {
      display: block;
      background: none;
      border: none;
      color: white;
      font-size: 1.5rem;
      cursor: pointer;
      margin-right: var(--spacing-md);
    }
  }
  
  /* Small mobile devices */
  @media (max-width: 480px) {
    .card {
      padding: var(--spacing-md);
    }
    
    form {
      gap: var(--spacing-sm);
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    select,
    textarea {
      padding: var(--spacing-sm);
    }
    
    button {
      padding: var(--spacing-sm) var(--spacing-md);
    }
  }
  
  /* ========== Utility Classes ========== */
  .flex {
    display: flex;
  }
  
  .flex-col {
    flex-direction: column;
  }
  
  .items-center {
    align-items: center;
  }
  
  .justify-between {
    justify-content: space-between;
  }
  
  .gap-sm {
    gap: var(--spacing-sm);
  }
  
  .gap-md {
    gap: var(--spacing-md);
  }
  
  .gap-lg {
    gap: var(--spacing-lg);
  }
  
  .mb-sm {
    margin-bottom: var(--spacing-sm);
  }
  
  .mb-md {
    margin-bottom: var(--spacing-md);
  }
  
  .mb-lg {
    margin-bottom: var(--spacing-lg);
  }
  
  .mt-sm {
    margin-top: var(--spacing-sm);
  }
  
  .mt-md {
    margin-top: var(--spacing-md);
  }
  
  .mt-lg {
    margin-top: var(--spacing-lg);
  }
  
  .p-md {
    padding: var(--spacing-md);
  }
  
  .p-lg {
    padding: var(--spacing-lg);
  }
  
  .text-center {
    text-align: center;
  }
  
  .text-right {
    text-align: right;
  }
  
  .text-sm {
    font-size: 0.875rem;
  }
  
  .text-lg {
    font-size: 1.125rem;
  }
  
  .font-bold {
    font-weight: 700;
  }
  
  .text-primary {
    color: var(--color-primary);
  }
  
  .text-danger {
    color: var(--color-danger);
  }
  
  .text-success {
    color: var(--color-success);
  }
  
  .text-light {
    color: var(--color-text-light);
  }
  
  .w-full {
    width: 100%;
  }
  
  .hidden {
    display: none;
  }
  
  /* For JavaScript toggle functionality */
  .sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
  }
  
  .sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
  }
  
  .sidebar-collapsed .sidebar a span {
    display: none;
  }
  
  .sidebar-collapsed .sidebar a {
    display: flex;
    justify-content: center;
    padding: var(--spacing-md);
  }
  
  .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.filters input[type="date"],
.filters select,
.filters button {
    max-width: 100%;
}

.filters button {
    min-width: 120px;
}

/* Modern Marketing Table Styling - Enhanced Version */
#marketingTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background-color: white;
}

/* Header styling */
#marketingTable thead {
  background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

#marketingTable th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, #ffffff, #f8fafc);
  z-index: 10;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

#marketingTable th:first-child {
  border-top-left-radius: 8px;
}

#marketingTable th:last-child {
  border-top-right-radius: 8px;
}

/* Body styling */
#marketingTable tbody tr {
  transition: all 0.2s ease;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

#marketingTable tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#marketingTable td {
  padding: 14px 16px;
  color: #475569;
  border-right: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

#marketingTable td:last-child {
  border-right: none;
}

/* Hierarchical styling for group headers */
#marketingTable .level-1 {
  background: linear-gradient(to right, #f8fafc, #ffffff);
  font-weight: 600;
  border-left: 4px solid #0ea5e9;
}

#marketingTable .level-1 td {
  color: #334155;
}

#marketingTable .level-2 {
  background-color: #ffffff;
  border-left: 4px solid #a5b4fc;
}

#marketingTable .level-2 td:first-child {
  padding-left: 28px;
}

#marketingTable .level-3 {
  background-color: #ffffff;
  border-left: 4px solid transparent;
}

#marketingTable .level-3 td:first-child {
  padding-left: 42px;
}

/* Indentation for hierarchical levels with modern indicators */
#marketingTable .level-2 td:first-child::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-left: 1.5px solid #cbd5e1;
  border-bottom: 1.5px solid #cbd5e1;
  margin-right: 8px;
  position: relative;
  top: -2px;
}

#marketingTable .level-3 td:first-child::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #cbd5e1;
  margin-right: 8px;
  position: relative;
  top: -2px;
}

/* Footer styling */
#marketingTable tfoot {
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
}

#marketingTable tfoot td {
  padding: 16px;
  color: #0f172a;
  font-weight: 700;
  border-top: 2px solid #e2e8f0;
  border-bottom: none;
}

#marketingTable tfoot tr:last-child td:first-child {
  border-bottom-left-radius: 8px;
}

#marketingTable tfoot tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}

/* Numeric value alignment with modern styling */
#marketingTable td:nth-child(n + 2),
#marketingTable th:nth-child(n + 2) {
  text-align: right;
}

/* Value formatting and indicators */
#marketingTable td:nth-child(2) {
  font-weight: 600;
  color: #0f172a;
  position: relative;
}

#marketingTable td:nth-child(2)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  background: linear-gradient(to right, transparent, rgba(14, 165, 233, 0.3));
  border-radius: 2px;
  opacity: 0.5;
}

/* Highlight positive values with modern indicators */ 
#marketingTable td:nth-child(8):not(:empty):not([0]):not(:contains("-")) {
  color: #0891b2;
  position: relative;
}

#marketingTable td:nth-child(8):not(:empty):not([0]):not(:contains("-"))::before {
  content: "▲";
  font-size: 10px;
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  color: #0891b2;
  opacity: 0.5;
}

#marketingTable td:nth-child(9):not(:empty):not([0]) {
  color: #0d9488;
  font-weight: 600;
}

#marketingTable td:nth-child(11):not(:empty):not([0]) {
  color: #8b5cf6;
  font-weight: 600;
  position: relative;
}

#marketingTable td:nth-child(11):not(:empty):not([0])::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  background: linear-gradient(to right, transparent, rgba(139, 92, 246, 0.3));
  border-radius: 2px;
  opacity: 0.5;
}

/* Empty or dash values styling */
#marketingTable td:empty,
#marketingTable td:contains("-") {
  color: #cbd5e1;
  font-style: italic;
}

/* Responsive design */
@media (max-width: 1200px) {
  #marketingTable {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Expandable/collapsible functionality with modern indicators */
#marketingTable .group-header td:first-child {
  position: relative;
}

#marketingTable .group-header.expanded td:first-child::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-color: #f1f5f9;
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
  transition: transform 0.2s ease;
}

#marketingTable .group-header:not(.expanded) td:first-child::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  width: 14px;
  height: 14px;
  background-color: #f1f5f9;
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
  transition: transform 0.2s ease;
}

/* Row highlighting based on performance */
#marketingTable tr:has(td:nth-child(9):not(:empty):not([0])) {
  background-color: rgba(240, 253, 250, 0.5);
}

/* Highlight rows with deposits */
#marketingTable tr:has(td:nth-child(11):not(:empty):not([0])) {
  background-color: rgba(245, 243, 255, 0.5);
}

/* Cell borders and spacing */
#marketingTable th,
#marketingTable td {
  position: relative;
}

/* Add subtle cell borders */
#marketingTable th::after,
#marketingTable td::after {
  content: "";
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background-color: #f1f5f9;
}

#marketingTable th:last-child::after,
#marketingTable td:last-child::after {
  display: none;
}

/* Add hover effect for cells */
#marketingTable td:hover {
  background-color: rgba(241, 245, 249, 0.5);
}

/* Add subtle animation for expanding/collapsing */
#marketingTable tbody tr {
  transition: all 0.3s ease;
}

/* Add box shadow to the table */
#marketingTable {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Add subtle gradient background to header */
#marketingTable thead {
  background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

/* Add subtle gradient background to footer */
#marketingTable tfoot {
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
}
