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

:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --secondary-color: #7c3aed;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --dark: #1f2937;
  --gray: #6b7280;
  --light-gray: #f3f4f6;
  --border: #e5e7eb;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--dark);
  line-height: 1.6;
}

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

/* Header */
.header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
  animation: fadeInDown 0.6s ease;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo svg {
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  margin-top: 5px;
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  animation: fadeIn 0.8s ease;
}

/* Control Panel */
.control-panel {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow-lg);
  height: fit-content;
  /* max-height: calc(100vh - 200px); */
  overflow-y: auto;
}

.control-panel::-webkit-scrollbar {
  width: 8px;
}

.control-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.control-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--dark);
}

.section {
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section h3 {
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.control-group {
  margin-bottom: 15px;
}

.control-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--dark);
  font-size: 0.95rem;
}

.icon {
  margin-right: 8px;
}

.control-group .value {
  background: var(--primary-color);
  color: white;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  min-width: 35px;
  text-align: center;
}

input[type="number"] {
  width: 70px;
  padding: 5px;
  font-size: 18px;
  text-align: center;
  border: 2px solid #667eea;
  border-radius: 10px;
  outline: none;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="color"] {
  width: 20%;
  height: 35px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.checkbox-group label:hover {
  background: var(--light-gray);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
}

.info-box {
  background: var(--light-gray);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.95rem;
  margin-top: 10px;
}

.info-box strong {
  color: var(--primary-color);
}

small {
  color: var(--gray);
  font-size: 0.85rem;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 25px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Preview Area */
.preview-area {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border);
}

.preview-header h2 {
  font-size: 1.5rem;
  color: var(--dark);
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.icon-btn svg {
  stroke: currentColor;
}

.canvas-wrapper {
  /* flex: 1; */
  background: #fafafa;
  border-radius: 12px;
  border: 2px solid var(--border);
  overflow: scroll;
  /* display: flex; */
  display: inline-block;
  align-items: center;
  justify-content: center;
  height: 350px;
  width: 950px;
  padding: 20px;
}

.canvas-wrapper::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.canvas-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.canvas-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

#omrCanvas {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: white;
  transition: transform 0.3s ease;
}

.preview-info {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  padding: 10px;
  background: var(--light-gray);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray);
}

/* Footer */
.footer {
  text-align: center;
  color: white;
  padding: 20px;
  margin-top: 30px;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .control-panel {
    padding: 20px;
  }

  .preview-area {
    padding: 15px;
  }

  .canvas-wrapper {
    min-height: 400px;
  }
}

/* Loading State */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success Message */
.message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
}

.message.success {
  background: var(--success-color);
}

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