:root {
  --primary-color: #4a90e2;
  --secondary-color: #2c3e50;
  --accent-color: #e74c3c;
  --background-color: #f5f6fa;
  --text-color: #2c3e50;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: var(--primary-color);
  font-size: 2.5em;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--secondary-color);
  font-size: 1.1em;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.5;
  opacity: 0.9;
}

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

.upload-box {
  border: 3px dashed var(--primary-color);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  background-color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-box:hover {
  background-color: #f8f9fa;
  border-color: var(--accent-color);
}

.upload-box i {
  font-size: 48px;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.upload-box p {
  margin: 15px 0;
  color: var(--secondary-color);
}

#fileInput {
  display: none;
}

.camera-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 15px;
  transition: background-color 0.3s ease;
}

.camera-button:hover {
  background-color: #357abd;
}

.editor-section {
  background-color: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.canvas-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

#imageCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.controls {
  margin-top: 20px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 5px;
}

.blur-controls {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.blur-controls.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.blur-brush-controls {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-group {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group label {
  white-space: nowrap;
  margin-bottom: 0;
  min-width: 140px;
}

.control-group input[type="range"] {
  flex: 1;
}

.control-group span {
  min-width: 50px;
  text-align: right;
}

.brush-controls {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 10px;
  color: var(--secondary-color);
}

input[type="range"] {
  width: 100%;
  max-width: 300px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.action-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.action-button:hover {
  background-color: #357abd;
}

#undoButton {
  background-color: var(--secondary-color);
}

#resetButton {
  background-color: var(--accent-color);
}

.camera-interface {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.camera-video-container {
  position: relative;
  width: 100%;
  height: calc(100% - 80px);
  background: #000;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.capture-btn {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 4px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  padding: 0;
  transition: all 0.3s ease;
}

.capture-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateX(-50%) scale(1.1);
}

.capture-btn:active {
  transform: translateX(-50%) scale(0.95);
}

.camera-controls {
  height: 80px;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px;
  margin-top: auto;
  z-index: 1001;
}

#rotateCamera {
  background-color: var(--secondary-color);
  opacity: 0.8;
}

#rotateCamera:hover {
  opacity: 1;
}

.camera-video-container video.rotated {
  transform: rotate(90deg);
  object-fit: contain;
  max-width: 100vh;
  max-height: 100vw;
}

.error-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff4757;
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1100;
  animation: slideUp 0.3s ease-out;
}

.error-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-message.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: all 0.5s ease-out;
}

.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.share-modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 90%;
  width: 400px;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.share-button {
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.share-button:hover {
  transform: translateY(-2px);
}

.share-button.download { background: #2ecc71; }
.share-button.whatsapp { background: #25D366; }
.share-button.twitter { background: #1DA1F2; }
.share-button.facebook { background: #4267B2; }

.close-button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.close-button:hover {
  background: #c0392b;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.preview-image {
  margin: 15px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-image img {
  display: block;
  max-width: 100%;
  height: auto;
}

.text-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.text-input-group select {
  padding: 8px 12px;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  min-width: 140px;
}

.text-input-group select option {
  padding: 8px;
}

#fontFamily option[value="Roboto"] { font-family: 'Roboto', sans-serif; }
#fontFamily option[value="Open Sans"] { font-family: 'Open Sans', sans-serif; }
#fontFamily option[value="Lato"] { font-family: 'Lato', sans-serif; }
#fontFamily option[value="Montserrat"] { font-family: 'Montserrat', sans-serif; }
#fontFamily option[value="Oswald"] { font-family: 'Oswald', sans-serif; }
#fontFamily option[value="Dancing Script"] { font-family: 'Dancing Script', cursive; }
#fontFamily option[value="Pacifico"] { font-family: 'Pacifico', cursive; }
#fontFamily option[value="Permanent Marker"] { font-family: 'Permanent Marker', cursive; }
#fontFamily option[value="Comic Neue"] { font-family: 'Comic Neue', cursive; }

#textInput {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  font-size: 16px;
}

#textSize {
  width: 80px;
}

#textColor {
  width: 50px;
  height: 35px;
  padding: 0;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  cursor: pointer;
}

#textOpacity {
  width: 100px;
  margin: 0 10px;
}

#opacityValue {
  min-width: 48px;
  font-size: 0.9em;
  color: var(--secondary-color);
}

.emoji-picker {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.emoji-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 5px;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  transform: scale(1.1);
  background-color: #f0f0f0;
}

.emoji-btn:active {
  transform: scale(0.95);
}

#addTextButton {
  background-color: var(--secondary-color);
  opacity: 0.8;
  font-size: 0.9em;
  padding: 6px 12px;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#addTextButton:hover {
  opacity: 1;
}

.layer-controls {
  margin: 20px 0;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#addLayerButton {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

#addLayerButton:hover {
  background-color: #357abd;
}

.layer-opacity-control {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
  padding: 10px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.layer-opacity-control label {
  white-space: nowrap;
  margin-bottom: 0;
  min-width: 140px;
}

.layer-opacity-control input[type="range"] {
  flex: 1;
}

.layer-opacity-control span {
  min-width: 48px;
  text-align: right;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  header h1 {
    font-size: 2em;
  }
  
  .upload-box {
    padding: 20px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-button {
    width: 100%;
    justify-content: center;
  }
  
  .blur-brush-controls {
    flex-direction: column;
    gap: 15px;
  }
  
  .control-group {
    width: 100%;
  }
  
  .subtitle {
    font-size: 1em;
    padding: 0 15px;
  }
  
  .text-input-group select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .share-modal-content {
    padding: 20px;
    width: 95%;
  }
  
  .share-button {
    padding: 10px 15px;
  }
}