/**
 * Block User Account - Admin Styles
 *
 * @package    Block_User_Account
 * @subpackage Assets
 * @since      2.0.0
 */

/* Toggle Switch */
.bua-toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  vertical-align: middle;
}

.bua-toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.bua-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #27ae60;
  transition: 0.3s;
  border-radius: 34px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bua-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.bua-toggle-switch input:checked + .bua-toggle-slider {
  background-color: #e74c3c;
}

.bua-toggle-switch input:checked + .bua-toggle-slider:before {
  transform: translateX(24px);
}

.bua-toggle-switch:hover .bua-toggle-slider {
  opacity: 0.9;
}

.bua-toggle-switch input:disabled + .bua-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status Indicator */
.bua-status-text {
  margin-left: 12px;
  font-weight: 600;
  font-size: 14px;
  vertical-align: middle;
}

/* Block Fields Section */
#bua-block-fields {
  margin-top: 20px;
}

#bua-block-fields h2 {
  font-size: 16px;
  padding: 15px;
  background: #f8f9fa;
  border-left: 4px solid #2271b1;
  margin-bottom: 0;
}

#bua-block-fields .form-table {
  margin-top: 0;
}

#bua-block-fields .form-table th {
  width: 200px;
  padding: 15px 10px 15px 0;
  font-weight: 600;
}

#bua-block-fields .form-table td {
  padding: 15px 10px;
}

/* Block Options */
.bua-block-options {
  background-color: #fdf7f7;
  border-left: 4px solid #e74c3c;
  padding: 5px;
  margin: 5px 0;
}

.bua-block-options textarea {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  width: 100%;
  max-width: 500px;
}

.bua-block-options textarea:focus {
  border-color: #e74c3c;
  box-shadow: 0 0 0 1px #e74c3c;
  outline: none;
}

.bua-block-options select {
  min-width: 200px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #8c8f94;
  font-size: 13px;
}

.bua-block-options input[type="datetime-local"] {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #8c8f94;
  font-size: 13px;
  min-width: 220px;
}

.bua-block-options .description {
  margin-top: 5px;
  color: #666;
}

/* Block Details */
.bua-block-details {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  border: 1px solid #e5e5e5;
  margin-top: 10px;
}

.bua-block-details p {
  margin: 8px 0;
  font-size: 13px;
}

.bua-block-details strong {
  display: inline-block;
  min-width: 100px;
  color: #1d2327;
}

/* Block History */
.bua-history-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e5e5;
  border-radius: 5px;
  background: #fff;
}

.bua-history-loading {
  padding: 20px;
  text-align: center;
  color: #666;
}

.bua-history-loading .spinner {
  float: none;
  margin: 0 8px 0 0;
  vertical-align: middle;
}

.bua-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bua-history-list li {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f1;
}

.bua-history-list li:hover {
  background-color: #f8f9fa;
}

.bua-history-list li:last-child {
  border-bottom: none;
}

.bua-history-list li strong {
  color: #1d2327;
  font-weight: 600;
}

.bua-history-list li small {
  color: #888;
  display: block;
  margin-top: 3px;
}

.bua-history-list li em {
  color: #666;
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.bua-history-empty {
  text-align: center;
  padding: 30px;
  color: #999;
}

.bua-history-empty .dashicons {
  font-size: 40px;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
}

/* Quick Action Buttons */
.bua-quick-action {
  min-width: 80px;
  font-weight: 500;
}

.bua-quick-action[data-action="block"] {
  color: #dc3545;
  border-color: #dc3545;
}

.bua-quick-action[data-action="block"]:hover {
  background: #dc3545;
  color: #fff;
}

.bua-quick-action[data-action="unblock"] {
  color: #28a745;
  border-color: #28a745;
}

.bua-quick-action[data-action="unblock"]:hover {
  background: #28a745;
  color: #fff;
}

.bua-quick-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading Spinner */
.bua-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #0073aa;
  border-radius: 50%;
  animation: bua-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes bua-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin Notices */
.bua-admin-notice {
  margin: 15px 0 10px;
  padding: 12px 15px;
  border-left-width: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bua-admin-notice p {
  margin: 0;
  font-size: 13px;
}

/* RTL Support */
.rtl .bua-toggle-slider:before {
  left: auto;
  right: 3px;
}

.rtl .bua-toggle-switch input:checked + .bua-toggle-slider:before {
  transform: translateX(-24px);
}

.rtl .bua-status-text {
  margin-left: 0;
  margin-right: 12px;
}

.rtl #bua-block-fields .form-table th {
  padding: 15px 0 15px 10px;
}

.rtl .bua-block-options {
  border-left: none;
  border-right: 4px solid #e74c3c;
}

.rtl .bua-spinner {
  margin-right: 0;
  margin-left: 6px;
}

/* Accessibility */
.bua-toggle-switch:focus-within {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
  border-radius: 34px;
}

.bua-quick-action:focus {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #2271b1;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .bua-toggle-slider,
  .bua-toggle-slider:before {
    transition: none;
  }
}

/* Responsive */
@media screen and (max-width: 782px) {
  #bua-block-fields .form-table th {
    width: 100%;
    padding: 10px 0;
  }

  #bua-block-fields .form-table td {
    padding: 5px 0 15px;
  }

  .bua-toggle-switch {
    width: 44px;
    height: 24px;
  }

  .bua-toggle-slider:before {
    height: 18px;
    width: 18px;
  }

  .bua-toggle-switch input:checked + .bua-toggle-slider:before {
    transform: translateX(20px);
  }

  .bua-block-options select,
  .bua-block-options input[type="datetime-local"] {
    width: 100%;
    min-width: auto;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  #bua-block-fields h2 {
    background: #2c3338;
    color: #f0f0f1;
  }

  .bua-block-options {
    background-color: #2c1115;
  }

  .bua-block-options textarea,
  .bua-block-options select,
  .bua-block-options input[type="datetime-local"] {
    background: #1d2327;
    color: #f0f0f1;
    border-color: #3c434a;
  }

  .bua-block-details {
    background: #2c3338;
    border-color: #3c434a;
    color: #f0f0f1;
  }

  .bua-history-container {
    background: #1d2327;
    border-color: #3c434a;
  }

  .bua-history-list li {
    border-bottom-color: #2c3338;
  }

  .bua-history-list li:hover {
    background-color: #2c3338;
  }
}

