/**
 * Admin Bar Manager Styles
 *
 * @package Polanger_Dashboard_Tools_Pro
 * @since 3.1.0
 */

/* Form */
.pdt-admin-bar-form {
  display: block;
  clear: both;
  width: 100%;
  margin-top: 20px;
  box-sizing: border-box;
}

/* Section */
.pdt-ab-section {
  display: block;
  clear: both;
  margin-bottom: 24px;
}

.pdt-ab-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1e1e1e;
  margin: 0 0 12px 0;
  padding: 0;
}

.pdt-ab-section-title .dashicons {
  color: #6366f1;
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* Card */
.pdt-ab-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
}

.pdt-ab-card-desc {
  color: #666;
  font-size: 13px;
  margin: 0 0 16px 0;
}

/* Option Row */
.pdt-ab-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.pdt-ab-option:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pdt-ab-option:first-child {
  padding-top: 0;
}

.pdt-ab-option-content {
  flex: 1;
}

.pdt-ab-option-content.pdt-ab-full-width {
  width: 100%;
}

.pdt-ab-option-label {
  display: block;
  font-weight: 500;
  color: #1e1e1e;
  margin-bottom: 2px;
}

.pdt-ab-option-desc {
  display: block;
  font-size: 12px;
  color: #888;
}

/* Toggle Switch */
.pdt-ab-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.pdt-ab-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pdt-ab-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.pdt-ab-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  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-ab-toggle input:checked + .pdt-ab-toggle-slider {
  background-color: #6366f1;
}

.pdt-ab-toggle input:checked + .pdt-ab-toggle-slider:before {
  transform: translateX(20px);
}

/* Logo Upload */
.pdt-ab-logo-upload {
  flex-direction: column;
}

.pdt-ab-logo-preview-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.pdt-ab-logo-preview {
  width: 60px;
  height: 60px;
  background: #f5f5f5;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pdt-ab-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pdt-ab-logo-preview .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: #ccc;
}

.pdt-ab-logo-preview.has-logo {
  border-style: solid;
  border-color: #6366f1;
  background: #fff;
}

.pdt-ab-logo-actions {
  display: flex;
  gap: 8px;
}

.pdt-ab-upload-btn,
.pdt-ab-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px !important;
  font-size: 12px !important;
  height: auto !important;
}

.pdt-ab-upload-btn .dashicons,
.pdt-ab-remove-btn .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
}

.pdt-ab-remove-btn {
  color: #dc3545 !important;
  border-color: #dc3545 !important;
}

.pdt-ab-remove-btn:hover {
  background: #dc3545 !important;
  color: #fff !important;
}

.pdt-ab-section-dimmed {
  opacity: 0.5;
  pointer-events: none;
}

/* Input */
.pdt-ab-input {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pdt-ab-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Submenu Grid */
.pdt-ab-submenu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

/* Checkbox */
.pdt-ab-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s;
  user-select: none;
}

.pdt-ab-checkbox:hover {
  background: #f5f5f5;
}

.pdt-ab-checkbox input {
  display: none;
}

.pdt-ab-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pdt-ab-checkbox input:checked + .pdt-ab-checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

.pdt-ab-checkbox input:checked + .pdt-ab-checkmark:after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.pdt-ab-checkbox span:last-child {
  font-size: 13px;
  color: #444;
}

.pdt-ab-submenu-item {
  background: #fafafa;
  border-radius: 6px;
}

/* Submit */
.pdt-ab-submit {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.pdt-ab-submit .button-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
  border: none !important;
  padding: 8px 24px !important;
  height: auto !important;
  font-size: 14px !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3) !important;
  transition: all 0.2s !important;
}

.pdt-ab-submit .button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4) !important;
}

/* ========================================
   Custom Links Section
   ======================================== */

/* Link Item */
.pdt-link-item {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.pdt-link-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
}

.pdt-link-drag-handle {
  color: #999;
  cursor: grab;
}

.pdt-link-title-preview {
  flex: 1;
  font-weight: 500;
  color: #333;
}

