/* 
 * Modify Login Builder Form Styles
 * Complements Tailwind classes in the template
 */

/* Main Builder Container */
#modify-login-builder {
  /* CSS Reset for WordPress Core Styles */
  * {
    box-sizing: border-box;
  }
  
  /* Override Tailwind overflow properties */
  .card {
    overflow: visible !important;
  }
  
  .panel-content {
    overflow-x: visible !important;
    overflow-y: auto !important;
    position: relative;
  }
  
  .media-dropzone, 
  .form-group,
  .preview-thumbnail {
    overflow: visible !important;
  }
  
  /* Gutenberg Color Picker Styles */
  .gutenberg-color-picker-container {
    margin-bottom: 16px;
    overflow: visible !important;
    
    .color-picker-main {
      display: flex;
      align-items: center;
    }
    
    .color-picker-button {
      outline: none;
      
      &:focus {
        box-shadow: 0 0 0 1px #2271b1;
      }
    }
    
    .color-picker-value {
      font-family: monospace;
    }
    
    .color-picker-popover {
      position: relative;
      z-index: 999;
      margin-top: 8px;
      padding: 14px;
      background: white;
      border: 1px solid #ddd;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      border-radius: 4px;
    }
  }
  
  /* Media Dropzone Styles */
  .media-dropzone {
    position: relative;
    
    .dropzone-area {
      min-height: 120px;
      transition: all 0.2s ease;
      
      &.dragover {
        background-color: rgba(59, 130, 246, 0.05);
        border-color: rgba(59, 130, 246, 0.4);
      }
      
      .dashicons {
        width: 40px;
        height: 40px;
        font-size: 40px;
      }
    }
    
    .image-preview {
      animation: fadeIn 0.3s ease;
      
      .preview-thumbnail {
        position: relative;
        background-size: cover;
        background-position: center;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
      }
      
      .preview-info {
        line-height: 1.3;
      }
      
      .preview-actions button {
        border: none;
        background: transparent;
        cursor: pointer;
        font-size: 16px;
        
        &:focus {
          outline: none;
          box-shadow: 0 0 0 1px #2271b1;
        }
        
        .dashicons {
          width: 16px;
          height: 16px;
          font-size: 16px;
        }
      }
    }
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* Form Control Styles */
  .form-group {
    margin-bottom: 20px;
    position: relative;
  }
  
  /* Preview Styles */
  .preview-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
  }
  
  /* Image Properties Popover */
  .image-properties {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    width: 280px;
    animation: fadeIn 0.2s ease;
    pointer-events: auto;
    right: 0;
    top: 40px;
    margin-right: -10px;
    
    &.active {
      display: block;
    }
    
    .popover-header {
      position: relative;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
      padding-bottom: 10px;
      border-bottom: 1px solid #eee;
      
      h4 {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        color: #1e1e1e;
      }
      
      .close-popover {
        cursor: pointer;
        color: #757575;
        transition: color 0.2s ease;
        width: 20px;
        height: 20px;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        
        &:hover {
          color: #d63638;
          background-color: rgba(214, 54, 56, 0.05);
        }
      }
    }
    
    .popover-content {
      .form-group {
        margin-bottom: 12px;
        
        &:last-child {
          margin-bottom: 0;
        }
        
        label {
          display: block;
          margin-bottom: 5px;
          font-size: 12px;
          font-weight: 500;
        }
        
        select, input {
          width: 100%;
          border: 1px solid #ddd;
          border-radius: 4px;
          padding: 8px 10px;
          font-size: 13px;
          
          &:focus {
            border-color: #2271b1;
            box-shadow: 0 0 0 1px #2271b1;
            outline: none;
          }
        }
      }
    }
    
    /* Arrow pointing to the gear icon */
    &:before {
      content: '';
      position: absolute;
      right: 12px;
      top: -8px;
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-bottom: 8px solid white;
      z-index: 2;
    }
    
    &:after {
      content: '';
      position: absolute;
      right: 11px;
      top: -10px;
      width: 0;
      height: 0;
      border-left: 9px solid transparent;
      border-right: 9px solid transparent;
      border-bottom: 9px solid #ddd;
      z-index: 1;
    }
  }
}

