:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 173 80% 40%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 173 80% 40%;
  --radius: 0.5rem;
  --dark-green: 160 80% 25%;
}

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

body {
  font-family: 'Raleway', sans-serif;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  line-height: 1.5;
}

body.rtl-mode {
  direction: rtl;
}

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

.header {
  padding: 1.5rem 0;
  border-bottom: 1px solid hsl(var(--border));
  text-align: center; /* Center the logo */
}

.logo {
  height: 2.5rem;
  /* Center the logo horizontally */
  display: inline-block;
}

.main {
  padding: 2rem 0;
}

.section {
  margin-bottom: 3rem;
  padding: 2rem;
  background-color: hsl(var(--card));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: hsl(var(--foreground));
  text-align: center;
}

.subtitle {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.description {
  color: hsl(var(--muted-foreground));
  text-align: center;
  margin-bottom: 2rem;
}

.heading-container {
  text-align: center;
  margin-bottom: 2rem;
}

.heading-ar {
  font-family: 'Neo Sans', 'Noto Sans Arabic', sans-serif;
  font-weight: 300;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  text-align: center; /* Ensure Arabic heading is centered */
}

.heading-en {
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center; /* Ensure English heading is centered */
}

.input-group {
  max-width: 600px;
  margin: 0 auto;
}

.language-selector {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.lang-button {
  padding: 0.5rem 1rem;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.lang-button.active {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.name-input-container {
  margin-bottom: 1.5rem;
  position: relative;
}

.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.input-label.focused {
  color: hsl(var(--primary));
}

.input-field {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.input-field:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsla(var(--ring), 0.1);
}

.input-field.error {
  border-color: hsl(var(--destructive));
}

.input-field.rtl {
  font-family: 'Neo Sans', 'Noto Sans Arabic', sans-serif;
}

.error-message {
  color: hsl(var(--destructive));
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none;
}

/* Font size control styles */
.font-size-control {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: hsl(var(--secondary));
  border-radius: var(--radius);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.font-size-label {
  margin-right: 1rem;
  font-weight: 500;
  min-width: 80px;
}

.font-size-slider {
  flex-grow: 1;
  margin-right: 1rem;
  cursor: pointer;
}

.font-size-value {
  min-width: 50px;
  text-align: right;
  font-weight: 500;
}

/* Text position hint styles */
.text-position-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background-color: hsl(var(--accent));
  border-radius: var(--radius);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
}

/* Remove the left hint icon */
.hint-icon {
  display: none;
}

.hint-text {
  font-size: 0.875rem;
  color: hsl(var(--accent-foreground));
  font-weight: 500;
  text-align: center; /* Ensure hint text is centered */
}

/* Animated name text */
.animated-name {
  display: inline-block;
  font-weight: 600;
  color: hsl(var(--primary));
  position: relative;
  animation: nameShake 2.5s ease-in-out infinite;
}

@keyframes nameShake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(3px);
  }
  40% {
    transform: translateX(-3px);
  }
  60% {
    transform: translateX(2px);
  }
  80% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Hand icon animation - moved to right side */
.hand-icon {
  display: inline-flex;
  margin-left: 0.5rem;
  position: relative;
}

.hand-icon svg {
  width: 20px;
  height: 20px;
  fill: hsl(var(--primary));
}

.hand-animation {
  position: relative;
  display: inline-flex;
  align-items: center;
  animation: dragAnimation 2.5s ease-in-out infinite;
}

@keyframes dragAnimation {
  0% {
    transform: translateX(0) translateY(0);
  }
  20% {
    transform: translateX(10px) translateY(-5px);
  }
  40% {
    transform: translateX(20px) translateY(0);
  }
  60% {
    transform: translateX(10px) translateY(5px);
  }
  80% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(0) translateY(0);
  }
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.device-option {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.device-option:hover {
  border-color: hsl(var(--ring));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.device-option.selected {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 0 0 2px hsla(var(--primary), 0.1);
}

.device-option.selected .device-icon {
  color: hsl(var(--primary-foreground));
}

.device-option.selected .device-description {
  color: hsla(var(--primary-foreground), 0.8);
}

.device-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-right: 1rem;
  color: hsl(var(--primary));
}

.device-info {
  flex-grow: 1;
  text-align: center; /* Center device info text */
}

.device-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  text-align: center; /* Center device title */
}

.device-description {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  text-align: center; /* Center device description */
}

.design-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.design-option {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.design-option:hover {
  border-color: hsl(var(--ring));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.design-option.selected {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary)); /* Add background color like device options */
  color: hsl(var(--primary-foreground)); /* Change text color to match device options */
  box-shadow: 0 0 0 2px hsla(var(--primary), 0.1);
}

/* Update design info styles for selected state */
.design-option.selected .design-info {
  color: hsl(var(--primary-foreground));
}

.design-option.selected .design-title {
  color: hsl(var(--primary-foreground));
}

.design-option.selected .design-description {
  color: hsla(var(--primary-foreground), 0.8);
}

/* Hide checkmark in selected design */
.design-check {
  display: none;
}

.design-info {
  padding: 1rem;
  text-align: center; /* Center design info text */
}

.design-info-header {
  display: flex;
  justify-content: center; /* Center the header content */
  align-items: center;
  margin-bottom: 0.5rem;
}

.design-title {
  font-size: 1.125rem;
  font-weight: bold;
  text-align: center; /* Center design title */
}

.design-description {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  text-align: center; /* Center design description */
}

/* Preview container styles */
.square-frame, .mobile-frame, .desktop-frame {
  position: relative;
  padding: 0.75rem;
  border-radius: 0.5rem 0.5rem 0 0;
  display: flex;
  justify-content: center;
}

.square-screen, .mobile-screen, .desktop-screen {
  position: relative;
  overflow: hidden;
  background-color: #000;
  width: 360px;
  height: 360px;
}

.square-screen {
  /* Fixed size: 360x360 */
  width: 360px;
  height: 360px;
}

.mobile-screen {
  /* Fixed size: 360x450 */
  width: 360px;
  height: 450px;
}

.desktop-screen {
  /* Fixed size: 360x640 */
  width: 360px;
  height: 640px;
}

.design-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.design-name {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1rem;
  line-height: 16px;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 0.5rem;
  font-weight: 500;
  cursor: move; /* Show move cursor */
  user-select: none; /* Prevent text selection during drag */
  touch-action: none; /* Prevent scrolling on touch devices */
}

.design-name.dragging {
  opacity: 0.9;
  cursor: grabbing;
}

.design-name p {
  display: inline-block;
  padding: 5px 10px;
  font-size: 17px;
  line-height: 16px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.design-name .en-text {
  font-family: 'Raleway', sans-serif;
  display: block;
  text-align: center; /* Ensure English text is centered */
}

.design-name .ar-text {
  font-family: 'Neo Sans', 'Noto Sans Arabic', sans-serif;
  font-weight: 300;
  display: block;
  margin-top: 5px; /* Reduced from 10px to 5px (50% of original) */
  text-align: center; /* Ensure Arabic text is centered */
}

/* Remove browser chrome for desktop view */
.desktop-browser-bar {
  display: none;
}

.download-container {
  margin-top: 2rem;
  text-align: center;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 1rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.download-button:hover:not(:disabled) {
  background-color: hsl(var(--dark-green));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.download-button:active:not(:disabled) {
  transform: translateY(1px);
}

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

.download-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.downloading .download-icon {
  animation: spin 1s linear infinite;
}

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

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

.footer {
  padding: 2rem 0;
  border-top: 1px solid hsl(var(--border));
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.copyright {
  font-size: 0.875rem;
}

@media (max-width: 1200px) {
  .design-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .design-name p {
    font-size: 14px;
  }
}

@media (max-width: 767px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
  
  .design-grid {
    grid-template-columns: 1fr;
  }
  
  .design-name p {
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .square-screen, .mobile-screen, .desktop-screen {
    max-width: 100%;
    height: auto;
  }
  
  .square-screen {
    aspect-ratio: 1 / 1;
  }
  
  .mobile-screen {
    aspect-ratio: 4 / 5;
  }
  
  .desktop-screen {
    aspect-ratio: 9 / 16;
  }
}

@media (max-width: 640px) {
  .title {
    font-size: 1.75rem;
  }
  
  .section {
    margin-bottom: 2rem;
  }
}
