/* ============================================
  CSS CUSTOM PROPERTIES (VARIABLES)
  ============================================ */
:root {
  /* Colors */
  --primary-golden: #ffcc41;
  --primary-orange: #fc8312;
  --accent-light: #fff7ed;
  --accent-lighter: #fffbf0;
  --text-dark: #1f2937;
  --text-medium: #4b5563;
  --text-light: #6b7280;
  --border-light: #d1d5db;

  /* Gradients */
  /* --gradient-primary: linear-gradient(135deg, #ffcc41 0%, #fc8312 100%); */
  --gradient-primary: #fc8312;
  --gradient-primary-hover: linear-gradient(135deg, #e6b840 0%, #e07411 100%);
  --gradient-background: linear-gradient(135deg, #fef9e7 0%, #fff7ed 100%);
  --gradient-overlay: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  --gradient-table-header: linear-gradient(135deg, #fffbf0 0%, #fef3e2 100%);

  /* Shadows */
  --shadow-sm: 0 2px 20px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.15);
  --shadow-primary: 0 10px 25px rgba(255, 204, 65, 0.4);
  --shadow-primary-hover: 0 15px 35px rgba(255, 204, 65, 0.5);
}

/* ============================================
  BASE STYLES
  ============================================ */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.modern-body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: var(--gradient-background);
  min-height: 100vh;
  margin: 0;
}

.main-content {
  padding-top: 2rem;
  padding-bottom: 2rem;
  min-height: calc(100vh - 200px);
}

a {
  color: var(--primary-orange);
}

a:hover {
  color: #e07411;
}

/* ============================================
  FOCUS STATES
  ============================================ */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--primary-orange);
}

/* ============================================
  ANIMATIONS & KEYFRAMES
  ============================================ */
@keyframes slide-up {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-150px);
    opacity: 0;
    top: 0px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
  FLASH MESSAGES
  ============================================ */
.flash_message {
  text-align: center;
  position: absolute;
  border-radius: 1rem;
  height: auto;
  padding: 0.5em;
  font-size: 20px;
  font-weight: bold;
  top: 40px;
  left: 25%;
  right: 25%;
  z-index: 1000;
  display: block;
  animation: slide-up 1.25s forwards;
  animation-delay: 2.5s;
}

.success-message {
  color: #fff;
  background: green;
}

.error-message {
  color: #fff;
  background: #ff3838;
}

/* ============================================
  NAVIGATION
  ============================================ */
.modern-navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(255, 204, 65, 0.2);
  padding: 1rem 0;
  transition: all 0.3s ease;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-dark) !important;
}

.navbar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modern-nav-link {
  color: var(--text-medium) !important;
  font-weight: 500;
  padding: 0.75rem 1.5rem !important;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
  margin: 0 0.25rem;
  position: relative;
  overflow: hidden;
}

.modern-nav-link:hover {
  background: var(--gradient-primary);
  color: white !important;
  transform: translateY(-2px);
}

.modern-nav-link.active {
  background: var(--gradient-primary);
  color: white !important;
  box-shadow: 0 4px 12px rgba(252, 131, 18, 0.3);
}

.logout-link {
  color: #dc2626 !important;
}

.logout-link:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
}

/* Ripple effect for nav links */
.modern-nav-link .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* ============================================
  FOOTER
  ============================================ */
.modern-footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 2rem 0;
  color: var(--text-light);
}

/* ============================================
  PAGE HEADER
  ============================================ */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 0;
}

/* ============================================
  CARDS
  ============================================ */
.modern-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 204, 65, 0.1);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out;
}

.modern-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(255, 204, 65, 0.1);
  border-color: rgba(252, 131, 18, 0.2);
}

.modern-card .card-header {
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

.modern-card .card-title {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 1.25rem;
}

/* Referral Code Card */
.referral-code-card {
  background: var(--gradient-primary);
  border-radius: 1rem;
  padding: 1.5rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-primary);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
}

.referral-code-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  pointer-events: none;
}

.referral-code-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary-hover);
}

.referral-code-card .card-icon {
  font-size: 1.5rem;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
}

.referral-code-card .card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.referral-code-card .label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.referral-code-card .code {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  letter-spacing: 1px;
  word-break: break-all;
}

/* ============================================
  BUTTONS
  ============================================ */
.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 204, 65, 0.3);
}