/* Custom Confirmation Modal */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  
  &.active {
    opacity: 1;
    pointer-events: auto;
  }
  
  .custom-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
    
    .custom-modal-header {
      background-color: #2271b1;
      color: white;
      padding: 16px 20px;
      display: flex;
      align-items: center;
      
      .custom-modal-icon {
        margin-right: 12px;
        font-size: 24px;
      }
      
      .custom-modal-title {
        font-size: 18px;
        font-weight: 600;
        margin: 0;
      }
    }
    
    .custom-modal-content {
      padding: 20px;
      font-size: 14px;
      color: #555;
      line-height: 1.6;
    }
    
    .custom-modal-actions {
      display: flex;
      justify-content: flex-end;
      padding: 0 20px 20px;
      gap: 10px;
      
      button {
        padding: 8px 16px;
        border-radius: 4px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        border: none;
        transition: all 0.2s ease;
        
        &.custom-modal-cancel {
          background-color: #f0f0f1;
          color: #555;
          
          &:hover {
            background-color: #e5e5e5;
          }
        }
        
        &.custom-modal-confirm {
          background-color: #2271b1;
          color: white;
          padding: 8px 12px;
          display: flex;
          align-items: center;
          justify-content: center;
          
          .dashicons {
            font-size: 18px;
            width: 18px;
            height: 18px;
          }
          
          &:hover {
            background-color: #135e96;
          }
        }
      }
    }
  }
  
  &.active .custom-modal {
    transform: translateY(0);
  }
}

/* Styling for opacity range slider */
.opacity-slider-container {
  display: flex;
  align-items: center;
  height: 30px;
  
  .opacity-slider-track {
    position: relative;
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
  }
  
  .opacity-slider-fill {
    position: absolute;
    height: 100%;
    width: 100%;
    background-color: #3b82f6;
    border-radius: 4px;
    pointer-events: none;
  }
  
  .opacity-slider-handle {
    position: absolute;
    top: 50%;
    right: 0;
    width: 18px;
    height: 18px;
    background-color: #3b82f6;
    border-radius: 50%;
    transform: translate(50%, -50%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    
    &:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    }
    
    &:hover {
      background-color: #2563eb;
    }
    
    &:active {
      background-color: #1d4ed8;
      cursor: grabbing;
    }
  }
  
  .opacity-value {
    width: 40px;
    text-align: right;
  }
}

/* Notification styles */
#modify-login-notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  
  .notification {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 400px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    
    &.translate-x-full {
      transform: translateX(100%);
    }
    
    &.opacity-0 {
      opacity: 0;
    }
    
    .notification-icon {
      margin-right: 12px;
      font-size: 20px;
    }
    
    .notification-message {
      flex: 1;
      margin: 0;
      font-size: 14px;
      line-height: 1.4;
    }
    
    .notification-close {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 4px;
      margin-left: 8px;
      color: #6b7280;
      display: flex;
      align-items: center;
      justify-content: center;
      
      &:hover {
        color: #374151;
      }
      
      .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
      }
    }
  }
}

/* Empty color picker styling */
.gutenberg-color-picker-container.color-empty .color-picker-button,
.gutenberg-color-picker-container.color-cleared .color-picker-button {
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
                    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
  background-color: transparent !important;
  
  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
  }
}

.section-reset-button,
.field-reset-button {
  transition: all 0.2s ease;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  
  &:hover {
    background-color: #e2e8f0;
  }
  
  &:active {
    background-color: #cbd5e0;
    transform: scale(0.98);
  }
}

.form-group label .field-reset-button {
  margin-left: 8px;
  vertical-align: middle;
}