.pdt-link-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  border-radius: 4px;
  transition: background 0.2s;
}

.pdt-link-toggle:hover {
  background: #f0f0f0;
}

.pdt-link-remove {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #dc3545;
  border-radius: 4px;
  transition: background 0.2s;
}

.pdt-link-remove:hover {
  background: #fee;
}

.pdt-link-content {
  padding: 20px;
  background: #fff;
}

.pdt-is-hidden {
  display: none;
}

.pdt-link-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.pdt-link-row:last-child {
  margin-bottom: 0;
}

.pdt-link-field {
  flex: 1;
}

.pdt-link-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  margin-bottom: 5px;
}

.pdt-link-field input[type="text"],
.pdt-link-field input[type="url"],
.pdt-link-field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pdt-link-field input:focus,
.pdt-link-field select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Icon Selector */
.pdt-icon-selector {
  position: relative;
}

.pdt-icon-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
  width: 100%;
}

.pdt-icon-picker-btn:hover {
  border-color: #6366f1;
}

.pdt-icon-picker-btn .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #6366f1;
}

.pdt-icon-picker-label {
  font-size: 13px;
  color: #666;
}

/* Icon Picker Popup */
.pdt-icon-picker-popup {
  position: fixed;
  z-index: 100000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  width: 320px;
  max-height: 350px;
  overflow: hidden;
}

.pdt-icon-search {
  width: 100%;
  padding: 12px;
  border: none;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  outline: none;
}

.pdt-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.pdt-icon-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.pdt-icon-option:hover {
  background: #f0f0ff;
}

.pdt-icon-option .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: #555;
}

/* Submenu Section */
.pdt-submenu-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.pdt-submenu-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
}

.pdt-submenu-items {
  margin-bottom: 12px;
}

.pdt-submenu-item {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}

.pdt-submenu-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pdt-submenu-row input[type="text"],
.pdt-submenu-row input[type="url"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}

.pdt-submenu-row select {
  width: 80px;
  padding: 8px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}

.pdt-remove-submenu-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #dc3545;
  border-radius: 4px;
}

.pdt-remove-submenu-btn:hover {
  background: #fee;
}

.pdt-add-submenu-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px !important;
}

.pdt-add-submenu-btn .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
}

/* Add Link Button */
.pdt-ab-add-link-wrapper {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

#pdt-add-new-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#pdt-add-new-link .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Admin Bar Custom Link Styles */
#wpadminbar .pdt-custom-link > .ab-item {
  display: flex !important;
  align-items: center !important;
}

#wpadminbar .pdt-custom-link > .ab-item .ab-icon {
  margin-right: 6px !important;
  font-size: 16px !important;
}

/* ========================================
   Admin Bar Manager Section
   ======================================== */

.pdt-abm-refresh-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f0f6fc;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #555;
}

.pdt-abm-refresh-notice .dashicons {
  color: #3b82f6;
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.pdt-abm-items-container {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.pdt-abm-no-items {
  padding: 20px;
  text-align: center;
  color: #888;
  margin: 0;
}

/* Item */
.pdt-abm-item {
  border-bottom: 1px solid #f0f0f0;
}

.pdt-abm-item:last-child {
  border-bottom: none;
}

.pdt-abm-item-child {
  background: #fafafa;
}

.pdt-abm-item-child .pdt-abm-item-header {
  padding-left: 30px;
}

.pdt-abm-item[data-depth="2"] .pdt-abm-item-header {
  padding-left: 50px;
}

.pdt-abm-item[data-depth="3"] .pdt-abm-item-header {
  padding-left: 70px;
}

.pdt-abm-item-hidden {
  opacity: 0.6;
}

.pdt-abm-item-hidden .pdt-abm-item-title {
  text-decoration: line-through;
  color: #999;
}

/* Item Header */
.pdt-abm-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: #fff;
  transition: background 0.2s;
}

.pdt-abm-item-header:hover {
  background: #f9f9f9;
}

.pdt-abm-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.pdt-abm-expand-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: #666;
  border-radius: 3px;
  transition: background 0.2s;
}

