/**
 * ExploreX Security System Styles
 * 
 * Styling for security components including:
 * - GDPR consent banner and privacy controls
 * - Form validation error messages
 * - Security dashboard and monitoring
 * - Rate limiting and security notifications
 */

/* =============================================================================
   GDPR CONSENT BANNER
   ============================================================================= */

.gdpr-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.gdpr-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.gdpr-text h3 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.gdpr-text p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.9;
}

.gdpr-actions {
  display: flex;
  gap: 15px;
  flex-shrink: 0;
}

.gdpr-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.gdpr-accept {
  background: #10b981;
  color: white;
}

.gdpr-accept:hover {
  background: #059669;
  transform: translateY(-2px);
}

.gdpr-customize {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.gdpr-customize:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.gdpr-decline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.gdpr-decline:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  transform: translateY(-2px);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .gdpr-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  
  .gdpr-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .gdpr-btn {
    width: 100%;
    padding: 15px;
  }
}

/* =============================================================================
   FORM VALIDATION STYLES
   ============================================================================= */

.validation-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
  background-color: rgba(239, 68, 68, 0.05) !important;
}

.validation-error-message {
  display: block;
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 5px;
  padding: 5px 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 4px;
  border-left: 3px solid #ef4444;
  animation: fadeInError 0.3s ease-out;
}

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Input validation states */
input:valid,
textarea:valid,
select:valid {
  border-color: #10b981;
}

input:invalid:not(:focus):not(:placeholder-shown),
textarea:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus) {
  border-color: #ef4444;
}

/* Security indicators */
.security-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: 10px;
}

.security-indicator.secure {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.security-indicator.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.security-indicator.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* =============================================================================
   SECURITY DASHBOARD
   ============================================================================= */

.security-dashboard {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.security-dashboard.open {
  right: 0;
}

.security-dashboard-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.security-dashboard-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.security-dashboard-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.security-dashboard-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.security-dashboard-content {
  padding: 20px;
}

.security-section {
  margin-bottom: 30px;
}

.security-section h3 {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  color: #1e293b;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
}

.security-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.security-metric:last-child {
  border-bottom: none;
}

.security-metric-label {
  font-size: 0.9rem;
  color: #64748b;
}

.security-metric-value {
  font-weight: 600;
  color: #1e293b;
}

.security-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.security-status.good {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.security-status.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.security-status.critical {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Security events list */
.security-events {
  max-height: 300px;
  overflow-y: auto;
}

.security-event {
  padding: 10px;
  margin-bottom: 8px;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid #e2e8f0;
  font-size: 0.85rem;
}

.security-event.warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.security-event.critical {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.security-event-type {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.security-event-time {
  color: #64748b;
  font-size: 0.75rem;
}

/* =============================================================================
   RATE LIMITING NOTIFICATIONS
   ============================================================================= */

.rate-limit-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  z-index: 9998;
  animation: slideInRight 0.3s ease-out;
  max-width: 300px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.rate-limit-notification h4 {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 600;
}

.rate-limit-notification p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* =============================================================================
   PRIVACY SETTINGS MODAL
   ============================================================================= */

.privacy-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn 0.3s ease-out;
}

.privacy-settings-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.privacy-settings-header {
  margin-bottom: 25px;
}

.privacy-settings-header h2 {
  margin: 0 0 10px 0;
  color: #1e293b;
  font-size: 1.5rem;
}

.privacy-settings-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.privacy-option {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px 0;
  border-bottom: 1px solid #f1f5f9;
}

.privacy-option:last-child {
  border-bottom: none;
}

.privacy-toggle {
  position: relative;
  width: 50px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.privacy-toggle.active {
  background: #3b82f6;
}

.privacy-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.privacy-toggle.active::after {
  transform: translateX(26px);
}

.privacy-option-info h4 {
  margin: 0 0 5px 0;
  color: #1e293b;
  font-size: 1rem;
}

.privacy-option-info p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.4;
}

.privacy-settings-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  justify-content: flex-end;
}

.privacy-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.privacy-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
  color: white;
}

.privacy-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.privacy-btn.secondary {
  background: #f1f5f9;
  color: #64748b;
  border: 2px solid #e2e8f0;
}

.privacy-btn.secondary:hover {
  background: #e2e8f0;
  color: #475569;
}

/* =============================================================================
   SECURITY INDICATORS
   ============================================================================= */

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.security-badge.ssl {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.security-badge.csrf {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.security-badge.xss {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.security-badge.gdpr {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
  .security-dashboard {
    width: 100%;
    right: -100%;
  }
  
  .privacy-settings-content {
    padding: 20px;
    margin: 20px;
  }
  
  .privacy-settings-actions {
    flex-direction: column;
  }
  
  .privacy-btn {
    width: 100%;
  }
  
  .rate-limit-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* =============================================================================
   DARK THEME SUPPORT
   ============================================================================= */

body.dark .security-dashboard {
  background: #1e293b;
  color: #f8fafc;
}

body.dark .security-section h3 {
  color: #f8fafc;
  border-bottom-color: #475569;
}

body.dark .security-metric {
  border-bottom-color: #334155;
}

body.dark .security-metric-label {
  color: #cbd5e1;
}

body.dark .security-metric-value {
  color: #f8fafc;
}

body.dark .security-event {
  background: #334155;
  border-left-color: #475569;
}

body.dark .security-event-type {
  color: #f8fafc;
}

body.dark .privacy-settings-content {
  background: #1e293b;
  color: #f8fafc;
}

body.dark .privacy-settings-header h2 {
  color: #f8fafc;
}

body.dark .privacy-option {
  border-bottom-color: #334155;
}

body.dark .privacy-option-info h4 {
  color: #f8fafc;
}

body.dark .privacy-btn.secondary {
  background: #334155;
  color: #cbd5e1;
  border-color: #475569;
}

body.dark .privacy-btn.secondary:hover {
  background: #475569;
  color: #f8fafc;
}

/* =============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================= */

.security-dashboard:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.gdpr-btn:focus,
.privacy-btn:focus,
.security-dashboard-close:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.privacy-toggle:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gdpr-consent-banner {
    border: 2px solid white;
  }
  
  .security-dashboard {
    border: 2px solid #000;
  }
  
  .validation-error {
    border-width: 3px !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gdpr-consent-banner,
  .security-dashboard,
  .rate-limit-notification,
  .privacy-settings-modal {
    animation: none;
  }
  
  .gdpr-btn,
  .privacy-btn,
  .privacy-toggle {
    transition: none;
  }
}