/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 40px 20px;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: 700;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main Content */
main {
  padding: 40px;
}

section {
  margin-bottom: 40px;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

textarea,
input[type="password"] {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e1e1;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: #f8f9fa;
}

textarea:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Character Counter */
.char-counter {
  text-align: right;
  margin-top: 5px;
  font-size: 0.9rem;
  color: #666;
}

.char-counter.warning {
  color: #ff6b35;
}

.char-counter.error {
  color: #e74c3c;
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 0;
}

.checkbox-container input {
  width: auto;
  margin-right: 10px;
}

/* Encryption Status */
.encryption-status {
  display: flex;
  align-items: center;
  margin-top: 10px;
  padding: 10px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #dc3545;
  transition: all 0.3s ease;
}

.encryption-status.enabled {
  border-left-color: #28a745;
  background: #d4edda;
}

.status-indicator {
  font-size: 1.2rem;
  margin-right: 8px;
}

#status-text {
  font-weight: 500;
}

/* Encryption Fields */
.encryption-fields {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border: 2px dashed #dee2e6;
  animation: slideDown 0.3s ease;
}

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

/* Buttons */
.button-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  min-width: 140px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(108, 117, 125, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* QR Code Section */
.qr-container {
  text-align: center;
  background: #f8f9fa;
  padding: 30px;
  border-radius: 15px;
  border: 2px solid #e9ecef;
}

.qr-container h3 {
  margin-bottom: 20px;
  color: #495057;
}

.qr-display {
  background: white;
  padding: 20px;
  border-radius: 10px;
  display: inline-block;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

#qr-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-info {
  background: #e3f2fd;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #2196f3;
}

/* Scanner Section */
.scanner-section h3 {
  margin-bottom: 20px;
  color: #495057;
}

.upload-area {
  border: 3px dashed #dee2e6;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9fa;
  margin-bottom: 20px;
}

.upload-area:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.upload-area.dragover {
  border-color: #667eea;
  background: #e3f2fd;
  transform: scale(1.02);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.upload-area p {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
}

/* Decryption Fields */
.decryption-fields {
  background: #fff3cd;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #ffeaa7;
  margin-bottom: 20px;
}

/* Result Container */
.result-container {
  background: #d4edda;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #c3e6cb;
  text-align: left;
}

.result-container h4 {
  margin-bottom: 15px;
  color: #155724;
}

.result-text {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #c3e6cb;
  margin-bottom: 15px;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  max-height: 200px;
  overflow-y: auto;
}

/* Messages */
.message-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.message {
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-weight: 500;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease;
  cursor: pointer;
  position: relative;
}

.message.success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.message.warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    border-radius: 15px;
  }

  header {
    padding: 30px 20px;
  }

  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 20px;
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .message-container {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .upload-area {
    padding: 30px 15px;
  }

  .upload-icon {
    font-size: 2.5rem;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Accessibility */
.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;
}

/* Focus styles for better accessibility */
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  body {
    background: white;
  }

  .container {
    box-shadow: none;
  }

  .message-container,
  .scanner-section {
    display: none;
  }
}
