/* CSS moderno e responsivo */
:root {
  --primary-color: #6e8efb;
  --secondary-color: #a777e3;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --error-color: #dc3545;
  --text-color: #333;
  --bg-color: #f8f9fa;
  --border-radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  min-height: 100vh;
  color: var(--text-color);
}

.app-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-content {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  width: 100%;
  max-width: 400px;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.logo h1 {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 10px;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #666;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.input-group input,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
  font-family: inherit;
}

.input-group input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(110, 142, 251, 0.1);
}

.btn {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  background: #5a7cfa;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(110, 142, 251, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-qr {
  background: var(--secondary-color);
}

.btn-qr:hover:not(:disabled) {
  background: #9668e0;
}

.btn-create {
  background: var(--success-color);
}

.btn-create:hover:not(:disabled) {
  background: #218838;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  margin: 15px 0;
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.alert {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Create Screen Styles */
.create-screen {
  animation: slideIn 0.3s ease;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.char-counter {
  text-align: right;
  font-size: 0.85rem;
  color: #666;
  margin-top: 5px;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 15px;
}

.color-picker input[type="color"] {
  width: 50px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.color-presets {
  display: flex;
  gap: 8px;
}

.color-preset {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
}

.color-preset:hover,
.color-preset.active {
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.action-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn.save {
  background: var(--success-color);
  color: white;
}

.action-btn.save:hover {
  background: #218838;
}

.action-btn.back {
  background: #6c757d;
  color: white;
}

.action-btn.back:hover {
  background: #545b62;
}

/* QR Scanner Styles */
.qr-scanner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.qr-scanner-container {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.qr-scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.qr-scanner-title {
  color: var(--primary-color);
  font-weight: 600;
  margin: 0;
}

.qr-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: var(--transition);
}

.qr-close-btn:hover {
  background: #f8f9fa;
  color: var(--error-color);
}

.qr-scanner-frame {
  position: relative;
  width: 100%;
  height: 300px;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: #000;
}

.qr-scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-scanner-square {
  width: 200px;
  height: 200px;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary-color);
}

.corner-tl {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
}

.corner-tr {
  top: -3px;
  right: -3px;
  border-left: none;
  border-bottom: none;
}

.corner-bl {
  bottom: -3px;
  left: -3px;
  border-right: none;
  border-top: none;
}

.corner-br {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
}

.qr-scanner-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.qr-scanner-instruction {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.qr-feedback {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.feedback-success,
.feedback-error {
  background: var(--success-color);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  box-shadow: var(--shadow);
}

.feedback-error {
  background: var(--error-color);
}

/* Preview Screen */
.preview-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: 999;
  padding: 20px;
  overflow-y: auto;
}

.preview-content {
  max-width: 400px;
  margin: 0 auto;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.preview-overlay {
  padding: 30px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.preview-message-container {
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.preview-category {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.preview-message {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-color);
  margin-bottom: 30px;
  font-weight: 400;
}

.preview-sender {
  margin-top: 30px;
}

.preview-sender p {
  margin-bottom: 10px;
  font-weight: 500;
  color: #666;
}

.sender-input {
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  padding: 12px;
  font-size: 1rem;
  font-weight: 500;
}

.preview-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.preview-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.preview-btn.save {
  background: var(--success-color);
  color: white;
}

.preview-btn.cancel {
  background: #6c757d;
  color: white;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 480px) {
  .app-container {
    padding: 10px;
  }

  .app-content {
    padding: 20px;
  }

  .qr-scanner-container {
    margin: 10px;
    padding: 15px;
  }

  .qr-scanner-frame {
    height: 250px;
  }

  .qr-scanner-square {
    width: 150px;
    height: 150px;
  }
}

@media (min-width: 768px) {
  .app-container {
    max-width: 500px;
  }

  .app-content {
    max-width: 500px;
    padding: 40px;
  }

  .qr-scanner-container {
    max-width: 500px;
  }
}
