/**
 * Dashboard Widgets Manager Styles
 *
 * @package Polanger_Dashboard_Tools_Pro
 * @since 4.3.0
 */

/* ========================================
   CONTAINER
   ======================================== */
.pdt-dw-container {
  max-width: 900px;
  margin: 0;
}

/* ========================================
   TABS
   ======================================== */
.pdt-dw-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid #d7dbe2;
  padding-bottom: 0;
  position: relative;
}

.pdt-dw-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: #f2f4f8;
  border: 1px solid #d7dbe2;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 8px 8px 0 0;
}

.pdt-dw-tab:hover {
  color: #4f46e5;
  background: #eef2ff;
  border-color: #a5b4fc;
}

.pdt-dw-tab.active {
  color: #ffffff;
  border-color: #4f46e5;
  border-bottom-color: #4f46e5;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25);
}

.pdt-dw-tab .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.pdt-dw-tab.active .dashicons {
  color: #ffffff;
}

/* ========================================
   FORM & CONTENT
   ======================================== */
.pdt-dw-form {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.pdt-dw-content {
  padding: 30px;
}

/* ========================================
   SECTIONS
   ======================================== */
.pdt-dw-section {
  margin-bottom: 30px;
}

.pdt-dw-section:last-child {
  margin-bottom: 0;
}

.pdt-dw-section-spaced {
  margin-top: 30px;
}

.pdt-dw-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #212529;
  margin: 0 0 8px 0;
}

.pdt-dw-section-title .dashicons {
  color: #667eea;
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.pdt-dw-section-desc {
  color: #6c757d;
  font-size: 14px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

/* ========================================
   WIDGET GRID
   ======================================== */
.pdt-dw-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.pdt-dw-widget-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdt-dw-widget-card:hover {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.03) 100%);
}

.pdt-dw-widget-card.is-hidden {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.05) 0%, rgba(220, 38, 38, 0.02) 100%);
  border-color: rgba(220, 38, 38, 0.3);
}

.pdt-dw-widget-card.is-hidden .pdt-dw-widget-header .dashicons {
  color: #dc2626;
}

.pdt-dw-widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pdt-dw-widget-header .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: #667eea;
}

.pdt-dw-widget-title {
  font-size: 14px;
  font-weight: 600;
  color: #212529;
}

.pdt-dw-widget-desc {
  font-size: 12px;
  color: #6c757d;
  margin: 0 0 12px 0;
  line-height: 1.4;
  flex: 1;
}

.pdt-dw-widget-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #e9ecef;
}

.pdt-dw-widget-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #dc2626;
}

.pdt-dw-toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: #6c757d;
}

.pdt-dw-widget-card.is-hidden .pdt-dw-toggle-label {
  color: #dc2626;
}

/* Third-party widget card */
.pdt-dw-widget-card.pdt-dw-third-party {
  border-style: dashed;
}

.pdt-dw-widget-card.pdt-dw-third-party .pdt-dw-widget-header .dashicons {
  color: #8b5cf6;
}

.pdt-dw-widget-card.pdt-dw-third-party .pdt-dw-widget-desc code {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #495057;
}

/* Auto-hide card */
.pdt-dw-auto-hide-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Whitelist grid */
.pdt-dw-whitelist-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pdt-dw-whitelist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdt-dw-whitelist-item:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.pdt-dw-whitelist-item.is-whitelisted {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.pdt-dw-whitelist-item input[type="checkbox"] {
  display: none;
}

.pdt-dw-whitelist-item .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #9ca3af;
  transition: all 0.2s ease;
}

.pdt-dw-whitelist-item.is-whitelisted .dashicons {
  color: #10b981;
}

.pdt-dw-whitelist-title {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.pdt-dw-whitelist-item.is-whitelisted .pdt-dw-whitelist-title {
  color: #065f46;
}

/* No widgets notice */
.pdt-dw-no-widgets-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 12px;
}

.pdt-dw-no-widgets-notice .dashicons {
  color: #6b7280;
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.pdt-dw-no-widgets-notice p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

/* Success info box */
.pdt-dw-info-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
  border-color: rgba(16, 185, 129, 0.25);
}

