/* Enhanced Design System - Modern UI Improvements */
:root {
  /* Color Palette - Modern Green Theme */
  --primary-green: #10b981;
  --primary-green-dark: #059669;
  --primary-green-light: #34d399;
  --secondary-green: #6ee7b7;
  --accent-green: #a7f3d0;
  --background: #ffffff; /* Changed to white for main background */
  --surface: #e6ffe6; /* Light green for cards/sidebar */
  --surface-hover: #d9f7d9; /* Slightly darker light green for hover */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #c0e0c0; /* Lighter border for light green theme */
  --border-light: #e0f0e0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* New colors for the image UI */
  --header-bg: #c8e6c9; /* Light green for the top bar */
  --profile-field-bg: #f0f0f0; /* Background for input-like fields */
  --button-view-bg: #a7d9f3; /* Light blue for View button */
  --button-message-bg: #a7d9f3; /* Light blue for Message button */
  --button-locate-bg: #a7d9f3; /* Light blue for Locate button */
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Enhanced Navigation */
.navbar {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: white !important;
  letter-spacing: -0.025em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Space between icon and text */
}

.nav-link i {
  vertical-align: middle;
}


/* Enhanced Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  color: white;
  border-bottom: none;
  padding: 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Enhanced Buttons */
.btn {
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--button-view-bg); /* Light blue for View button */
  color: var(--text-primary); /* Text color for buttons */
  border: 1px solid var(--button-view-bg);
}

.btn-primary:hover {
  background-color: darken(var(--button-view-bg), 10%);
  border-color: darken(var(--button-view-bg), 10%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-info {
  background-color: var(--button-message-bg); /* Light blue for Message button */
  color: var(--text-primary); /* Text color for buttons */
  border: 1px solid var(--button-message-bg);
}

.btn-info:hover {
  background-color: darken(var(--button-message-bg), 10%);
  border-color: darken(var(--button-message-bg), 10%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success { /* Added style for the message button in profile card */
  background-color: var(--button-message-bg);
  color: var(--text-primary);
  border: 1px solid var(--button-message-bg);
}

.btn-success:hover {
  background-color: darken(var(--button-message-bg), 10%);
  border-color: darken(var(--button-message-bg), 10%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--primary-green);
}

/* Enhanced Form Elements */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  transition: all 0.2s ease;
  background: var(--surface);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  outline: none;
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* Enhanced Dashboard Layout */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dashboard-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Enhanced Loading States */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

/* Enhanced Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th {
  background: var(--surface-hover);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

/* Enhanced Alerts */
.alert {
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin: 1rem 0;
}

.alert-info {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.alert-success {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-left: 4px solid #22c55e;
}

.alert-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

/* Enhanced Search and Filter */
.search-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  align-items: end;
}

/* Enhanced Profile Cards */
.profile-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.profile-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
}

/* Newsfeed Layout */
.newsfeed-container {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.sidebar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    height: fit-content;
}

.main-feed {
    max-width: 100%;
}

.feed-item {
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.post-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

.post-body {
    padding: 1.5rem;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.post-info h6 {
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.post-info small {
    color: var(--text-secondary);
}

.post-content h5 {
    margin-bottom: 0.5rem;
}

.product-details {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.price-badge, .quantity-badge {
    background: var(--accent-green);
    color: var(--primary-green-dark);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.post-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-hover);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background: var(--border);
}

.action-btn .fas {
    color: var(--primary-green);
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.trending-item:hover {
    background: var(--surface-hover);
}

.trending-image {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.trending-info h6 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    background: var(--accent-green);
    color: var(--primary-green-dark);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.search-bar {
    flex-grow: 1;
    position: relative;
}

.search-bar .fa-search {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    padding-left: 2.5rem;
}

/* Enhanced Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Enhanced Focus States */
*:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-container {
    padding: 1rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }

  .newsfeed-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

/* Specific styles for nearby_traders_enhanced_final.php */
.viewed-profile-section {
    /* This will be controlled by inline style for display: none/block */
}

.trader-card .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
}

.trader-card .card-title {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.trader-card .card-text {
    font-size: 0.9rem;
}

.trader-card .btn-group .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.map-placeholder {
    background-color: #e6ffe6; /* Light green background for the map */
    border: 1px solid #ced4da;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px; /* Ensure it has a visible height */
}

/* Specific styles for trader_list_view.php */
.wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 280px;
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}
.main-content {
    flex-grow: 1;
    padding: 20px;
    background-color: var(--background);
}
.profile-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.profile-card .info-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}
.profile-card .info-label {
    font-weight: bold;
    color: var(--text-secondary);
    width: 120px; /* Fixed width for labels */
    flex-shrink: 0;
}
.profile-card .info-value {
    flex-grow: 1;
    background-color: var(--profile-field-bg); /* Input-like background */
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    color: var(--text-primary);
}
.trader-list-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    border: 1px solid var(--border);
}
.map-container {
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
    border: 1px solid var(--border);
}
.trader-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}
.trader-item:last-child {
    border-bottom: none;
}
.trader-item .location-icon {
    font-size: 1.5rem;
    color: var(--primary-green);
    margin-right: 10px;
}
.trader-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    display: none; /* Hide default image as per image */
}
.trader-info {
    flex-grow: 1;
}
.trader-actions {
    display: flex;
    gap: 10px;
}
.trader-actions .btn {
    padding: 5px 10px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary); /* Text color for buttons */
}
.trader-actions .btn-primary {
    background-color: var(--button-view-bg); /* Light blue for View */
    border-color: var(--button-view-bg);
}
.trader-actions .btn-primary:hover {
    background-color: darken(var(--button-view-bg), 10%);
    border-color: darken(var(--button-view-bg), 10%);
}
.trader-actions .btn-info {
    background-color: var(--button-message-bg); /* Light blue for Message */
    border-color: var(--button-message-bg);
}
.trader-actions .btn-info:hover {
    background-color: darken(var(--button-message-bg), 10%);
    border-color: darken(var(--button-message-bg), 10%);
}
.trader-actions .locate-btn {
    background-color: var(--button-locate-bg); /* Light blue for Locate */
    border-color: var(--button-locate-bg);
}
.trader-actions .locate-btn:hover {
    background-color: darken(var(--button-locate-bg), 10%);
    border-color: darken(var(--button-locate-bg), 10%);
}
.profile-image-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid var(--primary-green);
}
.info-label {
    font-weight: bold;
    color: var(--text-secondary);
}
.info-value {
    color: var(--text-primary);
}
@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
