/* SBA Linktree - Modern CSS for 2025 */

/* CSS Custom Properties */
:root {
  --primary-bg: #b8c1db;
  --secondary-bg: #ffffff;
  --primary-text: #2B364B;
  --primary-text-hover: #5C719A;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 0 10px rgba(0,0,0,0.1);
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --transition: all 0.2s ease-in-out;
}

/* Base Styles */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Gradient Background - Preserved from original */
body {
  background: linear-gradient(356deg, var(--primary-bg) 0%, var(--secondary-bg) 69%);
  background-attachment: fixed;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--primary-text);
}

/* Typography Improvements */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* Link Styles */
.link-sba {
  color: var(--primary-text);
  text-decoration: none;
  transition: var(--transition);
}

.link-sba:hover {
  color: var(--primary-text-hover);
  text-decoration: none;
}

/* Button Styles - Modernized */
.button-donate {
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-sizing: border-box;
  color: var(--primary-text);
  font-family: "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  padding: 0.75rem 1rem;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px; /* Touch target minimum */
}

.button-donate:hover {
  background-color: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.button-donate:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.button-donate:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--primary-text-hover);
  outline-offset: 2px;
}

/* Form Styles - Enhanced */
.form-donate-input {
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-sizing: border-box;
  color: var(--primary-text);
  font-family: "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  width: 100%;
  transition: var(--transition);
  min-height: 44px; /* Touch target minimum */
}

.form-donate-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--primary-text-hover);
  box-shadow: 0 0 0 3px rgba(92, 103, 154, 0.1);
}

.form-donate-input:hover {
  background-color: #f9fafb;
}

/* Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Row and Column Utilities */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.5rem;
}

.col {
  flex: 1;
  padding: 0 0.5rem;
}

.col-sm {
  flex: 0 0 auto;
  width: 100%;
}

