.photo-app-wrapper {
  --app-primary: #007bff;
  --app-primary-hover: #0056b3;
  --app-danger: #dc3545;
  --app-success: #28a745;
  --app-bg-light: #f8f9fa;
  --app-border: #dee2e6;
  --app-text: #333;
  color: var(--app-text);
  box-sizing: border-box;
  line-height: 1.5;
}

.photo-app-wrapper * {
  box-sizing: border-box;
}

.photo-app-container {
 max-width: 100%;
    margin: 0 auto;
    background: repeating-linear-gradient(45deg, #dbdbdb, #dbdbdb 10px, #f0f8ff calc(10px + 1px), #f0f8ff 20px, #dbdbdb calc(20px + 1px));
    padding: 20px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.photo-app-step { display: none; animation: appFadeIn 0.3s ease-in-out; }
.photo-app-step.active { display: block; }

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

.photo-upload-area {
  border: 2px dashed var(--app-border);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--app-bg-light);
  position: relative;
}
.photo-upload-area:hover { 
  border-color: var(--app-primary); 
  background: #e7f1ff; 
}
.photo-upload-icon { 
  margin-bottom: 15px; 
  display: flex;
  justify-content: center;
  align-items: center;
}
.photo-upload-icon svg {
  width: 48px;
  height: 48px;
  fill: var(--app-primary);
}

.photo-cropper-wrapper {
  height: 400px;
  background: #222;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
}
.photo-cropper-wrapper img {
  max-width: 100%;
  display: block;
}

.photo-preview-section { text-align: center; margin-bottom: 25px; }
.photo-preview-box {
  width: 180px;
  height: 240px;
  margin: 0 auto 20px;
  border: 1px solid var(--app-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.photo-preview-box img { 
  max-width: 100%; 
  max-height: 100%; 
  object-fit: contain; 
}

.photo-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 25px;
  background: var(--app-bg-light);
  padding: 15px;
  border-radius: 8px;
}
.photo-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--app-border);
  font-size: 14px;
}
.photo-toggle-switch { 
  position: relative; 
  width: 44px; 
  height: 24px; 
  display: inline-block; 
  vertical-align: middle;
  margin: 0;
}
.photo-toggle-switch input { opacity: 0; width: 0; height: 0; }
.photo-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc; transition: .3s; border-radius: 34px;
}
.photo-slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
}
.photo-toggle-switch input:checked + .photo-slider { background-color: var(--app-primary); }
.photo-toggle-switch input:checked + .photo-slider:before { transform: translateX(20px); }

.photo-btn-group { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 10px; 
  justify-content: center; 
  margin-top: 20px; 
}
.photo-btn {
  padding: 10px 20px; 
  border: none; 
  border-radius: 6px; 
  cursor: pointer;
  font-size: 14px; 
  font-weight: 500; 
  transition: all 0.2s;
  display: inline-flex; 
  align-items: center; 
  gap: 8px;
  line-height: 1.2;
  text-decoration: none;
}
.photo-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.photo-btn-primary { background: var(--app-primary); color: white; }
.photo-btn-primary:hover { background: var(--app-primary-hover); }

.photo-btn-secondary { background: #6c757d; color: white; }
.photo-btn-secondary:hover { background: #5a6268; }

.photo-btn-success { background: var(--app-success); color: white; }
.photo-btn-success:hover { background: #1e7e34; }

.photo-btn-danger { background: var(--app-danger); color: white; }
.photo-btn-danger:hover { background: #c82333; }

.photo-btn-outline { 
  background: transparent; 
  border: 1px solid var(--app-primary); 
  color: var(--app-primary); 
}
.photo-btn-outline:hover { background: var(--app-primary); color: white; }
.photo-btn-outline.active-layout { background: var(--app-primary); color: white; }

.photo-canvas-wrapper {
  background: #333; 
  padding: 20px; 
  border-radius: 8px;
  display: flex; 
  justify-content: center; 
  margin-bottom: 20px; 
  overflow-x: auto;
}
#layoutCanvas { 
  width: auto;
  max-width: 100%; 
  height: auto;
  max-height: 100vh; 
  background: white; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
  display: block;
}

.photo-app-wrapper h2, 
.photo-app-wrapper h3 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 20px;
  font-weight: 600;
  color: #333;
}
.photo-app-wrapper h2 { font-size: 24px; }
.photo-app-wrapper h3 { font-size: 18px; }