.pdt-dw-info-success .dashicons {
  color: #10b981;
}

.pdt-dw-info-success strong {
  color: #065f46;
}

.pdt-dw-info-success p {
  color: #047857;
}

/* ========================================
   CUSTOM WIDGET CARDS
   ======================================== */
#pdt-custom-widgets-list {
  margin-bottom: 20px;
}

.pdt-dw-custom-widget-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.pdt-dw-custom-widget-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.pdt-dw-widget-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.pdt-dw-widget-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdt-dw-widget-card-title .dashicons {
  color: #667eea;
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.pdt-dw-widget-name {
  font-size: 14px;
  font-weight: 600;
  color: #212529;
}

.pdt-dw-widget-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdt-dw-toggle-widget,
.pdt-dw-remove-widget {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.pdt-dw-toggle-widget:hover {
  background: rgba(102, 126, 234, 0.1);
}

.pdt-dw-toggle-widget .dashicons {
  color: #6c757d;
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.pdt-dw-remove-widget:hover {
  background: rgba(220, 38, 38, 0.1);
}

.pdt-dw-remove-widget .dashicons {
  color: #dc2626;
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Mini Switch */
.pdt-dw-mini-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.pdt-dw-mini-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pdt-dw-mini-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 20px;
}

.pdt-dw-mini-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pdt-dw-mini-switch input:checked + .pdt-dw-mini-slider {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.pdt-dw-mini-switch input:checked + .pdt-dw-mini-slider:before {
  transform: translateX(16px);
}

/* Widget Card Body */
.pdt-dw-widget-card-body {
  padding: 20px;
}

.pdt-dw-field-row {
  margin-bottom: 16px;
}

.pdt-dw-field-row:last-child {
  margin-bottom: 0;
}

.pdt-dw-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.pdt-dw-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.pdt-dw-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pdt-dw-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: monospace;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: #fff;
  resize: vertical;
  min-height: 120px;
}

.pdt-dw-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Add Widget Button */
.pdt-dw-add-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px !important;
  height: auto !important;
  font-size: 14px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
  transition: all 0.2s ease !important;
}

.pdt-dw-add-widget:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4) !important;
}

.pdt-dw-add-widget .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* ========================================
   OPTION CARDS
   ======================================== */
.pdt-dw-option-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.pdt-dw-option-card:last-child {
  margin-bottom: 0;
}

.pdt-dw-option-card h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #212529;
}

.pdt-dw-icon-success {
  color: #10b981;
}

.pdt-dw-option-card .description {
  color: #6c757d;
  font-size: 13px;
  margin: 0 0 16px 0;
}

.pdt-dw-main-toggle {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-color: rgba(102, 126, 234, 0.2);
}

.pdt-dw-option-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.pdt-dw-option-text {
  flex: 1;
}

.pdt-dw-option-text strong {
  display: block;
  font-size: 14px;
  color: #212529;
  margin-bottom: 4px;
}

.pdt-dw-option-text p {
  margin: 0;
  font-size: 13px;
  color: #6c757d;
  line-height: 1.4;
}

/* ========================================
   SWITCH TOGGLE
   ======================================== */