.btn-copy {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  color: white;
  padding: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.btn-copy::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-copy:hover::before {
  opacity: 1;
}

.btn-copy:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-copy.copy-success {
  background: rgba(34, 197, 94, 0.9);
  border-color: rgba(34, 197, 94, 1);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-copy.copy-error {
  background: rgba(239, 68, 68, 0.9);
  border-color: rgba(239, 68, 68, 1);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* ============================================
  FORMS & CONTROLS
  ============================================ */
.controls-section {
  margin-bottom: 2rem;
}

.stats-info {
  display: flex;
  align-items: center;
  font-size: 1rem;
  color: var(--text-medium);
}

.page-size-control {
  display: flex;
  align-items: center;
}

.page-size-control .form-label {
  color: var(--text-medium);
  font-weight: 500;
  margin-bottom: 0;
  white-space: nowrap;
}

.modern-select {
  width: auto;
  min-width: 120px;
  border-radius: 0.5rem;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.modern-select:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(252, 131, 18, 0.1);
}

/* ============================================
  TABLES
  ============================================ */
.table-section {
  margin-bottom: 2rem;
}

.modern-table {
  font-size: 0.9rem;
}

.table-header {
  background: var(--gradient-table-header);
}

.table-header th {
  border: none;
  padding: 1.25rem 1rem;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-row {
  transition: all 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
  animation: fadeInUp 0.4s ease-out;
}

.table-row:hover {
  background-color: var(--accent-lighter);
  transform: translateX(2px);
}

.table-row td {
  padding: 1.25rem 1rem;
  border: none;
  vertical-align: middle;
}

.store-id {
  background: var(--gradient-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.store-name strong {
  color: var(--text-dark);
  font-size: 1rem;
}

.store-address {
  color: var(--text-light);
  font-size: 0.9rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-phone {
  color: var(--text-medium);
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
}

.status-badge {
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-active {
  background-color: rgba(255, 204, 65, 0.2);
  color: #b8860b;
}

.status-pending {
  background-color: rgba(252, 131, 18, 0.2);
  color: #cc6600;
}

.status-inactive {
  background-color: #fee2e2;
  color: #991b1b;
}

.commission-amount {
  font-weight: 700;
  color: var(--primary-orange);
  font-size: 1rem;
}

.created-date {
  color: var(--text-light);
  font-size: 0.9rem;
}

.empty-state {
  padding: 3rem 2rem;
}

.empty-state i {
  display: block;
  margin: 0 auto 1rem;
  color: var(--primary-orange);
}

/* ============================================
  PAGINATION
  ============================================ */
.pagination-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pagination-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

.modern-pagination .page-link {
  border: none;
  padding: 0.75rem 1rem;
  margin: 0 0.25rem;
  border-radius: 0.5rem;
  color: var(--text-medium);
  background-color: transparent;
  transition: all 0.3s ease;
}

.modern-pagination .page-link:hover {
  background: var(--gradient-primary);
  color: white;
  transform: translateY(-2px);
}

.modern-pagination .page-item.active .page-link {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 5px 15px rgba(255, 204, 65, 0.4);
}

.modern-pagination .page-item.disabled .page-link {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* ============================================
  TOAST NOTIFICATIONS
  ============================================ */
.toast-notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 9999;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 300px;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.toast-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-left-color: #22c55e;
  color: #16a34a;
}

.toast-success i {
  color: #22c55e;
  font-size: 1.25rem;
}

.toast-error {
  border-left-color: #ef4444;
  color: #dc2626;
}

.toast-error i {
  color: #ef4444;
  font-size: 1.25rem;
}

/* ============================================
  UTILITY CLASSES
  ============================================ */
.bg-gradient-primary {
  background: var(--gradient-primary) !important;
}

.code-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-orange);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

.progress {
  background-color: rgba(255, 204, 65, 0.2);
}

.progress-bar {
  background: linear-gradient(
    90deg,
    var(--primary-golden) 0%,
    var(--primary-orange) 100%
  );
}

/* ============================================
  RESPONSIVE DESIGN - MOBILE
  ============================================ */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .page-title {
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }

  .page-header {
    margin-bottom: 1rem;
  }

  .page-header .row {
    flex-direction: column;
  }

  .page-header .col-md-4 {
    margin-top: 1rem;
    order: -1;
  }

  .referral-code-card {
    padding: 1rem;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  .referral-code-card .card-icon {
    align-self: center;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
  }

  .referral-code-card .code {
    font-size: 1rem;
    padding: 0.5rem;
    word-break: break-all;
    max-width: 100%;
  }

  .code-container {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .btn-copy {
    min-width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
  }

  .navbar-brand {
    font-size: 1.2rem;
  }

  .navbar-logo {
    width: 32px;
    height: 32px;
  }

  .modern-nav-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem;
  }

  .modern-card {
    margin-bottom: 1rem;
    border-radius: 0.75rem;
  }

  .modern-card .card-header,
  .modern-card .card-body {
    padding: 1rem;
  }

  .controls-section .row > div {
    margin-bottom: 0.75rem;
  }

  .page-size-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .page-size-control .form-label {
    font-size: 0.9rem;
  }

  .modern-select {
    width: 100%;
    min-width: auto;
  }

  .table-responsive {
    border: none;
  }

  .modern-table {
    font-size: 0.75rem;
    margin-bottom: 0;
  }

  .table-header th {
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
    line-height: 1.2;
    vertical-align: middle;
  }

  .table-row td {
    padding: 0.5rem 0.25rem;
    line-height: 1.3;
    vertical-align: middle;
  }

  .store-id {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
  }

  .store-name strong {
    font-size: 0.8rem;
    display: block;
    margin-bottom: 0.25rem;
  }

  .store-address {
    max-width: 120px;
    font-size: 0.75rem;
    line-height: 1.2;
  }

  .store-phone {
    font-size: 0.75rem;
    word-break: break-all;
  }

  .status-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }

  .commission-amount {
    font-size: 0.85rem;
  }

  .created-date {
    font-size: 0.75rem;
  }

  .pagination-wrapper {
    margin-top: 1rem;
  }

  .modern-pagination .page-link {
    padding: 0.5rem 0.75rem;
    margin: 0 0.1rem;
    font-size: 0.8rem;
  }

  .pagination-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .pagination-text {
    font-size: 0.8rem;
  }

  .toast-notification {
    right: 0.5rem;
    left: 0.5rem;
    top: 0.5rem;
    min-width: auto;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .empty-state {
    padding: 2rem 1rem;
  }

  .empty-state i {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .referral-code-card {
    padding: 1rem;
    margin: 0 -0.5rem;
  }

  .referral-code-card .code {
    font-size: 1rem;
    padding: 0.5rem;
    word-break: break-all;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-subtitle {
    font-size: 0.875rem;
  }
}

/* ============================================
  RESPONSIVE DESIGN - TABLET
  ============================================ */
@media (min-width: 576px) and (max-width: 767.98px) {
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .page-header .col-md-4 {
    margin-top: 1rem;
  }

  .referral-code-card {
    padding: 1.25rem;
  }

  .controls-section .row > div {
    margin-bottom: 1rem;
  }

  .store-address {
    max-width: 180px;
  }

  .modern-table {
    font-size: 0.85rem;
  }

  .table-header th,
  .table-row td {
    padding: 0.75rem 0.5rem;
  }

  .referral-code-card {
    padding: 1.25rem;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 1rem;
  }

  .referral-code-card .card-icon {
    align-self: center;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
    padding: 0.5rem;
  }

  .referral-code-card .card-content {
    align-items: center;
  }

  .referral-code-card .code {
    font-size: 1.1rem;
    text-align: center;
    max-width: 100%;
  }

  .code-container {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .btn-copy {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
  }

  .toast-notification {
    right: 1rem;
    left: 1rem;
    min-width: auto;
    top: 1rem;
  }
}

/* ============================================
  RESPONSIVE DESIGN - DESKTOP
  ============================================ */
@media (min-width: 768px) and (max-width: 991.98px) {
  .page-title {
    font-size: 2.2rem;
  }

  .referral-code-card {
    margin-bottom: 1rem;
  }

  .store-address {
    max-width: 200px;
  }
}

@media (min-width: 1200px) {
  .container-fluid {
    max-width: 1200px;
    margin: 0 auto;
  }

  .page-title {
    font-size: 2.75rem;
  }

  .referral-code-card {
    padding: 2rem;
  }

  .modern-card .card-header {
    padding: 2rem;
  }

  .store-address {
    max-width: 250px;
  }
}
