/**
 * ============================================================================
 * SmartLens AI - Content Script Styles
 * ============================================================================
 * 
 * Styles for injected UI elements:
 * - Modal overlay and content
 * - Loading animations
 * - Toast notifications
 * - Result formatting
 * 
 * All classes prefixed with 'smartlens-' to avoid conflicts
 * 
 * @author Microters LLC
 * @version 1.0.0
 * ============================================================================
 */

/* ============================================================================
   CSS VARIABLES - Google Lens Inspired Blue Theme
   ============================================================================ */

:root {
  --smartlens-primary: #1a73e8;
  --smartlens-primary-hover: #1557b0;
  --smartlens-secondary: #5f6368;
  --smartlens-success: #34a853;
  --smartlens-error: #ea4335;
  --smartlens-warning: #fbbc04;
  --smartlens-bg: #ffffff;
  --smartlens-bg-secondary: #f8f9fa;
  --smartlens-text: #202124;
  --smartlens-text-secondary: #5f6368;
  --smartlens-border: #dadce0;
  --smartlens-shadow: 0 4px 8px rgba(60, 64, 67, 0.15);
  --smartlens-radius: 8px;
  --smartlens-radius-sm: 4px;
}

/* ============================================================================
   MODAL STYLES
   ============================================================================ */

/* Modal Container */
.smartlens-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483647; /* Maximum z-index */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--smartlens-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Overlay Background */
.smartlens-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: smartlens-fadeIn 0.2s ease-out;
}

/* Modal Content Box */
.smartlens-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--smartlens-bg);
  border-radius: var(--smartlens-radius);
  box-shadow: var(--smartlens-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: smartlens-slideUp 0.3s ease-out;
}

/* Modal Header */
.smartlens-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--smartlens-border);
  background: var(--smartlens-bg-secondary);
}

.smartlens-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--smartlens-text);
}

/* Close Button */
.smartlens-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--smartlens-text-secondary);
  border-radius: var(--smartlens-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.smartlens-modal-close:hover {
  background: var(--smartlens-border);
  color: var(--smartlens-text);
}

/* Modal Body */
.smartlens-modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-height: 200px;
}

/* Modal Footer */
.smartlens-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--smartlens-border);
  background: var(--smartlens-bg-secondary);
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

.smartlens-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--smartlens-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.smartlens-btn-primary {
  background: var(--smartlens-primary);
  color: white;
}

.smartlens-btn-primary:hover {
  background: var(--smartlens-primary-hover);
  transform: translateY(-1px);
}

.smartlens-btn-secondary {
  background: var(--smartlens-bg);
  color: var(--smartlens-text);
  border: 1px solid var(--smartlens-border);
}

.smartlens-btn-secondary:hover {
  background: var(--smartlens-bg-secondary);
  border-color: var(--smartlens-secondary);
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */

.smartlens-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.smartlens-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--smartlens-border);
  border-top-color: var(--smartlens-primary);
  border-radius: 50%;
  animation: smartlens-spin 1s linear infinite;
}

.smartlens-loading-text {
  margin: 20px 0 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--smartlens-text);
}

.smartlens-loading-subtext {
  margin: 0;
  font-size: 14px;
  color: var(--smartlens-text-secondary);
}

/* ============================================================================
   RESULT STYLES
   ============================================================================ */

.smartlens-result {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.smartlens-result-image {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: var(--smartlens-bg-secondary);
  border-radius: var(--smartlens-radius-sm);
  border: 1px solid var(--smartlens-border);
}

.smartlens-result-image img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 4px;
}

.smartlens-result-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--smartlens-text);
}

.smartlens-result-content h2,
.smartlens-result-content h3,
.smartlens-result-content h4 {
  margin: 20px 0 10px;
  color: var(--smartlens-text);
}

.smartlens-result-content h2:first-child,
.smartlens-result-content h3:first-child,
.smartlens-result-content h4:first-child {
  margin-top: 0;
}

.smartlens-result-content strong {
  font-weight: 600;
  color: var(--smartlens-text);
}

.smartlens-result-content code {
  padding: 2px 6px;
  background: var(--smartlens-bg-secondary);
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 14px;
}

.smartlens-result-content pre {
  padding: 16px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--smartlens-radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}

.smartlens-result-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.smartlens-result-content li {
  margin: 8px 0;
  padding-left: 8px;
}

/* ============================================================================
   ERROR STYLES
   ============================================================================ */

.smartlens-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.smartlens-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.smartlens-error-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--smartlens-text);
}

.smartlens-error-message {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--smartlens-text-secondary);
  max-width: 400px;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.smartlens-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--smartlens-text);
  color: white;
  border-radius: var(--smartlens-radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 2147483647;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

.smartlens-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.smartlens-toast-success {
  background: var(--smartlens-success);
}

.smartlens-toast-error {
  background: var(--smartlens-error);
}

.smartlens-toast-icon {
  font-size: 18px;
}

.smartlens-toast-message {
  font-weight: 500;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes smartlens-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes smartlens-slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes smartlens-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

@media (max-width: 640px) {
  .smartlens-modal-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }
  
  .smartlens-modal-header {
    padding: 16px 20px;
  }
  
  .smartlens-modal-title {
    font-size: 18px;
  }
  
  .smartlens-modal-body {
    padding: 20px;
  }
  
  .smartlens-modal-footer {
    padding: 12px 20px;
    flex-direction: column;
  }
  
  .smartlens-btn {
    width: 100%;
  }
  
  .smartlens-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

/* ============================================================================
   SCROLLBAR STYLES
   ============================================================================ */

.smartlens-modal-body::-webkit-scrollbar {
  width: 8px;
}

.smartlens-modal-body::-webkit-scrollbar-track {
  background: var(--smartlens-bg-secondary);
  border-radius: 4px;
}

.smartlens-modal-body::-webkit-scrollbar-thumb {
  background: var(--smartlens-border);
  border-radius: 4px;
}

.smartlens-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--smartlens-secondary);
}

/* ============================================================================
   END OF STYLES
   ============================================================================ */