.pdt-dw-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.pdt-dw-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pdt-dw-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.pdt-dw-switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pdt-dw-switch input:checked + .pdt-dw-switch-slider {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pdt-dw-switch input:checked + .pdt-dw-switch-slider:before {
  transform: translateX(24px);
}

.pdt-dw-switch-small {
  width: 44px;
  height: 24px;
}

.pdt-dw-switch-small .pdt-dw-switch-slider:before {
  height: 18px;
  width: 18px;
}

.pdt-dw-switch-small input:checked + .pdt-dw-switch-slider:before {
  transform: translateX(20px);
}

/* ========================================
   RADIO GROUP
   ======================================== */
.pdt-dw-radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdt-dw-radio {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdt-dw-radio:hover {
  border-color: #667eea;
}

.pdt-dw-radio input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #667eea;
  flex-shrink: 0;
}

.pdt-dw-radio:has(input:checked) {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.pdt-dw-radio-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdt-dw-radio-text strong {
  font-size: 14px;
  color: #212529;
}

.pdt-dw-radio-text small {
  font-size: 12px;
  color: #6c757d;
}

/* ========================================
   SUB OPTIONS
   ======================================== */
.pdt-dw-sub-options {
  margin-top: 20px;
  padding-left: 20px;
  border-left: 3px solid #667eea;
}

.pdt-dw-is-hidden {
  display: none;
}

/* ========================================
   INFO BOX
   ======================================== */
.pdt-dw-info-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  margin-top: 24px;
}

.pdt-dw-info-box .dashicons {
  color: #3b82f6;
  font-size: 20px;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.pdt-dw-info-box strong {
  display: block;
  color: #1e40af;
  font-size: 13px;
  margin-bottom: 4px;
}

.pdt-dw-info-box p {
  margin: 0;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.5;
}

.pdt-dw-info-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.04) 100%);
  border-color: rgba(245, 158, 11, 0.3);
}

.pdt-dw-info-warning .dashicons {
  color: #f59e0b;
}

.pdt-dw-info-warning strong {
  color: #92400e;
}

.pdt-dw-info-warning p {
  color: #78350f;
}

.pdt-dw-info-tight {
  margin-top: 16px;
}

.pdt-dw-info-medium {
  margin-top: 20px;
}

.pdt-dw-info-top {
  margin-top: 24px;
}

/* ========================================
   FORM INPUTS
   ======================================== */
.pdt-dw-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  margin-bottom: 8px;
}

.pdt-dw-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: #fff;
  transition: all 0.2s ease;
}

.pdt-dw-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pdt-dw-paragraph-spaced {
  margin-top: 10px;
}

.pdt-dw-icon-dashboard {
  margin-top: 3px;
}

.pdt-dw-description-spaced {
  margin-top: 8px;
}

.pdt-dw-pro-tips-list {
  margin: 8px 0 0 0;
  padding-left: 18px;
}

/* ========================================
   QUICK LINKS
   ======================================== */
#pdt-welcome-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.pdt-dw-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pdt-dw-link-title {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
}

.pdt-dw-link-url {
  flex: 2;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
}

.pdt-dw-link-icon {
  width: 120px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fff;
}

.pdt-dw-link-title:focus,
.pdt-dw-link-url:focus,
.pdt-dw-link-icon:focus {
  outline: none;
  border-color: #667eea;
}

.pdt-dw-remove-link {
  padding: 6px 8px !important;
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: #fef2f2 !important;
}

.pdt-dw-remove-link:hover {
  background: #fee2e2 !important;
}

.pdt-dw-remove-link .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.pdt-dw-add-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pdt-dw-add-link .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* ========================================
   SUBMIT
   ======================================== */
.pdt-dw-submit {
  padding: 20px 30px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.pdt-dw-submit .button-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  padding: 10px 24px;
  height: auto;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
  transition: all 0.2s ease;
}

.pdt-dw-submit .button-primary:hover {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
}

/* ========================================
   WELCOME WIDGET (Frontend Dashboard)
   ======================================== */
.pdt-welcome-widget {
  padding: 10px 0;
}

.pdt-welcome-content {
  margin-bottom: 20px;
  line-height: 1.6;
}

.pdt-welcome-content p:last-child {
  margin-bottom: 0;
}

.pdt-welcome-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.pdt-welcome-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pdt-welcome-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  color: #fff;
}

.pdt-welcome-link .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 782px) {
  .pdt-dw-tabs {
    flex-wrap: wrap;
  }
  
  .pdt-dw-tab {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .pdt-dw-widget-grid {
    grid-template-columns: 1fr;
  }
  
  .pdt-dw-link-row {
    flex-wrap: wrap;
  }
  
  .pdt-dw-link-title,
  .pdt-dw-link-url {
    flex: 1 1 100%;
  }
  
  .pdt-dw-link-icon {
    flex: 1;
  }
}