/* Print */
@media print {
  .bua-toggle-switch,
  .bua-quick-action {
    display: none;
  }
}
/* Dashboard Widget */
.bua-dashboard-widget {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dashboard Widget Header */
.bua-dash-header {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: linear-gradient(135deg, #e64d3d 0%, #f77163 100%);
  border-radius: 8px;
  margin-bottom: 15px;
}

.bua-dash-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  flex-shrink: 0;
}

.bua-dash-header-icon .dashicons {
  font-size: 28px;
  width: 28px;
  height: 28px;
  color: #fff;
}

.bua-dash-header-info h3 {
  margin: 0!important;
  color: #fff!important;
  font-size: 16px!important;
  font-weight: 700!important;
  line-height: 1.3!important;
}

.bua-dash-header-info p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.bua-dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.bua-dash-stat-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid #e8eaed;
  transition: all 0.2s ease;
}

.bua-dash-stat-card:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.bua-dash-stat-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 5px;
}

.bua-dash-blocked {
  color: #e74c3c;
}
.bua-dash-expiring {
  color: #f39c12;
}
.bua-dash-logs {
  color: #3498db;
}
.bua-dash-actions {
  color: #27ae60;
}

.bua-dash-stat-label {
  font-size: 11px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.bua-dash-section {
  margin-bottom: 15px;
}

.bua-dash-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #f0f0f1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bua-dash-section-title .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  color: #666;
}

.bua-dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bua-dash-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 12px;
  line-height: 1.5;
}

.bua-dash-list li:last-child {
  border-bottom: none;
}

.bua-dash-avatar {
  vertical-align: middle;
  border-radius: 50%;
  margin-right: 4px;
}

.bua-dash-user-link {
  font-weight: 500;
  text-decoration: none;
  color: #1d2327;
}

.bua-dash-user-link:hover {
  color: #2271b1;
}

.bua-dash-time-remaining {
  font-weight: 600;
}

.bua-time-critical {
  color: #e74c3c;
}
.bua-time-warning {
  color: #f39c12;
}

.bua-dash-action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.bua-badge-block {
  background: #fde8e8;
  color: #c0392b;
}

.bua-badge-unblock {
  background: #e8f8f0;
  color: #27ae60;
}

.bua-badge-auto {
  background: #fef3e4;
  color: #e67e22;
}

.bua-dash-meta {
  color: #999;
  font-size: 11px;
}

.bua-dash-reason {
  color: #777;
  font-size: 11px;
}

.bua-dash-empty {
  text-align: center;
  padding: 20px;
  color: #aaa;
}

.bua-dash-empty .dashicons {
  font-size: 30px;
  width: 30px;
  height: 30px;
  margin-bottom: 5px;
}

.bua-dash-empty p {
  margin: 0;
  font-size: 12px;
}

/* Dashboard Footer Buttons */
.bua-dash-footer {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f1;
}

.bua-dash-footer .button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
    padding: 8px 12px;
    height: auto;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.bua-dash-footer .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.bua-dash-footer .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    vertical-align: middle;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .bua-dash-stat-card {
    background: #2c3338;
    border-color: #3c434a;
  }

  .bua-dash-stat-label {
    color: #a7aaad;
  }

  .bua-dash-section-title {
    color: #f0f0f1;
    border-bottom-color: #2c3338;
  }

  .bua-dash-list li {
    border-bottom-color: #2c3338;
  }

  .bua-dash-user-link {
    color: #f0f0f1;
  }

  .bua-dash-footer {
    border-top-color: #2c3338;
  }
}