/* No Gutters Classes */
.no-gutters-container {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.no-gutters-row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.no-gutters-col {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Image Grid - Modernized */
.image-item {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.image-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.insta-image-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 125%; /* 4:5 aspect ratio for 2252x2814 images */
  overflow: hidden;
  background: var(--secondary-bg);
}

.insta-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: var(--transition);
}

.insta-image-wrapper:hover img {
  transform: scale(1.05);
}

/* Card Components */
.bg-body {
  background-color: var(--secondary-bg) !important;
}

.rounded-top {
  border-top-left-radius: var(--border-radius) !important;
  border-top-right-radius: var(--border-radius) !important;
}

.rounded-bottom {
  border-bottom-left-radius: var(--border-radius) !important;
  border-bottom-right-radius: var(--border-radius) !important;
}

.shadow-sm {
  box-shadow: var(--shadow) !important;
}

.shadow-lg {
  box-shadow: var(--shadow-lg) !important;
}

/* Text Utilities */
.text-center {
  text-align: center;
}

.text-muted {
  color: #6c757d !important;
}

.text-body-secondary {
  color: #6c757d !important;
}

/* Spacing */
.mt-3 {
  margin-top: 1rem !important;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.p-2 {
  padding: 0.5rem !important;
}

.p-3 {
  padding: 1rem !important;
}

/* Flex Utilities */
.d-flex {
  display: flex !important;
}

.justify-content-center {
  justify-content: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.align-items-center {
  align-items: center !important;
}

.flex-column {
  flex-direction: column !important;
}

.flex-sm-row {
  flex-direction: row !important;
}

/* Grid System */
.row-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.row-cols-md-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Dashboard Styles */
.image-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.image-list-item:hover {
  background-color: #f9fafb;
}

.click-count {
  margin-left: 1rem;
  font-weight: 600;
  color: #6b7280;
}

/* Chart Container */
.chart-container {
  position: relative;
  max-width: 600px;
  margin: 20px auto;
  padding: 1rem;
  background: var(--secondary-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

/* Login Form Styles */
.login-container {
  max-width: 400px;
  padding: 2rem;
  background: var(--secondary-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.form-container {
  max-width: 400px;
  padding: 2rem;
  background: var(--secondary-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 0.375rem;
  border: 1px solid transparent;
}

.bg-transparent {
  background-color: transparent !important;
}

.border-secondary {
  border-color: #6c757d !important;
}

.text-secondary {
  color: #6c757d !important;
}

/* Alert Styles */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
}

.alert-danger {
  color: #842029;
  background-color: #f8d7da;
  border-color: #f5c2c7;
}

.alert-success {
  color: #0f5132;
  background-color: #d1e7dd;
  border-color: #badbcc;
}

/* Navigation */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary-text);
}

.navbar-brand img {
  border-radius: 50%;
  border: 2px solid var(--secondary-bg);
}

/* Utility Classes */
.border {
  border: 1px solid var(--border-color) !important;
}

.border-bottom {
  border-bottom: 1px solid var(--border-color) !important;
}

.pb-2 {
  padding-bottom: 0.5rem !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.lh-sm {
  line-height: 1.25 !important;
}

.w-100 {
  width: 100% !important;
}

.ms-2 {
  margin-left: 0.5rem !important;
}

.me-2 {
  margin-right: 0.5rem !important;
}

/* Responsive Design */
@media (max-width: 767.98px) {
  .container {
    padding: 0 0.5rem;
  }

  .image-item[data-index="4"],
  .image-item[data-index="5"] {
    display: none;
  }

  .button-donate {
    font-size: 1rem;
    padding: 1rem;
    min-height: 48px;
  }

  .form-donate-input {
    font-size: 1rem;
    padding: 1rem;
    min-height: 48px;
  }

  .row-cols-2 .col {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (min-width: 768px) {
  .row-cols-md-3 .col {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

/* Print Styles */
@media print {
  body {
    background: white !important;
  }

  .button-donate,
  .no-print {
    display: none !important;
  }
}

/* Dashboard Statistics Cards */
.stats-card {
  background: var(--secondary-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stats-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stats-icon img {
  filter: brightness(0) invert(1);
}

.stats-content {
  flex: 1;
}

.stats-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-text);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stats-label {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Enhanced Chart Cards */
.chart-card {
  background: var(--secondary-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.chart-header {
  padding: 1.5rem 1.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.chart-header h5 {
  color: var(--primary-text);
  font-weight: 600;
}

.chart-container {
  position: relative;
  height: 300px;
  padding: 0 1.5rem 1.5rem 1.5rem;
}

/* Top Images List */
.top-images-list {
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.top-image-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.top-image-item:last-child {
  border-bottom: none;
}

.top-image-info {
  flex: 1;
  margin-right: 1rem;
}

.image-label {
  display: block;
  font-weight: 500;
  color: var(--primary-text);
  margin-bottom: 0.25rem;
}

.top-image-item .click-count {
  font-size: 0.875rem;
  color: #6c757d;
}

/* Dashboard Navigation */
.dashboard-nav {
  background: var(--secondary-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 2rem;
}

.nav-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.nav-header .navbar-brand {
  color: white !important;
  margin: 0;
}

.nav-header .navbar-brand:hover {
  color: rgba(255, 255, 255, 0.9) !important;
}

.nav-menu {
  padding: 0;
}

.nav-menu .nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--primary-text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.nav-menu .nav-link:hover {
  background-color: #f8f9fa;
  color: var(--primary-text-hover);
}

.nav-menu .nav-link.active {
  background-color: #e3f2fd;
  color: #1565c0;
  border-left: 3px solid #1565c0;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

.nav-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Quick Actions Section */
.quick-actions-section {
  margin: 2rem 0;
}

.section-title {
  color: var(--primary-text);
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--secondary-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--primary-text);
  transition: var(--transition);
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  color: var(--primary-text);
}

.action-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-icon img {
  filter: brightness(0) invert(1);
}

.action-content h6 {
  margin: 0 0 0.25rem 0;
  font-weight: 600;
  color: var(--primary-text);
}

.action-content p {
  margin: 0;
  font-size: 0.875rem;
  color: #6c757d;
}

/* Enhanced Image List */
.image-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  background: var(--secondary-bg);
}

.image-list-item:hover {
  background-color: #f8f9fa;
}

.image-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.image-preview {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius);
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.image-details {
  flex: 1;
}

.image-title {
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 0.25rem;
  display: block;
}

.image-url {
  font-size: 0.875rem;
  color: #6c757d;
  word-break: break-all;
}

.image-stats {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: #6c757d;
}

.image-actions {
  display: flex;
  gap: 0.5rem;
}

/* Responsive adjustments for dashboard */
@media (max-width: 768px) {
  .stats-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .stats-icon {
    width: 40px;
    height: 40px;
  }

  .stats-number {
    font-size: 1.5rem;
  }

  .chart-container {
    height: 250px;
  }

  .top-images-list {
    max-height: 250px;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Management */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