.pdt-abm-expand-btn:hover {
  background: #e0e0e0;
}

.pdt-abm-item-bullet {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  margin-left: 5px;
  margin-right: 5px;
}

.pdt-abm-item-title {
  font-weight: 500;
  color: #333;
}

.pdt-abm-item-id {
  font-size: 11px;
  color: #999;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Item Actions */
.pdt-abm-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdt-abm-hide-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.pdt-abm-hide-toggle input {
  display: none;
}

.pdt-abm-hide-toggle .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #666;
  transition: color 0.2s;
}

.pdt-abm-hide-toggle:hover .dashicons {
  color: #333;
}

.pdt-abm-hide-toggle .dashicons-hidden {
  color: #dc3545;
}

.pdt-abm-rename-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.pdt-abm-rename-btn:hover,
.pdt-abm-rename-btn.active {
  background: #f0f0f0;
  color: #6366f1;
}

/* Rename Section */
.pdt-abm-item-rename {
  padding: 10px 15px 15px;
  background: #f9f9f9;
  border-top: 1px solid #eee;
}

.pdt-abm-item-child .pdt-abm-item-rename {
  padding-left: 30px;
}

.pdt-abm-item-rename input {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.pdt-abm-item-rename input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.pdt-abm-rename-hint {
  display: block;
  font-size: 11px;
  color: #999;
  margin-top: 5px;
}

/* Children Container */
.pdt-abm-item-children {
  border-top: 1px solid #eee;
}

.pdt-ab-submenu-icon {
  font-size: 16px;
  margin-right: 5px;
}

/* Search Box */
.pdt-abm-search-box {
  margin-bottom: 12px;
}

.pdt-abm-search-box input {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px 8px 35px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23999"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd"/></svg>') no-repeat 10px center;
  background-size: 16px;
}

/* Responsive */
@media (max-width: 782px) {
  .pdt-ab-submenu-grid {
    grid-template-columns: 1fr;
  }
  
  .pdt-ab-logo-preview-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .pdt-link-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .pdt-submenu-row {
    flex-wrap: wrap;
  }
  
  .pdt-icon-picker-popup {
    width: 280px;
  }
  
  .pdt-icon-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .pdt-abm-item-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .pdt-abm-item-info {
    flex-wrap: wrap;
  }
  
  .pdt-abm-item-id {
    display: none;
  }
}

/* Frontend Admin Bar Items Section */
.pdt-abm-frontend-notice {
  background: #f0f7ff;
  border-color: #2271b1;
}

.pdt-abm-no-items-box {
  text-align: center;
  padding: 30px 20px;
  background: #f9f9f9;
  border-radius: 6px;
  color: #666;
}

.pdt-abm-no-items-box .dashicons {
  font-size: 36px;
  width: 36px;
  height: 36px;
  color: #ccc;
  margin-bottom: 10px;
}

.pdt-abm-no-items-box p {
  margin: 5px 0;
}

.pdt-abm-no-items-box .pdt-abm-hint {
  font-size: 12px;
  color: #999;
}

/* Frontend notice content */
.pdt-abm-frontend-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.pdt-abm-frontend-notice .dashicons {
  flex-shrink: 0;
  margin-top: 2px;
}

.pdt-abm-notice-content {
  flex: 1;
}

.pdt-abm-notice-content p {
  margin: 0 0 8px 0;
}

.pdt-abm-notice-content ul {
  margin: 0 0 8px 0;
  padding-left: 20px;
}

.pdt-abm-notice-content li {
  margin-bottom: 4px;
  font-size: 12px;
  color: #555;
}

/* Detection status */
.pdt-abm-detection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: #f0fff4;
  border: 1px solid #22c55e;
  border-radius: 6px;
  margin: 15px 0;
}

.pdt-abm-detection-status .dashicons {
  color: #22c55e;
}

.pdt-abm-detection-status .button {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdt-abm-detection-status .button .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  color: inherit;
}
