:root {
  --primary-color: #f97316;
  --primary-hover: #ea580c;
  --secondary-color: #4b5563;
  --background: #fff7ed;
  --card-bg: #ffffff;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --border-color: #ffedd5;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --sidebar-bg: #c2410c;
  --sidebar-hover: #9a3412;
  --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);
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--background);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Layout */
.container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: white;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100%;
  transition: var(--transition);
  z-index: 20;
  box-shadow: var(--shadow-md);
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 0.75rem;
}

.sidebar-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: white;
  border-radius: 50%;
  padding: 0.5rem;
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-align: center;
}

.sidebar-user {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  text-align: center;
}

.sidebar-user p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 0.25rem 0;
}

.sidebar-user strong {
  color: white;
  font-size: 0.875rem;
  display: block;
}

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

.sidebar li {
  margin: 0.25rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: var(--transition);
}

.sidebar a:hover, .sidebar a:focus {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.sidebar a::before {
  content: '';
  width: 4px;
  height: 0;
  background: white;
  border-radius: 2px;
  transition: var(--transition);
  margin-left: -0.5rem;
}

.sidebar a:hover::before, .sidebar a:focus::before {
  height: 1.25rem;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
  overflow-y: auto;
  height: 100vh;
  background: var(--background);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

/* Search & Filters */
.search-container {
  margin-bottom: 1.5rem;
}

#searchBar {
  padding: 0.625rem 1rem;
  width: 280px;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  transition: var(--transition);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  flex: 1;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select, .date-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: white;
  color: var(--text-color);
  transition: var(--transition);
  height: 38px;
}

.filter-select:focus, .date-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.date-range {
  min-width: 300px;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-inputs .date-input {
  flex: 1;
  min-width: 120px;
}

.date-inputs span {
  color: var(--text-light);
  font-size: 0.875rem;
  white-space: nowrap;
}

#resetFilters {
  align-self: flex-end;
  margin-left: auto;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 38px;
}

#resetFilters:hover {
  background-color: #e5e7eb;
  border-color: #d1d5db;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .filters-container {
    flex-direction: column;
  }
  
  .filter-group {
    width: 100%;
  }
  
  #resetFilters {
    align-self: flex-start;
    margin-left: 0;
  }
}

#searchBar:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Table */
.table-container {
  background: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-top: 1.5rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1000px;
}

th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: #f9fafb;
  color: var(--secondary-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: #f8fafc;
}

td {
  color: var(--text-color);
  vertical-align: middle;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-right: 1rem;
}

.mobile-menu-btn .hamburger-line {
  width: 100%;
  height: 3px;
  background: var(--text-color);
  border-radius: 2px;
  transition: var(--transition);
  transform-origin: center;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.btn-outline:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  text-align: center;
  color: white;
}

.status-pending {
  background: #fed7aa;
  color: #9a3412;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-follow-up {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.6rem;
}

.status-return-to-sender {
  background: #faf5ff;
  color: #7c3aed;
}

.status-received {
  background: #fce7f3;
  color: #be185d;
}

.status-forward-to {
  background: #7c3aed;
  color: white;
}

.status-archived {
  background: #f9fafb;
  color: #6b7280;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  backdrop-filter: blur(4px);
}

.modal.show {
  opacity: 1;
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: white;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(20px);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.modal.show .modal-content {
  transform: translateY(0);
  animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    transform: translateY(20px);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  opacity: 0.7;
  transition: var(--transition);
}

.modal-close:hover {
  opacity: 1;
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-color);
  background-color: white;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-menu-btn {
    display: flex;
  }

  /* Overlay for mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

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

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Utility Classes */
.text-muted {
  color: var(--text-light);
}

.text-sm {
  font-size: 0.875rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-4 {
  margin-top: 1rem;
}

.text-center {
  text-align: center;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
  

.btn-primary {
  background-color: #f97316;
  color: white;
  margin-right: 8px;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: #ea580c;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.2);
}

.btn-secondary {
  background-color: #f0f0f0;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 16px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
  transform: translateY(-1px);
}

/* Update table header */
th {
  background: #f97316 !important;
  color: white !important;
}

/* Update sidebar hover states */
.sidebar a:hover, .sidebar a:focus {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

/* Update focus states */
input:focus, select:focus, textarea:focus {
  border-color: #f97316 !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2) !important;
}

/* Update status badges */
.status-in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-follow-up {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.6rem;
}

.status-return-to-sender {
  background: #faf5ff;
  color: #7c3aed;
}

.status-received {
  background: #fce7f3;
  color: #be185d;
}

.status-forward-to {
  background: #7c3aed;
  color: white;
}

.status-archived {
  background: #f9fafb;
  color: #6b7280;
}

/* Follow-up table row styling */
tbody tr.follow-up-row {
  background: linear-gradient(90deg, #fef2f2 0%, rgba(254, 242, 242, 0.3) 100%);
  border-left: 4px solid #ef4444;
  box-shadow: inset 0 1px 0 rgba(239, 68, 68, 0.1);
}

tbody tr.follow-up-row:hover {
  background: linear-gradient(90deg, #fee2e2 0%, rgba(254, 226, 226, 0.4) 100%);
}

.form-card h2 {
  margin-bottom: 1.5rem;
  color: var(--text-color);
  font-size: 1.25rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font-size: 0.875rem;
}

.alert-error {
  background-color: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-success {
  background-color: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

/* Active sidebar link */
.sidebar a.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 600;
}

.sidebar a.active::before {
  height: 1.25rem;
}

/* Responsive */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    padding: 20px;
  }
  
  .form-card {
    padding: 1.5rem;
  }
}
