/* Voucher Management Styles */

/* Voucher Dashboard Cards */
.voucher-dashboard-cards {
  margin-bottom: 40px;
}

.voucher-card--active {
  border-left-color: var(--agrion-base);
}

.voucher-card--active .admin-card__icon {
  background-color: rgba(31, 99, 6, 0.1);
  color: var(--agrion-base);
}

.voucher-card--used {
  border-left-color: #3b82f6;
}

.voucher-card--used .admin-card__icon {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.voucher-card--saved {
  border-left-color: #10b981;
}

.voucher-card--saved .admin-card__icon {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.voucher-card--expiring {
  border-left-color: #f59e0b;
}

.voucher-card--expiring .admin-card__icon {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* Loading State */
.voucher-loading {
  background-color: var(--agrion-white);
  border-radius: var(--agrion-bdr-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
}

/* Filters Section */
.voucher-filters {
  background-color: var(--agrion-extra);
  border-radius: var(--agrion-bdr-radius);
  padding: 25px;
  margin-bottom: 25px;
}

.voucher-filters .form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--agrion-black);
  margin-bottom: 8px;
}

.voucher-filters .form-control,
.voucher-filters .form-select {
  border: 1px solid #e9ecef;
  border-radius: var(--agrion-bdr-radius);
  padding: 10px 15px;
  font-size: 14px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.voucher-filters .form-control:focus,
.voucher-filters .form-select:focus {
  border-color: var(--agrion-base);
  box-shadow: 0 0 0 0.2rem rgba(31, 99, 6, 0.25);
  outline: 0;
}

/* Voucher Table */
.voucher-table {
  background-color: var(--agrion-white);
  border-radius: var(--agrion-bdr-radius);
  overflow: hidden;
  margin-bottom: 0;
}

.voucher-table thead {
  background-color: var(--agrion-extra);
}

.voucher-table thead th {
  border: none;
  padding: 20px 15px;
  font-weight: 600;
  font-size: 14px;
  color: var(--agrion-black);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}

.voucher-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}

.voucher-table thead th.sortable:hover {
  background-color: rgba(31, 99, 6, 0.05);
}

.voucher-table thead th.sortable i {
  margin-left: 8px;
  font-size: 12px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.voucher-table thead th.sortable:hover i {
  opacity: 1;
}

.voucher-table thead th.sortable.asc i:before {
  content: "\f0de";
  color: var(--agrion-base);
  opacity: 1;
}

.voucher-table thead th.sortable.desc i:before {
  content: "\f0dd";
  color: var(--agrion-base);
  opacity: 1;
}

.voucher-table tbody td {
  padding: 20px 15px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
  font-size: 14px;
}

.voucher-table tbody tr:last-child td {
  border-bottom: none;
}

.voucher-table tbody tr:hover {
  background-color: var(--agrion-extra);
}

/* Voucher Info Cell */
.voucher-info {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.voucher-name {
  font-weight: 600;
  color: var(--agrion-black);
  margin-bottom: 4px;
  font-size: 16px;
}

.voucher-code {
  color: var(--agrion-base);
  font-weight: 600;
  font-family: "Courier New", monospace;
  font-size: 14px;
  padding: 2px 8px;
  background-color: rgba(31, 99, 6, 0.1);
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.voucher-description {
  color: var(--agrion-gray);
  font-size: 13px;
  line-height: 1.4;
}

/* Shop Info */
.shop-info {
  display: flex;
  align-items: center;
}

.shop-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
  border: 2px solid var(--agrion-extra);
}

.shop-details h6 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--agrion-black);
}

.shop-details small {
  color: var(--agrion-gray);
  font-size: 12px;
}

/* Voucher Type Badge */
.voucher-type-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.voucher-type-badge--fixed {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.voucher-type-badge--percentage {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.voucher-type-badge--shipping {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* Usage Stats */
.usage-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.usage-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--agrion-black);
}

.usage-total {
  font-size: 12px;
  color: var(--agrion-gray);
}

.usage-progress {
  width: 60px;
  height: 6px;
  background-color: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.usage-progress-bar {
  height: 100%;
  background-color: var(--agrion-base);
  transition: width 0.3s ease;
}

/* Status Badge */
.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

.status-badge i {
  margin-right: 4px;
  font-size: 10px;
}

.status-badge--draft {
  background-color: rgba(108, 117, 125, 0.1);
  color: #6c757d;
}

.status-badge--active {
  background-color: rgba(25, 135, 84, 0.1);
  color: #198754;
}

.status-badge--inactive {
  background-color: rgba(108, 117, 125, 0.1);
  color: #6c757d;
}

.status-badge--expired {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.status-badge--used-up {
  background-color: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

/* Action Buttons */
.voucher-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.action-btn--view {
  background-color: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
}

.action-btn--view:hover {
  background-color: #0d6efd;
  color: white;
}

.action-btn--edit {
  background-color: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

.action-btn--edit:hover {
  background-color: #ffc107;
  color: var(--agrion-black);
}

.action-btn--delete {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.action-btn--delete:hover {
  background-color: #dc3545;
  color: white;
}

.action-btn--toggle {
  background-color: rgba(31, 99, 6, 0.1);
  color: var(--agrion-base);
}

.action-btn--toggle:hover {
  background-color: var(--agrion-base);
  color: white;
}

/* Pagination */
.voucher-pagination {
  padding: 25px 0;
  border-top: 1px solid #f1f3f4;
  margin-top: 25px;
}

.voucher-info {
  color: var(--agrion-gray);
  font-size: 14px;
}

.pagination .page-link {
  color: var(--agrion-gray);
  border: 1px solid #dee2e6;
  padding: 8px 12px;
  margin: 0 2px;
  border-radius: var(--agrion-bdr-radius);
  transition: all 0.3s ease;
}

.pagination .page-link:hover {
  color: var(--agrion-base);
  background-color: rgba(31, 99, 6, 0.1);
  border-color: var(--agrion-base);
}

.pagination .page-item.active .page-link {
  background-color: var(--agrion-base);
  border-color: var(--agrion-base);
  color: white;
}

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Empty State */
.voucher-empty-state {
  background-color: var(--agrion-white);
  border-radius: var(--agrion-bdr-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 60px 40px;
}

.voucher-empty-state h4 {
  color: var(--agrion-black);
  font-weight: 600;
}

.voucher-empty-state .text-muted {
  color: var(--agrion-gray) !important;
}

/* Modal Styles */
.modal-xl .modal-content {
  border-radius: var(--agrion-bdr-radius);
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
  background-color: var(--agrion-extra);
  border-bottom: 1px solid #dee2e6;
  border-radius: var(--agrion-bdr-radius) var(--agrion-bdr-radius) 0 0;
}

.modal-title {
  font-weight: 700;
  color: var(--agrion-black);
}

.modal-body {
  padding: 30px;
}

.modal-footer {
  border-top: 1px solid #dee2e6;
  padding: 20px 30px;
}

/* Form Groups in Modal */
.modal .form-group {
  margin-bottom: 20px;
}

.modal .form-label {
  font-weight: 600;
  color: var(--agrion-black);
  margin-bottom: 8px;
}

.modal .form-control,
.modal .form-select {
  border: 1px solid #dee2e6;
  border-radius: var(--agrion-bdr-radius);
  padding: 12px 15px;
  font-size: 14px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal .form-control:focus,
.modal .form-select:focus {
  border-color: var(--agrion-base);
  box-shadow: 0 0 0 0.2rem rgba(31, 99, 6, 0.25);
  outline: 0;
}

/* Voucher Preview */
.voucher-preview {
  background: linear-gradient(135deg, var(--agrion-base) 0%, #2a8608 100%);
  color: white;
  border-radius: var(--agrion-bdr-radius);
  padding: 25px;
  margin: 20px 0;
  position: relative;
  overflow: hidden;
}

.voucher-preview::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
  background-size: 20px 20px;
  animation: drift 20s infinite linear;
  pointer-events: none;
}

@keyframes drift {
  from {
    transform: rotate(0deg) translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translate(-50%, -50%) rotate(-360deg);
  }
}

.voucher-preview-code {
  font-size: 24px;
  font-weight: 700;
  font-family: "Courier New", monospace;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.voucher-preview-discount {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  margin: 15px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.voucher-preview-description {
  text-align: center;
  font-size: 14px;
  opacity: 0.9;
}

/* Form Sections */
.form-section {
  background-color: var(--agrion-extra);
  border-radius: var(--agrion-bdr-radius);
  padding: 25px;
  margin-bottom: 25px;
}

.form-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--agrion-black);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--agrion-base);
  display: flex;
  align-items: center;
}

.form-section-title i {
  margin-right: 10px;
  color: var(--agrion-base);
}

/* Input Groups */
.input-group .input-group-text {
  background-color: var(--agrion-extra);
  border: 1px solid #dee2e6;
  border-right: none;
  color: var(--agrion-gray);
  font-weight: 600;
}

.input-group .form-control {
  border-left: none;
}

.input-group .form-control:focus {
  border-left: none;
  box-shadow: none;
}

/* Switch Toggles */
.form-switch .form-check-input {
  width: 3rem;
  height: 1.5rem;
}

.form-switch .form-check-input:checked {
  background-color: var(--agrion-base);
  border-color: var(--agrion-base);
}

/* Date Range Picker */
.date-range-group {
  display: flex;
  gap: 15px;
  align-items: center;
}

.date-range-group .form-control {
  flex: 1;
}

.date-range-separator {
  color: var(--agrion-gray);
  font-weight: 600;
}

/* Conditions List */
.conditions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.conditions-list li {
  background-color: var(--agrion-white);
  border: 1px solid #dee2e6;
  border-radius: var(--agrion-bdr-radius);
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.condition-text {
  font-size: 14px;
  color: var(--agrion-black);
}

.condition-value {
  font-weight: 600;
  color: var(--agrion-base);
}

/* Responsive Design */
@media (max-width: 768px) {
  .voucher-filters {
    padding: 20px 15px;
  }

  .voucher-dashboard-cards .admin-card {
    margin-bottom: 20px;
  }

  .voucher-table {
    font-size: 13px;
  }

  .voucher-table thead th,
  .voucher-table tbody td {
    padding: 12px 8px;
  }

  .shop-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .shop-avatar {
    width: 30px;
    height: 30px;
    margin-right: 0;
  }

  .voucher-actions {
    flex-direction: column;
    gap: 4px;
  }

  .action-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .modal-body {
    padding: 20px 15px;
  }

  .form-section {
    padding: 20px 15px;
  }

  .date-range-group {
    flex-direction: column;
    gap: 10px;
  }

  .date-range-separator {
    display: none;
  }
}

@media (max-width: 576px) {
  .admin-main {
    padding: 20px 10px;
  }

  .voucher-filters .row {
    margin: 0;
  }

  .voucher-filters .col-lg-3,
  .voucher-filters .col-lg-2 {
    padding: 0 5px;
    margin-bottom: 15px;
  }

  .voucher-table-container {
    overflow-x: auto;
  }

  .voucher-table {
    min-width: 800px;
  }

  .voucher-pagination .row {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

/* Fix dashboard cards responsive */
@media (max-width: 1200px) {
  .voucher-dashboard-cards .col-xl-3 {
    margin-bottom: 20px;
  }
}

/* Fix pagination layout */
.voucher-pagination .row {
  align-items: center;
}

.voucher-pagination .voucher-info {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .voucher-pagination .row {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .voucher-pagination .col-md-6 {
    width: 100%;
    text-align: center;
  }

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

/* Fix table responsive */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .voucher-table {
    min-width: 1000px;
  }
}

/* Fix modal form sections */
.form-section {
  margin-bottom: 25px;
}

.date-range-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

@media (max-width: 768px) {
  .date-range-group {
    flex-direction: column;
    gap: 10px;
  }

  .date-range-separator {
    display: none;
  }
}
.voucher-dashboard-cards.row {
  display: flex !important;
  flex-wrap: wrap;
  margin: 0 -15px;
}

/* Đảm bảo layout không bị phá khi JS thay đổi display */
#dashboard-section:not(.d-none):not([style*="display: none"]) {
  display: flex !important;
  flex-wrap: wrap;
}
.voucher-detail-view {
  font-size: 14px;
}

.voucher-detail-header {
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.voucher-detail-name {
  color: #2c5aa0;
  margin-bottom: 0.5rem;
}

.voucher-detail-code .code-text {
  font-family: "Courier New", monospace;
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #dee2e6;
}

.detail-section {
  background: #f8f9fa;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  height: 100%;
}

.detail-section-title {
  color: #495057;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.detail-item label {
  font-weight: 600;
  color: #6c757d;
  min-width: 120px;
  margin-bottom: 0;
}

.detail-item span {
  flex: 1;
  text-align: right;
  word-break: break-word;
}

.progress {
  max-width: 100px;
  margin-left: auto;
}
