/* 
 * Anaaonline Admin Panel - Main Stylesheet
 * Features: CSS Variables, Dark/Light Mode, Responsive Grid, Modern UI Components
 */

:root {
  /* Colors - Light Mode (Default) */
  --primary-color: #4361ee;
  --primary-hover: #3a56d4;
  --secondary-color: #7209b7;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
  --info-color: #3498db;
  --dark-color: #2b2d42;
  --teal-color: #008080;
  --light-color: #f8f9fa;

  /* Status Colors */
  --status-active-bg: #d4edda;
  --status-active-text: #155724;
  --status-expired-bg: #f8d7da;
  --status-expired-text: #721c24;
  --status-pending-bg: #fff3cd;
  --status-pending-text: #856404;

  /* Neutral Colors */
  --bg-body: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-main: #333333;
  --text-muted: #6c757d;
  --border-color: #e0e0e0;
  --shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  /* Action Icon Colors */
  --edit-bg: rgba(52, 152, 219, 0.1);
  --delete-bg: rgba(231, 76, 60, 0.1);
  --view-bg: rgba(46, 204, 113, 0.1);

  /* Layout Constants */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 200px;
  --header-height: 70px;
  --transition-speed: 0.3s;
}

/* Dark Mode Variables */
body.dark-mode {
  --bg-body: #1a1a2e;
  --bg-sidebar: #16213e;
  --bg-card: #16213e;
  --text-main: #e9ecef;
  --text-muted: #adb5bd;
  --border-color: #2d3436;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);

  --status-active-bg: rgba(46, 204, 113, 0.2);
  --status-expired-bg: rgba(231, 76, 60, 0.2);
  --status-pending-bg: rgba(243, 156, 18, 0.2);
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  overflow-x: hidden;
  transition: background-color var(--transition-speed);
}

a {
  text-decoration: none;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  outline: transparent;
}
ul {
  list-style: none;
}

/* Accessibility: Focus indicator for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Page Visibility (SPA) */
.page {
  display: none;
  min-height: 100vh;
}

.page.active {
  display: block;
}

.content-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.content-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login Page Styling */
.login-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
}

.login-box {
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  margin-bottom: 2rem;
}
.login-logo i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.login-logo h1 {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}
.login-logo p {
  color: var(--text-muted);
}

.input-group {
  text-align: left;
  margin-bottom: 1.2rem;
}
.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}
.input-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
}

.password-wrapper {
  position: relative;
}
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  color: var(--text-muted);
}

.btn-login {
  width: 100%;
  padding: 0.9rem;
  background: var(--primary-color);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 1rem;
  transition: background var(--transition-speed);
}

.btn-login:hover {
  background: var(--primary-hover);
}
.error-message {
  color: var(--danger-color);
  font-size: 0.85rem;
  margin-top: 1rem;
  min-height: 1.2rem;
}

/* Dashboard Layout */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1050; /* Raised to ensure it overrides top-header and content */
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
  transition:
    width var(--transition-speed),
    transform var(--transition-speed),
    box-shadow var(--transition-speed);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary-color);
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 1.5rem;
  justify-content: flex-start;
}

/* Names remain visible as requested */

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.5rem;
  color: var(--text-main);
  gap: 15px;
  transition: all 0.2s;
  white-space: nowrap;
  opacity: 0.8;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
  opacity: 1;
  border-right: 3px solid var(--primary-color);
}

.sidebar.collapsed .nav-item {
  padding: 0.8rem 1.5rem;
  justify-content: flex-start;
}

.nav-item i {
  font-size: 1.2rem;
  min-width: 25px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}
.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem;
  border-radius: 6px;
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger-color);
  font-weight: 500;
  overflow: hidden;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-speed);
  padding-bottom: 2rem;
}

.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-search {
  background: var(--bg-body);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 400px;
  gap: 10px;
}

.header-search input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-main);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}
.badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--danger-color);
  color: white;
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 10px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.user-profile i {
  font-size: 2rem;
  color: var(--text-muted);
}

/* Dashboard Sections */
.content-section {
  padding: 2rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.bg-blue {
  background: var(--primary-color);
}
.bg-green {
  background: var(--success-color);
}
.bg-orange {
  background: var(--warning-color);
}
.bg-red {
  background: var(--danger-color);
}
.bg-purple {
  background: var(--secondary-color);
}
.bg-teal {
  background: var(--teal-color);
}

.stat-info h3 {
  font-size: 1.6rem;
  margin-bottom: 2px;
}
.stat-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Dashboard Grids */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.dashboard-card.wide {
  grid-column: span 2;
}
.dashboard-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tables */
.table-container {
  background: var(--bg-card);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: rgba(0, 0, 0, 0.02);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.01);
}

/* Status Badges */
.status-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}
.status-active::before {
  background: var(--status-active-text);
}

.status-expired {
  background: var(--status-expired-bg);
  color: var(--status-expired-text);
}
.status-expired::before {
  background: var(--status-expired-text);
}

.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
}
.status-pending::before {
  background: var(--status-pending-text);
}

/* Dark mode text readability */
body.dark-mode .status-active {
  color: #2ecc71;
}
body.dark-mode .status-active::before {
  background: #2ecc71;
}
body.dark-mode .status-expired {
  color: #e74c3c;
}
body.dark-mode .status-expired::before {
  background: #e74c3c;
}
body.dark-mode .status-pending {
  color: #f39c12;
}
body.dark-mode .status-pending::before {
  background: #f39c12;
}

/* Forms */
.customer-form {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
}

.form-section h3 {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--light-color);
  color: var(--dark-color);
  border: 1px solid var(--border-color);
}
.btn-danger {
  background: var(--danger-color);
  color: white;
}
.btn-success {
  background: var(--success-color);
  color: white;
}
.btn-text {
  background: transparent;
  color: var(--primary-color);
}

/* Filter Panel */
.filters-panel {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}
.filter-group label {
  font-size: 0.8rem;
  margin-bottom: 5px;
  display: block;
}

/* Renewal Lists */
.renewals-list,
.activity-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.renewal-item,
.activity-item,
.history-item {
  padding: 10px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-info h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Calendar Styling */
.calendar-container {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border-color);
}

.calendar-day {
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
}

.calendar-day-header {
  font-weight: bold;
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.calendar-event {
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--primary-color);
  color: white;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-task {
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--secondary-color);
  color: white;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Communication Center */
.communications-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.comm-panel {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.comm-panel.wide {
  grid-column: span 2;
}
.comm-panel h3 {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.settings-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.settings-card h3 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}
input:checked + .slider:before {
  transform: translateX(24px);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  backdrop-filter: blur(2px);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  width: 90%;
  max-width: 600px;
  border-radius: 12px;
  z-index: 2001;
  display: none;
  flex-direction: column;
  max-height: 90vh;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 250px;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 5px solid var(--primary-color);
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .communications-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }
  .sidebar.mobile-active {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
  }
  .main-content {
    margin-left: 0 !important;
  }
  .header-search {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-card.wide {
    grid-column: span 1;
  }
  .top-header {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .header-actions .user-profile span {
    display: none;
  }
}

/* Priority colors for text/icons */
.priority-low {
  color: var(--success-color);
}
.priority-medium {
  color: var(--info-color);
}
.priority-high {
  color: var(--warning-color);
}
.priority-critical {
  color: var(--danger-color);
  font-weight: bold;
}

/* Helper classes */
.text-center {
  text-align: center;
}
.mt-2 {
  margin-top: 1rem;
}
.hidden {
  display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Additional Charts Fixes */
canvas {
  max-width: 100%;
  height: 280px !important;
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-action-btn {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-action-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.quick-action-btn i {
  font-size: 1.2rem;
}

/* Bulk Actions */
.bulk-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bulk-actions select {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

/* Pagination */
.pagination {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.page-link {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-card);
}

.page-link.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Table Footer */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 0 0 12px 12px;
  border-top: 1px solid var(--border-color);
}

/* Calendar Nav */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.calendar-nav h3 {
  min-width: 150px;
  text-align: center;
}
.calendar-nav button {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--light-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Template lists in settings */
.template-item {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Analytics section adjustments */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.analytics-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (max-width: 800px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* Hover effects for sorting */
.data-table th[onclick] {
  cursor: pointer;
}
.data-table th[onclick]:hover {
  background: rgba(0, 0, 0, 0.05);
}
.data-table th i {
  font-size: 0.7rem;
  color: #ccc;
  margin-left: 5px;
}

/* Mobile Sidebar Toggle Button */
.mobile-menu-btn {
  display: none;
  font-size: 1.2rem;
  background: transparent;
  color: var(--text-main);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
  .sidebar-toggle {
    display: none;
  }
}

/* Tabs for renewals */
.renewal-tabs {
  display: flex;
  gap: 10px;
}

.tab-btn {
  padding: 8px 15px;
  border-radius: 20px;
  background: var(--light-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
}

/* Quick Action Icons */
.action-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-right: 5px;
}

.edit-icon {
  background: var(--edit-bg);
  color: var(--info-color);
}
.delete-icon {
  background: var(--delete-bg);
  color: var(--danger-color);
}
.view-icon {
  background: var(--view-bg);
  color: var(--success-color);
}

/* Enhanced Renewal Badges */
.renewal-info-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.date-text {
  font-weight: 500;
  color: var(--text-main);
}

.days-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
}

.days-badge.critical {
  background: var(--danger-color);
  color: #fff;
}
.days-badge.warning {
  background: var(--warning-color);
  color: #fff;
}
.days-badge.success {
  background: var(--success-color);
  color: #fff;
}
.days-badge.expired {
  background: var(--dark-color);
  color: #fff;
}
.days-badge.na {
  background: #e2e8f0;
  color: #64748b;
}

/* Transitions */
.nav-item,
.stat-card,
.dashboard-card,
.btn,
.page-link,
.quick-action-btn {
  transition:
    background-color 0.2s ease-in-out,
    color 0.2s ease-in-out,
    transform 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
}

/* Print styles */
@media print {
  html,
  body {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    color: #000 !important;
  }
  .page {
    display: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .page.active {
    display: block !important;
  }
  .sidebar,
  .top-header,
  .header-actions,
  .btn,
  .filters-panel,
  .table-footer,
  .quick-actions,
  .mobile-menu-btn,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .content-section {
    display: none !important;
  }
  .content-section.active {
    display: block !important;
    padding: 0 !important;
  }
  .data-table {
    border: 1px solid #000;
  }
  .data-table th,
  .data-table td {
    border: 1px solid #000;
    padding: 5px;
    font-size: 10pt;
  }
  body {
    background: white;
    color: black;
  }
}
