/* File name and path: assets/css/desginer.css */

/* Reset and base styles */
/* * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333333;
  background-color: #ffffff;
} */




/* Toggle Switch Styling */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  margin-left: 8px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e5e7eb;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3b82f6; /* Blue when active */
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* Rounded switch */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}


/* Auto-save indicator */
.auto-save-indicator {
  display: none;
  position: absolute;
  background: #4b5563;
  color: #fff;
  padding: 4px 8px;
  margin-left : 5px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 999999;
}

/* Auto-save toggle button styles */
#auto-save-toggle {
  background-color: #f3f4f6 !important;
  border: 1px solid #d1d5db !important;
  transition: all 0.2s ease !important;
}

#auto-save-toggle:hover {
  background-color: #e5e7eb !important;
}

#auto-save-toggle.auto-save-active {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

#auto-save-toggle.auto-save-active:hover {
  background-color: #059669 !important;
}

#auto-save-toggle.auto-save-active i,
#auto-save-toggle.auto-save-active span {
  color: #ffffff !important;
}

#csd-session-field-text {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
}

/* Sessions modal */
.csd-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}
.csd-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px 30px;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  position: relative;
}
.csd-close {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 24px;
  cursor: pointer;
}
.csd-sessions-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.csd-session-item {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.csd-session-item:hover {
  background-color: #f9f9f9;
}
.csd-session-name {
  font-weight: bold;
}
.csd-session-dates {
  font-size: 12px;
  color: #666;
}
.csd-save-new {
  margin-top: 15px;
  text-align: right;
}
#csd-new-session-name {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}







/* Loader Overlay Styles */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(5px);
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999999; /* Ensure it's above ALL other elements including modals */
}

/* Loader Container */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Spinner Animation */
.spinner {
  width: 60px;
  height: 60px;
  border: 8px solid transparent;
  border-top: 8px solid #3b82f6; /* Blue */
  border-right: 8px solid #10b981; /* Green */
  border-bottom: 8px solid #f97316; /* Orange */
  border-left: 8px solid #ef4444; /* Red */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-top: 50px;
}

/* Loader Text */
.loader-text {
  font-size: 18px;
  color: #374151;
  font-weight: 600;
}

/* Spin Keyframes */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Optional: Smooth fade-in and fade-out transitions */
.loader-overlay.fade-in {
  animation: fadeIn 0.3s forwards;
}

.loader-overlay.fade-out {
  animation: fadeOut 0.3s forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}


#edit-design-modal {
  display: none;
}

.position-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.position-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.position-btn:hover {
  background-color: #f3f4f6;
}

.position-btn.active {
  background-color: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

/* Restricted Region Styles */
.canvas-area .restricted-region {
  border: 2px dashed rgba(0,0,0,0.5);
  position: absolute;
  pointer-events: none;
}

/* Edit Design Modal Styles */
#edit-design-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

#edit-design-modal .modal-content {
  background-color: #fefefe;
  margin: 3% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 550px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.3s ease;
}

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

#edit-design-modal .close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #6b7280;
  cursor: pointer;
  border-radius: 50%;
  background: #f3f4f6;
  transition: all 0.2s ease;
  z-index: 10;
}

#edit-design-modal .close-modal:hover {
  background: #e5e7eb;
  color: #374151;
  transform: scale(1.1);
}

#edit-design-modal .modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
}

/* Loading state for Edit Design Panel */
.edit-design-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.edit-design-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.edit-design-loading p {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
}

.edit-design-popup {
  padding: 20px;
}

.design-info {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f8fafc;
  border-radius: 8px;
}

.design-info p {
  margin: 5px 0;
  font-size: 14px;
}

.color-edit-section {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: visible;
}

.color-edit-section h3 {
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  position: sticky; /* Keep header visible while scrolling */
  top: 0;
  background-color: #ffffff;
  padding-bottom: 10px;
  z-index: 1;
}

.color-table {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 350px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 5px;
}

/* Mobile responsive for color table */
@media (max-width: 768px) {
  .color-table {
    min-height: 300px;
    max-height: 400px;
  }
}

@media (max-width: 480px) {
  .color-table {
    min-height: 250px;
    max-height: 350px;
  }
}

/* Custom scrollbar for color table */
.color-table::-webkit-scrollbar {
  width: 8px;
}

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

.color-table::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.color-table::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background-color: #f8fafc;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  overflow: visible;
  position: relative;
}

.color-row:hover {
  background-color: #f1f5f9;
}

.color-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-label {
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.color-description {
  color: #6b7280;
  font-size: 13px;
}

.color-brand {
  color: #9ca3af;
  font-size: 12px;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.current-color {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid #e5e7eb;
  transition: transform 0.2s ease;
}

.current-color:hover {
  transform: scale(1.1);
}

/* Custom Thread Color Dropdown (replaces native select) */
.thread-color-dropdown {
  position: relative;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  font-size: 14px;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover {
  border-color: #94a3b8;
}

.thread-color-dropdown.open .dropdown-trigger {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dropdown-selected-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.dropdown-arrow {
  font-size: 10px;
  color: #6b7280;
  margin-left: 8px;
  transition: transform 0.2s ease;
}

.thread-color-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: fixed;
  width: 220px;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  display: none;
  overflow: hidden;
}

.thread-color-dropdown.open .dropdown-menu {
  display: block;
}

.color-search {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.color-search:focus {
  background: #f9fafb;
}

.color-search::placeholder {
  color: #9ca3af;
}

.dropdown-list {
  max-height: 350px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  gap: 10px;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.item-color-preview {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #374151;
}

.dropdown-loading,
.dropdown-empty {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

/* Scrollbar styling for dropdown list */
.dropdown-list::-webkit-scrollbar {
  width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dropdown-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.dropdown-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Notification Styles */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  z-index: 2000;
  animation: slideIn 0.3s ease-out;
}

.notification.success {
  background-color: #10b981; 
}

.notification.error {
  background-color: #ef4444;
}

.notification.info {
  background-color: #3b82f6;
}

@keyframes slideIn {
  from {
      transform: translateX(100%);
      opacity: 0;
  }
  to {
      transform: translateX(0);
      opacity: 1;
  }
}










/* Image Panel Styles */
.image-panel {
    padding: 16px;
}

/* Digitize Info Section */
.digitize-info-section {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    border: 1px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

.digitize-notice h3 {
    color: #92400e;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.digitize-description {
    color: #78350f;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.digitize-requirements {
    list-style: none;
    padding: 0;
    margin: 0;
}

.digitize-requirements li {
    color: #78350f;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 4px;
}

/* Image Dimensions Section */
.image-dimensions-section {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 12px;
    border: 1px solid #3b82f6;
}

.image-dimensions-section h4 {
    color: #1e40af;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.dimension-inputs {
    display: flex;
    gap: 16px;
}

.dimension-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dimension-group label {
    font-weight: 600;
    color: #1e40af;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.dimension-group input {
    padding: 10px 12px;
    border: 2px solid #93c5fd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.dimension-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dimension-conversion {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 4px 8px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

.area-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.upload-user-image-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af !important;
}

.size-suggestions {
    margin-top: 16px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    border-left: 4px solid #10b981;
}

.size-suggestions p {
    margin: 0 0 8px 0;
    color: #047857;
    font-size: 14px;
}

.size-preset {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px 6px 4px 0;
    background: #10b981;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-preset:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.image-upload-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    overflow: hidden;
}

.image-upload-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
    text-align: center;
}

.image-upload-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
    text-align: center;
}

.image-upload-section label {
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

#user-image-upload {
    width: 100%;
    padding: 16px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background-color: #ffffff;
    font-size: 14px;
    color: #475569;
    transition: all 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
    text-align: center;
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#user-image-upload:hover {
    border-color: #94a3b8;
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#user-image-upload:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#upload-image-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

#upload-image-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

#upload-image-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

#upload-image-btn {
    width: 100%;
    padding: 12px 24px;
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#upload-image-btn:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

#upload-image-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.uploaded-image-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uploaded-image-preview h3 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

/* Grid for Uploaded Images */
.uploaded-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Individual Uploaded Image Container */
.uploaded-image-container {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f9fafb;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.uploaded-image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Individual Uploaded Image Item */
.uploaded-image-item {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid #e5e7eb;
}

/* Image Dimensions Info */
.image-dimensions-info {
    padding: 12px;
}

.image-dimensions-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.dimension-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.dimension-label {
    font-weight: 600;
    color: #6b7280;
}

.dimension-value {
    color: #374151;
    font-family: monospace;
}

.dimension-note {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    margin: 8px 0 0 0;
    line-height: 1.4;
}


/* Layout */
.container {
  display: flex;
  /* height: 100vh; */
  overflow: hidden;
}

/* Sidebar styles */
.sidebar {
  display: flex;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  width: 500px;
  background-color: #ffffff;
  z-index: 1000;
  overflow: hidden;
}

/* Ensure all inputs and form elements within sidebar stay within bounds */
.sidebar input,
.sidebar select,
.sidebar textarea,
.sidebar button {
  box-sizing: border-box;
  max-width: 100%;
}

/* Prevent text overflow in all sidebar elements */
.sidebar * {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.filter-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    overflow: hidden;
}

.filter-container label {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.filter-container select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    font-size: 14px;
    color: #334155;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 44px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.filter-container select:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-container select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-container select:disabled {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.6;
    border-color: #e2e8f0;
}


.sidebar-header {
  width: 100%;
  height: 64px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.toolbar-logo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: transparent;
}

.toolbar-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.toolbar-logo img:hover {
  transform: scale(1.02);
}

.toolbar-sidebar {
  width: 68px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: 1px 0 4px rgba(0, 0, 0, 0.03);
}

.toolbar-buttons {
  margin-top: 64px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 4px;
}

.tool-btn {
  width: 100%;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  margin: 0 2px;
}

.tool-btn:hover {
  background-color: #f1f5f9;
  color: #3b82f6;
  transform: translateY(-1px);
}

.tool-btn.active {
  color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

.tool-btn i {
  width: 24px;
  height: 24px;
}

.tool-btn span {
  font-size: 11px;
  line-height: 1;
}

/* Dashboard link - ensure anchor tag looks like button */
a.tool-btn,
a.tool-btn.dashboard-link {
  text-decoration: none;
  box-sizing: border-box;
}

a.tool-btn:hover,
a.tool-btn.dashboard-link:hover {
  text-decoration: none;
}

/* Disabled panel button styles - shown when garment not yet selected */
.tool-btn.disabled-panel {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.tool-btn.disabled-panel:hover {
  background-color: transparent;
  color: #6b7280;
}

.tool-btn.disabled-panel::after {
  content: '🔒';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
}

/* Highlight animation for Garments button */
@keyframes garmentPulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.tool-btn.highlight-garment {
  animation: garmentPulse 0.6s ease-in-out infinite;
  background-color: #dbeafe !important;
  border: 2px solid #3b82f6 !important;
  color: #1d4ed8 !important;
}

.content-sidebar {
  width: 380px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  margin-top: 64px;
  height: calc(100vh - 64px);
  overflow-x: hidden;
  box-shadow: 1px 0 6px rgba(0, 0, 0, 0.03);
}

.search-container {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #9ca3af;
  pointer-events: none;
}

.panel-container {
  flex: 1;
  /* overflow-y: auto; */
  padding: 16px;
  overflow-x: hidden;
}

.panel {
  display: none;
  position: relative;
}

.panel.active {
  display: block;
}

/* Templates panel specific styling */
.templates-panel {
  position: relative;
  min-height: 300px;
}

/* Product and template grids */
.products-grid,
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 4px;
}

.product-card,
.template-card {
  cursor: pointer;
  transition: transform 0.2s ease;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.product-card:hover,
.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-card img,
.template-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.product-name,
.template-name {
  display: block;
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  color: #4b5563;
  font-weight: 500;
}

.product-price {
  display: block;
  text-align: center;
  color: #f97316;
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
}

/* Art grid */
.art-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px;
}

.art-item {
  cursor: pointer;
  transition: transform 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.art-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.art-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background-color: #ffffff;
}

.price-display {
  margin-bottom: 12px;
  font-size: 14px;
  text-align: center;
}

.price-amount {
  color: #f97316;
  font-weight: 600;
  font-size: 16px;
}

/* Main content styles */
.main-content {
  margin-left: 500px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar styles */
.toolbar {
  height: auto;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  gap: 16px;
}

.toolbar-group {
  display: flex;
  gap: 8px;
}

.toolbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border: none;
  background: none;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background-color: #f1f5f9;
  color: #3b82f6;
}

/* Mobile Toolbar Toggle & Drawer - Desktop only styles */
@media (min-width: 769px) {
  .mobile-toolbar-toggle {
    display: none !important;
  }
  
  .toolbar-drawer {
    display: block !important;
  }
}

.toolbar-btn i {
  width: 20px;
  height: 20px;
}

.toolbar-btn span {
  font-size: 11px;
  line-height: 1;
}

/* Apply Changes Button - Simple and Modern */
#apply-recolor-btn {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 12px;
}

#apply-recolor-btn:not(:disabled) {
  color: white;
}

#apply-recolor-btn:not(:disabled):hover {
  background: #2563eb;
  color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

#apply-recolor-btn:not(:disabled):active {
  color: white;
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

#apply-recolor-btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#apply-recolor-btn i {
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

#apply-recolor-btn:not(:disabled) i {
  color: white;
}

#apply-recolor-btn span {
  font-size: 12px;
  font-weight: 500;
}

#apply-recolor-btn:not(:disabled) span {
  color: white;
}

/* Canvas Area */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
  overflow: hidden;
  position: relative;
  padding: 16px;
}

.preview-container {
  flex: 1;
  position: relative;
  display: flex;
}

.view-buttons {
  position: fixed;
  left: 500px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  z-index: 10;
  background-color: transparent;
  box-shadow: none;
  border-radius: 0;
}

.view-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100px;
  text-align: center;
  font-size: 14px;
  border-radius: 6px;
  margin: 0;
}

.view-btn:hover {
  background-color: #f3f4f6;
}

.view-btn.active {
  background-color: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

.size-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.size-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.size-buttons .size-btn {
  display: none;
}

.size-btn:hover {
  background-color: #f3f4f6;
}

.size-btn.active {
  background-color: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

.size-btn.disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.6;
}

.size-btn.disabled:hover {
  background-color: #f3f4f6;
  color: #9ca3af;
}

/* Adjustments for the preview-content */
.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: relative;
}

.t-shirt-preview {
  flex: 1;
  background-color: #ffffff;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  position: relative;
}

#tshirt-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Nice border around the fabric.js canvas container */
.canvas-container {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  background-color: #e7e0e0;
}

/* Controls container */
.controls-container {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 400px;
  max-width: 600px;
  background-color: #ffffff;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(229, 231, 235, 0.5);
  z-index: 100;
}

.controls-container::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background-color: #e5e7eb;
  border-radius: 2px;
  opacity: 0.5;
}

/* Color options */
.color-options {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-btn:hover {
  transform: scale(1.1);
  border-color: #94a3b8;
}

.color-btn.active {
  border-color: #2563eb;
  transform: scale(1.1);
}

.color-btn.active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid #2563eb;
  border-radius: 50%;
  opacity: 0.5;
}

/* Zoom controls */
.zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 16px;
  background-color: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zoom-btn {
  padding: 6px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover {
  background-color: #f1f5f9;
  color: #3b82f6;
}

.zoom-btn i {
  width: 20px;
  height: 20px;
}

.zoom-slider {
  width: 180px;
  height: 4px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #e5e7eb;
  border-radius: 2px;
  outline: none;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow:  0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background-color: #3b82f6;
}

.zoom-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.zoom-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  background-color: #3b82f6;
}

.zoom-level {
  font-size: 14px;
  color: #64748b;
  min-width: 60px;
  font-weight: 500;
}

/* Reset Button - Modern Design */
.reset-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.reset-button:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #3b82f6;
  color: #3b82f6;
  transform: rotate(-15deg);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}

.reset-button:active {
  transform: rotate(-30deg) scale(0.95);
}

.reset-button svg,
.reset-button i {
  width: 20px;
  height: 20px;
}

/* Text tools section */
.text-tools-section {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.text-tools-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

/* Text positioning section */
.text-positioning-section {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  animation: slideDown 0.3s ease-out;
}

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

.text-positioning-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

.position-indicator {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.position-status, .alignment-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.position-status {
  background-color: #e0f2fe;
  border: 1px solid #0284c7;
}

.alignment-status {
  background-color: #f0fdf4;
  border: 1px solid #16a34a;
}

.status-text {
  color: #0284c7;
}

.alignment-text {
  color: #16a34a;
}

/* Position status colors for different states */
.position-status.above {
  background-color: #fef3c7;
  border-color: #f59e0b;
  animation: pulse 0.5s ease-in-out;
}

.position-status.above .status-text {
  color: #f59e0b;
}

.position-status.below {
  background-color: #ddd6fe;
  border-color: #7c3aed;
  animation: pulse 0.5s ease-in-out;
}

.position-status.below .status-text {
  color: #7c3aed;
}

.position-status.over {
  background-color: #fee2e2;
  border-color: #dc2626;
  animation: pulse 0.5s ease-in-out;
}

.position-status.over .status-text {
  color: #dc2626;
}

.position-status.center {
  background-color: #dcfce7;
  border-color: #16a34a;
  animation: pulse 0.5s ease-in-out;
}

.position-status.center .status-text {
  color: #16a34a;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.position-help-text {
  margin-top: 8px;
  padding: 8px;
  background-color: #f1f5f9;
  border-radius: 4px;
  border-left: 3px solid #3b82f6;
}

.position-help-text small {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.text-customization {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.form-group {
  margin-bottom: 12px;
  overflow: hidden;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:hover,
.form-group select:hover {
  border-color: #94a3b8;
}

/* Buttons - Enhanced */
.primary-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  letter-spacing: 0.5px;
  text-transform: none;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
}

.secondary-btn {
  width: 100%;
  padding: 10px 16px;
  background-color: #ffffff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.secondary-btn:hover {
  background-color: #f3f4f6;
  border-color: #94a3b8;
}

/* File Format Selector */
#csd-file-format-selection {
  margin: 20px 0;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 5px;
}

#csd-file-format-selection label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}

#csd-file-format {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
}

#csd-file-format:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Buttons, just examples */
.secondary-btn {
  background: #e2e2e2;
  border: none;
  color: #333;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin: 0 0.25rem;
  cursor: pointer;
}
.secondary-btn:hover {
  background: #ccc;
}

.danger-btn {
  background: #dc3545;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin: 0 0.25rem;
  cursor: pointer;
}
.danger-btn:hover {
  background: #c82333;
}

/* The nested "confirm-cancel-content" can be smaller or the same style. */
.confirm-cancel-content {
  width: 340px;
  max-width: 90%;
}
.confirm-cancel-content h3 {
  margin-bottom: 1rem;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}


/* FINAL PREVIEW CSS */
.animated-zoomIn {
  animation: zoomIn 0.4s ease forwards;
}
@keyframes zoomIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* The container for the final preview modal */
#final-preview-modal {
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  background-color: rgba(0,0,0,0.6);
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  box-sizing: border-box;
}

.final-preview-content {
  background: #fff;
  max-width: 800px;
  width: 100%;
  margin: 20px auto;
  border-radius: 8px;
  overflow: visible;
  position: relative;
  box-shadow: 0 2px 15px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s;
  max-height: none;
}

.final-preview-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
}

.final-preview-header {
  text-align: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}
.final-preview-header .subtitle {
  color: #666;
  margin-top: 4px;
  font-size: 0.9rem;
}

.final-preview-body {
  display: flex;
  flex-direction: row;
  padding: 20px;
  flex-wrap: wrap;
}

.preview-left,
.preview-right {
  flex: 1;
  min-width: 0;
  margin: 10px;
}

.final-preview-image {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: block;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.info-row label {
  font-weight: bold;
}

.download-buttons {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
}
.download-btn {
  display: inline-block;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: #4a90e2;
  color: #fff !important;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: background 0.2s;
  text-align: center;
}
.download-btn i {
  vertical-align: middle;
  margin-right: 6px;
}
.download-btn:hover {
  background: #367ac2;
}
.download-btn.disabled {
  background: #ccc;
  pointer-events: none;
}

/* Final Preview Modal - Mobile Responsive */
@media (max-width: 768px) {
  #final-preview-modal {
    padding: 10px;
    align-items: flex-start;
  }
  
  .final-preview-content {
    width: 100%;
    margin: 10px auto;
    border-radius: 8px;
    max-height: none;
  }
  
  .final-preview-header {
    padding: 16px;
    padding-right: 40px;
  }
  
  .final-preview-header h2 {
    font-size: 18px;
  }
  
  .final-preview-close {
    top: 12px;
    right: 12px;
    font-size: 28px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .final-preview-body {
    flex-direction: column;
    padding: 12px;
  }
  
  .preview-left,
  .preview-right {
    flex: none;
    width: 100%;
    margin: 8px 0;
  }
  
  .info-row {
    flex-direction: column;
    gap: 4px;
  }
  
  .download-buttons {
    margin-top: 16px;
  }
  
  .download-btn {
    padding: 14px 16px;
    font-size: 14px;
  }
}

/* Preloader Styles */
#page-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff; /* White background */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999; /* Ensures it stays above all other content */
  transition: opacity 0.5s ease;
}

#page-preloader.fade-out {
  opacity: 0;
}

.preloader-bar {
  width: 80%;
  max-width: 600px;
  height: 12px;
  background-color: #e5e7eb; /* Light gray background for the bar */
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
}

.preloader-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981); /* Attractive gradient */
  border-radius: 6px;
  transition: width 0.1s ease;
}

.preloader-text {
  font-size: 18px;
  color: #374151;
  text-align: center;
}

/* Enhanced logo styling */
.toolbar-logo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: transparent;
}

.toolbar-logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Responsive adjustments for logo */
@media (max-width: 1280px) {
    .toolbar-logo img {
        height: 38px;
    }
}

@media (max-width: 1024px) {
    .toolbar-logo img {
        height: 36px;
    }
}

@media (max-width: 768px) {
    .toolbar-logo {
        padding: 8px;
    }
    
    .toolbar-logo img {
        height: 32px;
    }
}

@media (max-width: 480px) {
    .toolbar-logo {
        padding: 6px;
    }
    
    .toolbar-logo img {
        height: 32px;
    }
}

/* Ensure sidebar header has proper height */
.sidebar-header {
    min-height: 64px;
}

/* Adjust content sidebar margin to match header height */
.content-sidebar {
    margin-top: 64px;
    height: calc(100vh - 64px);
}

/* Responsive adjustment for sidebar header */
@media (max-width: 768px) {
    .sidebar-header {
        min-height: 56px;
        height: 56px;
    }
    
    .toolbar-logo img {
        height: 28px;
    }
    
    .content-sidebar {
        margin-top: 0;
        height: auto;
    }
    
    .toolbar-buttons {
        margin-top: 56px;
    }
}

/* Light Mode Override - Add this at the end of your CSS file */
@media (prefers-color-scheme: dark) {
  /* Base styles */
  body {
    background-color: #ffffff !important;
    color: #333333 !important;
  }

  /* Container backgrounds */
  .sidebar,
  .toolbar-sidebar,
  .content-sidebar,
  .toolbar,
  .controls-container,
  .text-tools-section,
  .product-card,
  .template-card,
  .t-shirt-preview,
  .zoom-controls {
    background-color: #ffffff !important;
  }

  /* Border colors */
  .sidebar,
  .toolbar-sidebar,
  .content-sidebar,
  .toolbar,
  .controls-container,
  .view-btn,
  .size-btn {
    border-color: #e5e7eb !important;
  }

  /* Form elements */
  .search-input,
  .form-group input,
  .form-group select {
    background-color: #ffffff !important;
    border-color: #e5e7eb !important;
    color: #333333 !important;
  }

  /* Button states */
  .tool-btn,
  .toolbar-btn,
  .zoom-btn {
    color: #6b7280 !important;
  }

  .tool-btn:hover,
  .toolbar-btn:hover,
  .view-btn:hover,
  .size-btn:hover,
  .zoom-btn:hover {
    background-color: #f3f4f6 !important;
    color: #3b82f6 !important;
  }

  .tool-btn.active {
    background-color: #eff6ff !important;
    color: #3b82f6 !important;
  }

  /* View and size buttons */
  .view-btn,
  .size-btn {
    background-color: #ffffff !important;
    color: #374151 !important;
  }

  .view-btn.active,
  .size-btn.active {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
  }

  /* Text colors */
  .product-name,
  .template-name {
    color: #4b5563 !important;
  }

  /* Slider elements */
  .zoom-slider {
    background-color: #e5e7eb !important;
  }

  .zoom-slider::-webkit-slider-thumb {
    background-color: #ffffff !important;
    border-color: #3b82f6 !important;
  }

  .zoom-slider::-moz-range-thumb {
    background-color: #ffffff !important;
    border-color: #3b82f6 !important;
  }

  /* Cards and shadows */
  .product-card,
  .template-card,
  .text-tools-section {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Basic Shapes Light Mode Override */
@media (prefers-color-scheme: dark) {
  /* Basic Shapes buttons */
  .panel-container .panel button,
  #shapePanel button {
    background-color: #2563EB !important;
    color: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
  }

  .panel-container .panel button:hover,
  #shapePanel button:hover {
    background-color: #2563EB !important;
    color: #f3f4f6 !important;
    border-color: #3b82f6 !important;
  }

  /* Basic Shapes text */
  .panel h2,
  .panel-container h2,
  #shapePanel h2 {
    color: #374151 !important;
  }

  /* Rectangle, Circle, Triangle buttons specifically */
  .panel-container button,
  button[data-shape="rectangle"],
  button[data-shape="circle"],
  button[data-shape="triangle"] {
    background-color: #ffffff !important;
    color: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    margin-bottom: 8px !important;
    width: 100% !important;
  }

  .panel-container button:hover,
  button[data-shape="rectangle"]:hover,
  button[data-shape="circle"]:hover,
  button[data-shape="triangle"]:hover {
    background-color: #002d75 !important;
    border-color: #3b82f6 !important;
  }
}
/* Add these styles to your existing CSS file */

.mobile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.mobile-dropdown-content {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-height: 50vh;
    overflow-y: auto;
}

/* Adjust existing styles for mobile */
@media (max-width: 768px) {
    .toolbar-sidebar {
        position: relative;
        width: 100% !important;
        flex-direction: row;
        justify-content: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
        border-bottom: 1px solid #e5e7eb;
        z-index: 1000;
        left: 0 !important;
        right: 0 !important;
    }

    .toolbar-buttons {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 6px 8px !important;
        gap: 0 !important;
    }
    
    .tool-btn {
        flex: 1 1 0 !important;
        padding: 6px 4px !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    
    .tool-btn svg,
    .tool-btn i {
        width: 18px !important;
        height: 18px !important;
    }

    .tool-btn span {
        display: none;
    }
    
    /* Apply Changes button mobile styling */
    #apply-recolor-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    #apply-recolor-btn:not(:disabled) {
        color: white;
    }
    
    #apply-recolor-btn i {
        width: 12px;
        height: 12px;
        margin-right: 4px;
    }
    
    #apply-recolor-btn:not(:disabled) i {
        color: white;
    }
    
    #apply-recolor-btn span {
        font-size: 10px;
    }
    
    #apply-recolor-btn:not(:disabled) span {
        color: white;
    }

    .mobile-dropdown {
        display: block;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9999 !important;
    }
    
    .mobile-dropdown-content {
        z-index: 9999 !important;
        position: relative;
    }

    .content-sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .canvas-area {
        position: relative;
        z-index: 1;
    }

    /* Ensure consistent styling for all panels */
    .panel {
        display: block;
        padding: 15px;
    }

    .products-grid,
    .templates-grid,
    .art-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card,
    .template-card,
    .art-item {
        width: 100%;
    }

    .text-tools-section,
    .shapes-section {
        margin-bottom: 20px;
    }

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

    .sidebar-footer {
        position: static;
        padding: 15px;
        border-top: 1px solid #e5e7eb;
    }
    
    /* Mobile responsive styles for controls container */
    .controls-container {
        min-width: 320px;
        max-width: 90vw;
        flex-direction: column;
        gap: 12px;
        padding: 16px 12px;
    }
    
    .color-options {
        max-width: none;
        order: 1;
    }
    
    .zoom-controls {
        order: 2;
        width: 100%;
        justify-content: space-between;
    }
}

/* Add these styles to your existing CSS file */

.mobile-price-section {
    display: none;
    padding: 16px;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .mobile-price-section {
        display: block;
    }

    .canvas-area {
        padding-bottom: 80px; /* Adjust this value based on the height of your mobile-price-section */
    }

    .controls-container {
        bottom: 80px; /* Adjust this value to position above the mobile-price-section */
    }

    /* Hide the desktop sidebar footer on mobile */
    .sidebar-footer {
        display: none;
    }
}

/* Panel Styles */
.csd-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.csd-panel.active {
  display: block;
}

.csd-panel-header {
  padding: 15px;
  border-bottom: 1px solid #2a3346;
}

.csd-panel-header h3 {
  margin: 0;
  color: #fff;
}

/* Template Grid */
.csd-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 15px;
}

.csd-template-item {
  background: #2a3346;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
}

.csd-template-item img {
  width: 100%;
  height: auto;
  border-radius: 2px;
}

/* Clipart Grid */
.csd-clipart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 15px;
}

.csd-clipart-item {
  background: #2a3346;
  padding: 5px;
  border-radius: 4px;
  cursor: pointer;
}

.csd-clipart-item:hover {
  background: #3a4458;
}

/* Text Controls */
.csd-text-controls {
  padding: 15px;
}

.csd-text-input {
  width: 100%;
  height: 80px;
  background: #2a3346;
  border: none;
  color: #fff;
  padding: 10px;
  margin-bottom: 10px;
  resize: none;
}

.csd-font-controls {
  display: grid;
  grid-template-columns: 1fr 80px 50px;
  gap: 10px;
  margin-bottom: 10px;
}

.csd-add-text-btn {
  width: 100%;
  padding: 10px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Active States */
.csd-tool-btn.active {
  background: #2a3346;
}

/* Search Input */
.csd-search {
  width: 100%;
  padding: 8px;
  background: #2a3346;
  border: 1px solid #3a4458;
  color: #fff;
  margin-top: 10px;
  border-radius: 4px;
}

/* Centered Modal Container */
.csd-modal {
  display: none; /* will show via JS */
  position: fixed;
  z-index: 9999; /* above everything */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* allow scroll if needed */
  background: rgba(0, 0, 0, 0.4); /* semi-transparent BG */
}

/* Modal Content Centered */
.csd-modal-content {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%); 
  background: #fff;
  border-radius: 8px;
  width: 400px;
  max-width: 90%;
  max-height: 85vh;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  text-align: center;
  overflow-y: auto;
}

/* Close (X) icon */
.close-payment-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.4rem;
  color: #999;
  cursor: pointer;
}

/* Payment status text styling */
#csd-payment-status {
  margin: 15px 0;
  padding: 10px;
  background-color: #f0f8ff;
  border-left: 4px solid #4a90e2;
  font-weight: bold;
  border-radius: 4px;
}

/* Enhanced Payment Modal Styles */
#csd-payment-modal h2 {
  margin-bottom: 15px;
  color: #333;
  font-size: 24px;
}

#csd-payment-modal h3 {
  margin: 25px 0 10px;
  color: #333;
  font-size: 20px;
}

#csd-payment-modal .modal-description {
  margin-bottom: 15px;
  line-height: 1.5;
  color: #555;
}

#csd-file-format-selection {
  margin: 20px 0;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 8px;
  border-left: 4px solid #4a90e2;
}

/* Format selection required marker */
#csd-file-format-selection .required {
  color: #ff4444;
  font-weight: bold;
  margin-left: 3px;
}

/* Payment process instructions */
.payment-instructions {
  text-align: left;
  background-color: #f9f9f9;
  padding: 10px 15px;
  border-radius: 8px;
}

/* Button row for payment actions */
.modal-button-row {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.modal-button-row button {
  flex: 1;
  padding: 10px;
}

/* Primary button style for Continue to Payment */
#csd-continue-payment {
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

#csd-continue-payment:hover {
  background-color: #3a80d2;
}

#csd-continue-payment:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

#csd-file-format-selection label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
  font-size: 16px;
}

#csd-file-format {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 15px;
  color: #333;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#csd-file-format:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

#csd-payment-status {
  margin: 15px 0;
  padding: 10px;
  background-color: #f0f8ff;
  border-left: 4px solid #4a90e2;
  font-weight: bold;
  border-radius: 4px;
}

/* Share Modal Styles - Enhanced */
.share-modal, .share-link-modal, .manage-links-modal {
  background-color: #ffffff;
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  z-index: 10000;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.share-modal-content, .share-link-modal-content, .manage-links-modal-content {
  padding: 35px;
  position: relative;
}

.close-share-modal, .close-share-link-modal, .close-manage-links-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  font-weight: bold;
  color: #a0aec0;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-share-modal:hover, .close-share-link-modal:hover, .close-manage-links-modal:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.share-modal h2, .share-link-modal h2, .manage-links-modal h2 {
  margin-bottom: 25px;
  color: #2d3748;
  font-size: 26px;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.share-option {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.share-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
}

.share-option h3 {
  margin-bottom: 12px;
  color: #2d3748;
  font-size: 20px;
  font-weight: 600;
}

.share-option p {
  color: #4a5568;
  margin-bottom: 18px;
  line-height: 1.6;
}

.share-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.share-notice p {
  margin-bottom: 10px;
  color: #856404;
}

.share-preview {
  text-align: center;
  margin: 20px 0;
}

.share-preview img {
  border: 2px solid #e9ecef;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.share-link-section {
  margin: 20px 0;
}

.share-link-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.link-copy-container {
  display: flex;
  gap: 8px;
}

#share-link-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background-color: #f8f9fa;
}

.copy-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.share-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.social-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: white;
  transition: all 0.3s ease;
}

.whatsapp-btn {
  background: #25D366;
}

.whatsapp-btn:hover {
  background: #1ebe57;
  transform: translateY(-1px);
}

.facebook-btn {
  background: #1877F2;
}

.facebook-btn:hover {
  background: #166fe5;
  transform: translateY(-1px);
}

.twitter-btn {
  background: #1DA1F2;
}

.twitter-btn:hover {
  background: #1a91da;
  transform: translateY(-1px);
}

.links-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
}

.share-link-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.share-link-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.link-preview img {
  border-radius: 4px;
  border: 1px solid #ddd;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-url {
  font-size: 14px;
  color: #333;
  word-break: break-all;
  margin-bottom: 5px;
}

.link-date {
  font-size: 12px;
  color: #666;
}

.link-actions {
  display: flex;
  gap: 8px;
}

.delete-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.delete-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Responsive adjustments for share modals */
@media (max-width: 768px) {
  .share-actions {
    flex-direction: column;
  }
  
  .social-btn {
    width: 100%;
  }
  
  .share-link-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .link-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .link-copy-container {
    flex-direction: column;
  }
  
  #share-link-input {
    margin-bottom: 8px;
  }
}

/* Flying File Animation Styles */
.flying-file-animation {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  color: #3b82f6;
  font-size: 24px;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flying-file-animation i {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
}

/* Download Button Highlight Styles - Professional and Simple */
#final-preview.files-available {
  background: #10b981 !important;
  color: white !important;
  border: 2px solid #059669 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
  position: relative;
}

#final-preview.files-available i {
  color: white !important;
}

#final-preview.files-available span {
  color: white !important;
  font-weight: 600 !important;
}

#final-preview.files-available::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border: 1px solid white;
  border-radius: 50%;
}

/* Mobile responsive adjustments for flying animation */
@media (max-width: 768px) {
  .flying-file-animation {
    font-size: 20px;
  }
  
  #final-preview.files-available::after {
    width: 6px;
    height: 6px;
  }
}
/* ===== AI GENERATOR PANEL - MODERN CLEAN REDESIGN ===== */

.ai-panel {
  padding: 0;
  background: #f9fafb;
  height: 100%;
  overflow-y: auto;
}

/* AI Header - Compact & Clean */
.ai-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.ai-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 10px;
  color: white;
  flex-shrink: 0;
}

.ai-icon i {
  width: 20px;
  height: 20px;
}

.ai-header-content h2 {
  margin: 0;
  font-size: 16px;
  color: #111827;
  font-weight: 600;
}

.ai-description {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

/* Pricing Info - Subtle & Integrated */
.ai-pricing-info {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pricing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #6366f1;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.pricing-note {
  margin: 0;
  font-size: 11px;
  color: #4f46e5;
  line-height: 1.4;
  flex: 1;
  margin-left: 12px;
}

/* AI Form - Clean & Modern */
.ai-form {
  padding: 0 16px;
}

.ai-form .form-group {
  margin-bottom: 16px;
}

.ai-form label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  color: #374151;
  font-weight: 500;
  font-size: 13px;
}

.ai-form label .required {
  color: #ef4444;
}

.ai-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  transition: all 0.15s ease;
  background: white;
  color: #1f2937;
  line-height: 1.5;
}

.ai-form textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-form textarea::placeholder {
  color: #9ca3af;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.ai-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #1f2937;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.ai-form select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.field-help {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  margin-bottom: 0;
}

.field-help i {
  width: 12px;
  height: 12px;
  color: #9ca3af;
}

/* Example Tags - Compact Pills */
.ai-examples {
  margin-bottom: 16px;
  padding: 0 16px;
}

.ai-examples .examples-title {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 8px 0;
  font-weight: 500;
}

.example-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.example-tag {
  padding: 6px 10px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  font-size: 12px;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.example-tag:hover {
  background: #f3f4f6;
  border-color: #6366f1;
  color: #6366f1;
}

.example-tag.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
}

/* AI Tips - Collapsible Style */
.ai-tips {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 0 16px 16px 16px;
}

.ai-tips .tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #92400e;
  font-weight: 600;
}

.ai-tips .tips-header i {
  color: #f59e0b;
  width: 14px;
  height: 14px;
}

.ai-tips .tips-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
}

.ai-tips .tips-list li {
  font-size: 11px;
  color: #78350f;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ai-tips .tips-list li:last-child {
  margin-bottom: 0;
}

/* Generate Button - Primary Action */
.ai-generate-btn {
  width: calc(100% - 32px);
  margin: 0 16px 16px 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.ai-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.ai-generate-btn:active {
  transform: translateY(0);
}

.ai-generate-btn i {
  width: 16px;
  height: 16px;
}

/* Loading State */
.ai-loading {
  display: none;
  text-align: center;
  padding: 32px 16px;
  background: white;
  margin: 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

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

.ai-loading .loading-text {
  font-size: 14px;
  color: #1f2937;
  font-weight: 600;
  margin-bottom: 4px;
}

.ai-loading .loading-subtext {
  font-size: 12px;
  color: #6b7280;
}

/* Preview Section */
.ai-preview {
  display: none;
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin: 16px;
  border: 1px solid #e5e7eb;
}

.ai-preview h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}

.ai-preview-image {
  text-align: center;
  margin-bottom: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* Live Cost Tracker */
.ai-live-cost-tracker {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin: 0 16px 16px 16px;
}

.ai-live-cost-tracker .cost-tracker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #1e293b;
  font-weight: 700;
  font-size: 14px;
}

.ai-live-cost-tracker .cost-tracker-header i {
  width: 18px;
  height: 18px;
  color: #6366f1;
}

.ai-live-cost-tracker .cost-tracker-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  margin-bottom: 14px;
}

.ai-live-cost-tracker .cost-tracker-info i {
  width: 16px;
  height: 16px;
  color: #3b82f6;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-live-cost-tracker .cost-tracker-info p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #1e40af;
}

.ai-live-cost-tracker .cost-tracker-info strong {
  color: #1e3a8a;
}

.ai-live-cost-tracker .cost-tracker-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-live-cost-tracker .cost-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.ai-live-cost-tracker .cost-row .cost-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.ai-live-cost-tracker .cost-row .cost-label i {
  width: 14px;
  height: 14px;
  color: #94a3b8;
}

.ai-live-cost-tracker .cost-row .cost-detail {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}

.ai-live-cost-tracker .cost-row .cost-value {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  min-width: 60px;
  text-align: right;
}

.ai-live-cost-tracker .cost-row-total {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: #4f46e5;
  margin-top: 4px;
}

.ai-live-cost-tracker .cost-row-total .cost-label,
.ai-live-cost-tracker .cost-row-total .cost-label i {
  color: white;
}

.ai-live-cost-tracker .cost-row-total .cost-value {
  color: white;
  font-size: 16px;
}

/* Highlight when there are generations */
.ai-live-cost-tracker.has-generations {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-live-cost-tracker.has-generations .cost-tracker-header {
  color: #4f46e5;
}

.ai-preview-image img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-preview-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-preview-actions button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ai-preview-actions button i {
  width: 14px;
  height: 14px;
}

#ai-use-design-btn {
  background: #10b981;
  color: white;
}

#ai-use-design-btn:hover {
  background: #059669;
}

#ai-regenerate-btn {
  background: #6b7280;
  color: white;
}

#ai-regenerate-btn:hover {
  background: #4b5563;
}

/* Cost Breakdown */
.ai-cost-breakdown {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e5e7eb;
}

.cost-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

.cost-item:last-of-type {
  border-bottom: 1px dashed #d1d5db;
}

.cost-item span:first-child {
  color: #6b7280;
}

.cost-item span:last-child {
  color: #1f2937;
  font-weight: 600;
}

.cost-total {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 0 0;
  font-size: 14px;
  font-weight: 700;
  border-bottom: none;
}

.cost-total span {
  color: #1f2937;
}

.cost-total span:last-child {
  color: #6366f1;
}

/* Error Section */
.ai-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px;
  margin: 16px;
}

.ai-error-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-error-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #dc2626;
}

.ai-error-icon i {
  width: 18px;
  height: 18px;
}

.ai-error-message {
  flex: 1;
  font-size: 13px;
  color: #991b1b;
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
}

#ai-retry-btn {
  width: 100%;
  padding: 10px 14px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#ai-retry-btn:hover {
  background: #b91c1c;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .ai-pricing-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .pricing-note {
    margin-left: 0;
  }
  
  .ai-preview-actions {
    flex-direction: column;
  }
}

/* Mobile Responsive - Enhanced */
@media (max-width: 768px) {
  .ai-header {
    padding: 20px 16px;
  }
  
  .ai-icon {
    width: 42px;
    height: 42px;
  }
  
  .ai-header-content h2 {
    font-size: 20px;
  }
  
  .ai-description {
    font-size: 13px;
  }
  
  .pricing-badge {
    font-size: 18px;
    padding: 6px 14px;
  }
  
  .ai-pricing-info,
  .ai-form,
  .ai-examples,
  .ai-tips {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .ai-form textarea {
    min-height: 100px;
    font-size: 14px;
  }
  
  .ai-generate-btn {
    width: calc(100% - 32px);
    margin-left: 16px;
    margin-right: 16px;
    font-size: 16px;
    padding: 16px 20px;
  }
  
  .ai-preview,
  .ai-loading,
  .ai-error {
    margin: 16px;
  }
  
  .ai-preview-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .ai-preview-actions button {
    width: 100%;
  }
  
  .example-tags {
    gap: 8px;
  }
  
  .example-tag {
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* Highlight animation for action buttons */
@keyframes highlight-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(99, 102, 241, 0.3);
    transform: scale(1.02);
  }
}

.highlight-action {
  animation: highlight-pulse 0.8s ease-in-out 3;
  position: relative;
}

.highlight-action::after {
  content: '← Click here to digitize!';
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #6366f1;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ===== END AI GENERATOR PANEL STYLES ===== */

/* AI Digitize Button Styles */
.ai-digitize-btn {
  width: 100%;
  padding: 14px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.ai-digitize-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

.ai-digitize-btn i {
  width: 18px !important;
  height: 18px !important;
}

/* AI Preview on Garment Button */
.ai-preview-btn {
  width: 100%;
  padding: 14px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

.ai-preview-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4) !important;
}

.ai-preview-btn i {
  width: 18px !important;
  height: 18px !important;
}

/* AI Digitize Toolbar Button */
.ai-digitize-toolbar {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  border: none !important;
  animation: pulse-green 2s infinite;
}

.ai-digitize-toolbar:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.ai-digitize-toolbar i {
  color: white !important;
}

.ai-digitize-toolbar span {
  color: white !important;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
}

.ai-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.ai-preview-actions #ai-regenerate-btn {
  padding: 10px 16px;
  font-size: 13px;
}

.ai-digitize-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 12px;
  color: #166534;
  line-height: 1.4;
}

.ai-digitize-note i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Library Panel Styles */
.library-panel {
  padding: 15px;
}

.library-header {
  margin-bottom: 20px;
}

.library-header h3 {
  margin: 0 0 8px 0;
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
}

.library-description {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.library-loading {
  text-align: center;
  padding: 40px 20px;
}

.library-loading p {
  margin-top: 15px;
  color: #6b7280;
  font-size: 14px;
}

.library-empty {
  text-align: center;
  padding: 40px 20px;
  background: #f9fafb;
  border-radius: 12px;
  border: 2px dashed #e5e7eb;
}

.library-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.library-empty p {
  margin: 0 0 8px 0;
  color: #374151;
  font-weight: 500;
}

.library-empty .empty-hint {
  color: #6b7280;
  font-size: 13px;
  font-weight: normal;
}

/* Dashboard Panel Styles */
.dashboard-panel-content {
  padding: 24px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.dashboard-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.dashboard-icon svg {
  width: 26px;
  height: 26px;
}

.dashboard-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

.dashboard-info {
  margin-bottom: 24px;
}

.dashboard-description {
  font-size: 14px;
  color: #4b5563;
  margin: 0 0 16px 0;
  line-height: 1.6;
}

.dashboard-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.dashboard-features li:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.dashboard-features li svg {
  width: 20px;
  height: 20px;
  color: #3b82f6;
  flex-shrink: 0;
}

.dashboard-features li span {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.dashboard-open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.dashboard-open-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.dashboard-open-btn svg {
  width: 18px;
  height: 18px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.library-design-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.library-design-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.library-design-card img {
  width: 100%;
  height: 100px;
  object-fit: contain;
  background: #f9fafb;
  padding: 8px;
}

.library-design-card .design-info {
  padding: 10px;
  border-top: 1px solid #f3f4f6;
}

.library-design-card .design-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.library-design-card .design-date {
  font-size: 11px;
  color: #9ca3af;
}

.library-design-card .design-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.library-design-card .design-actions button {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.library-design-card .use-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.library-design-card .use-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.library-design-card .delete-btn {
  background: #fee2e2;
  color: #dc2626;
}

.library-design-card .delete-btn:hover {
  background: #fecaca;
}

.library-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

#library-page-info {
  font-size: 13px;
  color: #6b7280;
}

/* Digitization Size/Position Buttons */
.digitize-size-section,
.digitize-position-section {
  margin-bottom: 20px;
}

.digitize-size-section h4,
.digitize-position-section h4,
.image-upload-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

/* Digitize Size Dropdown */
.digitize-size-dropdown {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background-color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23374151' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 18px;
  padding-right: 44px;
}

.digitize-size-dropdown:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.digitize-size-dropdown:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.digitize-size-buttons {
  display: flex;
  gap: 8px;
}

.digitize-size-btn {
  flex: 1;
  padding: 12px 8px;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 60px;
  justify-content: center;
}

.digitize-size-btn .size-name {
  font-size: 14px;
  font-weight: 700;
}

.digitize-size-btn .size-dim {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
}

.digitize-size-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.15);
}

.digitize-size-btn:hover .size-dim {
  color: #3b82f6;
}

.digitize-size-btn.active {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.digitize-size-btn.active .size-name {
  color: #ffffff;
}

.digitize-size-btn.active .size-dim {
  color: rgba(255, 255, 255, 0.85);
}

.size-note {
  color: #1d4ed8;
}

.size-note {
  margin: 8px 0 0 0;
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
}

/* Digitize Options Section */
.digitize-options-section {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.digitize-options-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.remove-bg-option {
  padding: 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.toggle-hint {
  margin: 8px 0 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

/* Info Boxes for Warnings/Tips */
.digitize-info-boxes,
.ai-info-boxes {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-box {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid;
}

.info-box.info-warning {
  background: #fffbeb;
  border-color: #fcd34d;
}

.info-box.info-tip {
  background: #eff6ff;
  border-color: #93c5fd;
}

.info-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.info-content {
  flex: 1;
}

.info-content strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #374151;
}

.info-content p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

/* Info Popup Modal */
.info-popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.info-popup-overlay {
  display: none;
}

.info-popup-overlay.show,
.info-popup-overlay[style*="block"] {
  display: flex !important;
}

.info-popup-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: popupSlideIn 0.3s ease;
}

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

.info-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.info-popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.info-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.info-popup-close:hover {
  color: #374151;
}

.info-popup-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-popup-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid;
}

.info-popup-item.warning {
  background: #fffbeb;
  border-color: #fcd34d;
}

.info-popup-item.tip {
  background: #eff6ff;
  border-color: #93c5fd;
}

.info-popup-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.info-popup-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}

.info-popup-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #4b5563;
}

.info-popup-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
  justify-content: flex-end;
}

.info-popup-cancel {
  background: #f3f4f6;
  color: #374151;
}

.info-popup-confirm {
  min-width: 180px;
}

.digitize-position-buttons {
  display: flex;
  gap: 8px;
}

.digitize-position-btn {
  flex: 1;
  padding: 10px 8px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s ease;
}

.digitize-position-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.digitize-position-btn.active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}

.upload-hint {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #6b7280;
}

.digitize-notice {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid #bae6fd;
}

.digitize-notice h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #0369a1;
}

.digitize-notice .digitize-description {
  margin: 0;
  font-size: 13px;
  color: #0c4a6e;
  line-height: 1.5;
}

/* ===== AI CREDIT BALANCE STYLES ===== */
.ai-credit-balance {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 16px;
  margin: 0 16px 16px 16px;
}

.ai-credit-balance .credit-balance-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #166534;
  font-weight: 700;
  font-size: 14px;
}

.ai-credit-balance .credit-balance-header i {
  width: 18px;
  height: 18px;
  color: #22c55e;
}

.ai-credit-balance .credit-balance-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-credit-balance .balance-number {
  font-size: 36px;
  font-weight: 800;
  color: #15803d;
  line-height: 1;
}

.ai-credit-balance .balance-label {
  font-size: 13px;
  color: #166534;
  font-weight: 500;
}

.ai-credit-balance .credit-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff80;
  border-radius: 6px;
  margin-bottom: 14px;
}

.ai-credit-balance .credit-info i {
  width: 16px;
  height: 16px;
  color: #22c55e;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-credit-balance .credit-info p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #166534;
}

.ai-credit-balance .topup-btn {
  width: 100%;
  padding: 10px 16px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.ai-credit-balance .topup-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.ai-credit-balance .topup-btn i {
  width: 16px;
  height: 16px;
}

/* No credits state */
.ai-credit-balance.no-credits {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
}

.ai-credit-balance.no-credits .credit-balance-header {
  color: #b91c1c;
}

.ai-credit-balance.no-credits .credit-balance-header i {
  color: #ef4444;
}

.ai-credit-balance.no-credits .balance-number {
  color: #dc2626;
}

.ai-credit-balance.no-credits .balance-label {
  color: #b91c1c;
}

.ai-credit-balance.no-credits .credit-info {
  background: #ffffff80;
}

.ai-credit-balance.no-credits .credit-info i {
  color: #ef4444;
}

.ai-credit-balance.no-credits .credit-info p {
  color: #991b1b;
}

/* Free trial state */
.ai-credit-balance.has-free-trial {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
}

.ai-credit-balance.has-free-trial .credit-balance-header {
  color: #1d4ed8;
}

.ai-credit-balance.has-free-trial .credit-balance-header i {
  color: #3b82f6;
}

.ai-credit-balance.has-free-trial .balance-number {
  color: #2563eb;
}

.ai-credit-balance.has-free-trial .balance-label {
  color: #1d4ed8;
}

.ai-credit-balance.has-free-trial .credit-info i {
  color: #3b82f6;
}

.ai-credit-balance.has-free-trial .credit-info p {
  color: #1e40af;
}

/* ===== TOP UP MODAL STYLES ===== */
.topup-modal-content {
  max-width: 500px;
}

.topup-header {
  text-align: center;
  padding: 20px 20px 0 20px;
}

.topup-header .topup-icon {
  width: 48px;
  height: 48px;
  color: #22c55e;
  margin-bottom: 12px;
}

.topup-header h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
  color: #1f2937;
}

.topup-header .topup-description {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.topup-packages {
  display: flex;
  gap: 12px;
  padding: 20px;
  justify-content: center;
}

.package-option {
  flex: 1;
  max-width: 140px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.package-option:hover {
  border-color: #22c55e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

.package-option.selected {
  border-color: #22c55e;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.package-option .package-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: uppercase;
}

.package-option .package-badge.best-value {
  background: #22c55e;
}

.package-option .package-credits {
  font-size: 32px;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 4px;
}

.package-option .package-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}

.package-option .package-price {
  font-size: 18px;
  font-weight: 700;
  color: #22c55e;
  margin-bottom: 4px;
}

.package-option .package-savings {
  font-size: 11px;
  color: #f59e0b;
  font-weight: 600;
}

.topup-summary {
  background: #f9fafb;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.topup-summary .summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #374151;
  padding: 4px 0;
}

.topup-summary .summary-row.total {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed #d1d5db;
}

.topup-summary .summary-row.total span:last-child {
  color: #22c55e;
}

.topup-actions {
  display: flex;
  gap: 12px;
  padding: 20px;
}

.topup-actions button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.topup-actions #topup-purchase-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  border: none;
}

.topup-actions #topup-purchase-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  transform: translateY(-1px);
}

.topup-actions #topup-purchase-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topup-actions #topup-purchase-btn i {
  width: 18px;
  height: 18px;
}

.topup-actions #topup-cancel-btn {
  background: white;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.topup-actions #topup-cancel-btn:hover {
  background: #f3f4f6;
}

.close-topup-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.2s ease;
}

.close-topup-modal:hover {
  color: #374151;
}

@media (max-width: 480px) {
  .topup-packages {
    flex-direction: column;
    align-items: center;
  }
  
  .package-option {
    max-width: 200px;
    width: 100%;
  }
  
  .topup-actions {
    flex-direction: column;
  }
}

/* ============================================================
   MOBILE RESPONSIVE ENHANCEMENTS
   Added for full mobile/tablet support without changing desktop
   ============================================================ */

/* Slide up animation for mobile panels */
@keyframes mobileSlideUp {
  from { 
    transform: translateY(100%);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes mobileSlideDown {
  from { 
    transform: translateY(0);
    opacity: 1;
  }
  to { 
    transform: translateY(100%);
    opacity: 0;
  }
}

/* ===== TABLET BREAKPOINT (769px - 1024px) ===== */
@media (max-width: 1024px) and (min-width: 769px) {
  /* Reduce sidebar width on tablets */
  .sidebar {
    width: 380px;
  }
  
  .content-sidebar {
    width: 316px;
  }
  
  .main-content {
    margin-left: 380px;
  }
  
  .view-buttons {
    left: 380px;
  }
  
  /* Slightly smaller product cards */
  .product-card img,
  .template-card img {
    height: 160px;
  }
  
  /* Compact toolbar */
  .toolbar-btn span {
    font-size: 10px;
  }
  
  /* Adjust controls container */
  .controls-container {
    min-width: 350px;
    max-width: 500px;
  }
}

/* ===== MOBILE BREAKPOINT (481px - 768px) ===== */
@media (max-width: 768px) {
  /* Hide the desktop logo header */
  .sidebar-header {
    display: none !important;
  }
  
  /* Transform sidebar to bottom navigation */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: column-reverse;
    z-index: 1100;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  }
  
  /* Toolbar becomes horizontal bottom nav */
  .toolbar-sidebar {
    width: 100%;
    height: 64px;
    border-right: none;
    border-top: none;
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Hide vertical margin, make buttons row */
  .toolbar-buttons {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    margin-top: 0;
    padding: 8px 4px;
    gap: 0;
    overflow-x: auto;
  }
  
  /* Toolbar button adjustments */
  .tool-btn {
    padding: 8px 12px;
    min-width: 50px;
    flex-shrink: 0;
  }
  
  .tool-btn span {
    font-size: 9px;
    white-space: nowrap;
  }
  
  .tool-btn i {
    width: 22px;
    height: 22px;
  }
  
  /* Content sidebar becomes slide-up panel */
  .content-sidebar {
    display: none;
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55vh;
    margin-top: 0;
    height: auto;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    background: #ffffff;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  
  /* Show panel when mobile-open class is added */
  .content-sidebar.mobile-open {
    display: block;
    animation: mobileSlideUp 0.3s ease forwards;
  }
  
  /* Add a handle indicator at top of panel */
  .content-sidebar::before {
    content: '';
    position: sticky;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    display: block;
    margin: 12px auto 8px auto;
  }
  
  /* Search container adjustments */
  .search-container {
    padding: 12px 16px;
  }
  
  /* Panel container for mobile */
  .panel-container {
    padding: 12px;
    max-height: calc(55vh - 60px);
    overflow-y: auto;
  }
  
  /* Main content takes full width */
  .main-content {
    margin-left: 0;
    margin-bottom: 64px; /* Space for bottom nav */
    width: 100%;
    height: calc(100vh - 64px);
  }
  
  /* Top toolbar adjustments */
  .toolbar {
    padding: 6px 8px;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow-x: auto;
  }
  
  .toolbar-group {
    gap: 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  
  .toolbar-btn {
    padding: 6px;
    min-width: auto;
  }
  
  .toolbar-btn span {
    display: none; /* Hide text, show only icons */
  }
  
  .toolbar-btn i {
    width: 18px;
    height: 18px;
  }

  /* Canvas area adjustments */
  .canvas-area {
    padding: 8px;
    padding-bottom: 16px;
  }
  
  /* View buttons - horizontal at top of canvas */
  .view-buttons {
    position: relative;
    left: 0;
    top: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: transparent;
    margin-bottom: 8px;
  }
  
  .view-btn {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 20px;
  }
  
  /* Size buttons - horizontal */
  .size-buttons {
    justify-content: center;
    margin-bottom: 8px;
    gap: 6px;
  }
  
  .size-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  /* T-shirt preview full width */
  .t-shirt-preview {
    border-radius: 12px;
  }
  
  /* Controls container - floating at bottom */
  .controls-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: none;
    min-width: auto;
    padding: 10px;
    border-radius: 16px;
    z-index: 200;
  }
  
  /* Garment colors horizontal scroll */
  .garment-color-section {
    margin-bottom: 8px;
  }
  
  .garment-color-section h4 {
    font-size: 11px;
    margin-bottom: 6px;
  }
  
  .garment-color-options {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .garment-color-options::-webkit-scrollbar {
    display: none;
  }
  
  .garment-color-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
  }
  
  /* Zoom controls compact */
  .controls-container .zoom-controls {
    padding: 4px 8px;
    gap: 8px;
  }
  
  .zoom-slider {
    width: 100px;
  }
  
  .zoom-level {
    font-size: 12px;
    min-width: 45px;
  }
  
  /* Product/template grids - 2 columns */
  .products-grid,
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .product-card,
  .template-card {
    padding: 8px;
  }
  
  .product-card img,
  .template-card img {
    height: 120px;
  }
  
  .product-name,
  .template-name {
    font-size: 12px;
    margin-top: 8px;
  }
  
  /* Text panel adjustments */
  .text-tools-section {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .text-tools-section h3 {
    font-size: 13px;
    margin-bottom: 10px;
  }
  
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-group label {
    font-size: 11px;
  }
  
  .form-group input,
  .form-group select {
    padding: 10px;
    font-size: 14px; /* Larger for touch */
  }
  
  #add-text-btn {
    padding: 14px 20px;
    font-size: 15px;
  }
  
  /* Image panel adjustments */
  .digitize-info-section {
    padding: 12px;
    margin-bottom: 16px;
  }
  
  .digitize-size-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .digitize-size-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .image-upload-section {
    padding: 16px;
  }
  
  /* Filter container adjustments */
  .filter-container {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .filter-container select {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* Modals - full screen on mobile */
  .csd-modal-content,
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    margin: 10px auto !important;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
  }
  
  .share-modal,
  .share-link-modal,
  .manage-links-modal {
    width: 95% !important;
    max-width: none !important;
  }
  
  /* Final preview modal adjustments */
  .final-preview-body {
    flex-direction: column;
    padding: 12px;
  }
  
  .preview-left,
  .preview-right {
    margin: 8px 0;
  }
  
  .download-buttons {
    flex-direction: column;
    gap: 8px;
  }
  
  .download-btn {
    padding: 14px 16px;
    font-size: 14px;
  }
  
  /* AI Panel mobile adjustments */
  .ai-header {
    padding: 14px;
  }
  
  .ai-pricing-info {
    margin: 12px;
    padding: 12px;
  }
  
  .ai-form {
    padding: 0 12px;
  }
  
  .ai-tips {
    margin: 12px;
  }
  
  .ai-generate-btn {
    width: calc(100% - 24px);
    margin: 12px;
  }
  
  /* Library panel adjustments */
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  /* Hide mobile price section on desktop-style modals */
  .mobile-price-section {
    display: block;
  }
  
  .sidebar-footer {
    display: none;
  }
  
  /* Profile dropdown adjustments */
  .profile-dropdown-content {
    right: 0;
    left: auto;
    min-width: 120px;
  }
}

/* ===== SMALL PHONE BREAKPOINT (≤480px) ===== */
@media (max-width: 480px) {
  /* Even more compact toolbar */
  .toolbar-sidebar {
    height: 56px;
  }
  
  .toolbar-buttons {
    padding: 4px 2px;
  }
  
  .tool-btn {
    padding: 6px 8px;
    min-width: 44px;
  }
  
  .tool-btn span {
    display: none !important;
  }
  
  .tool-btn i {
    width: 20px;
    height: 20px;
  }
  
  /* Main content margin adjustment */
  .main-content {
    margin-bottom: 56px;
    height: calc(100vh - 56px);
  }
  
  /* Content sidebar even more compact */
  .content-sidebar {
    bottom: 56px;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
  }
  
  /* Smaller toolbar buttons */
  .toolbar-btn {
    padding: 4px;
  }
  
  .toolbar-btn i {
    width: 16px;
    height: 16px;
  }
  
  /* View buttons smaller */
  .view-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  /* Size buttons smaller */
  .size-btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  
  /* Controls container */
  .controls-container {
    bottom: 72px;
    padding: 8px;
    border-radius: 12px;
  }
  
  .garment-color-btn {
    width: 24px;
    height: 24px;
  }
  
  .zoom-slider {
    width: 80px;
  }
  
  .zoom-level {
    font-size: 11px;
    min-width: 40px;
  }
  
  .zoom-btn {
    padding: 4px;
  }
  
  .zoom-btn i {
    width: 16px;
    height: 16px;
  }
  
  /* Product grids - single column on very small screens */
  .products-grid,
  .templates-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .product-card img,
  .template-card img {
    height: 140px;
  }
  
  /* Form elements larger touch targets */
  .form-group input,
  .form-group select {
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  #add-text-btn {
    padding: 16px;
    font-size: 16px;
  }
  
  /* Modals take more width */
  .csd-modal-content,
  .modal-content {
    width: 98% !important;
    margin: 5px auto !important;
    padding: 12px !important;
  }
  
  .csd-modal-content h2,
  .modal-content h2 {
    font-size: 18px;
  }
  
  /* AI panel compact */
  .ai-header-content h2 {
    font-size: 15px;
  }
  
  .ai-description {
    font-size: 11px;
  }
  
  .ai-form textarea {
    min-height: 70px;
    font-size: 14px;
  }
  
  .example-tag {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  /* Final preview adjustments */
  .final-preview-header h2 {
    font-size: 18px;
  }
  
  .info-row {
    font-size: 12px;
  }
  
  /* Share link container */
  .link-copy-container {
    flex-direction: column;
    gap: 8px;
  }
  
  #share-link-input {
    width: 100%;
  }
  
  .copy-btn {
    width: 100%;
  }
  
  /* Art grid */
  .art-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* ===== TOUCH DEVICE ENHANCEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .tool-btn,
  .toolbar-btn,
  .view-btn,
  .size-btn,
  .zoom-btn,
  .color-btn,
  .garment-color-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects that don't work well on touch */
  .product-card:hover,
  .template-card:hover {
    transform: none;
  }
  
  /* Active states instead */
  .product-card:active,
  .template-card:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
  
  /* Larger scrollbars for touch */
  .garment-color-options {
    scrollbar-width: thin;
  }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  /* Sidebar adjustments for landscape */
  .content-sidebar {
    max-height: 45vh;
  }
  
  .controls-container {
    bottom: 70px;
  }
  
  /* Reduce canvas padding */
  .canvas-area {
    padding: 4px;
  }
  
  .t-shirt-preview {
    max-height: calc(100vh - 150px);
  }
}

/* ===== SAFE AREA INSETS (for notched phones) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .sidebar {
      padding-bottom: env(safe-area-inset-bottom);
    }
    
    .toolbar-sidebar {
      padding-bottom: env(safe-area-inset-bottom);
    }
    
    .controls-container {
      bottom: calc(80px + env(safe-area-inset-bottom));
    }
  }
}

/* ===== ENHANCED MOBILE RESPONSIVENESS (≤768px) ===== */
@media (max-width: 768px) {
  
  /* --- GLOBAL: Prevent horizontal scrollbar --- */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  .main-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  /* --- TOOLBAR BUTTONS FIX: Prevent horizontal overflow --- */
  .toolbar-sidebar {
    overflow-x: hidden !important;
    max-width: 100vw;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: stretch !important;
  }
  
  .toolbar-buttons {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    overflow-x: hidden;
    overflow-y: hidden;
    max-width: 100vw;
    width: 100% !important;
    flex-wrap: nowrap !important;
    padding: 6px 4px !important;
    gap: 0 !important;
    margin: 0 !important;
  }
  
  .toolbar-buttons::-webkit-scrollbar {
    display: none;
  }
  
  .tool-btn {
    flex: 1 1 0 !important;
    padding: 6px 2px !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  .tool-btn i,
  .tool-btn svg {
    width: 20px !important;
    height: 20px !important;
  }
  
  .tool-btn span {
    display: none !important;
  }
  
  /* --- VIEW BUTTONS: Hide on mobile (position buttons handle this) --- */
  .view-buttons {
    display: none !important;
  }
  
  .view-btn {
    padding: 6px 12px !important;
    font-size: 11px !important;
    min-width: auto !important;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
  }
  
  .view-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
  }
  
  /* --- POSITION BUTTONS: Compact for mobile --- */
  .position-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    justify-content: center !important;
    padding: 4px !important;
    max-width: 100% !important;
  }
  
  .position-btn {
    padding: 5px 10px !important;
    font-size: 10px !important;
    border-radius: 4px !important;
    min-width: auto !important;
    white-space: nowrap !important;
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
  }
  
  .position-btn.active {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
  }
  
  /* --- SIZE BUTTONS: Match position buttons exactly --- */
  .size-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    justify-content: center !important;
    margin-bottom: 6px !important;
    max-width: 100% !important;
  }
  
  .size-btn,
  .size-buttons .size-btn,
  .size-buttons button.size-btn,
  button.size-btn[data-size] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 5px 10px !important;
    font-size: 10px !important;
    border-radius: 4px !important;
    min-width: auto !important;
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
    white-space: nowrap !important;
  }
  
  .size-btn.active,
  .size-buttons .size-btn.active,
  .size-buttons button.size-btn.active,
  button.size-btn[data-size].active {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
  }
  
  .size-btn.disabled,
  .size-buttons .size-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
  
  /* --- CANVAS AREA: Improve visibility --- */
  .canvas-area {
    padding: 8px;
    overflow: hidden;
    width: 100%;
  }
  
  .preview-container {
    padding: 4px;
    width: 100%;
    flex-direction: column;
  }
  
  .preview-content {
    padding: 4px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  .t-shirt-preview {
    max-height: calc(100vh - 280px);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  
  .canvas-container {
    max-width: 100% !important;
    transform-origin: top center;
    overflow: hidden !important;
  }
  
  .canvas-container .upper-canvas,
  .canvas-container .lower-canvas {
    max-width: 100% !important;
  }
  
  #tshirt-canvas {
    max-width: 100%;
    max-height: 100%;
  }
  
  /* --- CONTROLS CONTAINER: Compact layout --- */
  .controls-container {
    position: fixed !important;
    bottom: 60px;
    left: 8px !important;
    right: 8px !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    transform: none !important;
    min-width: unset !important;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    box-sizing: border-box;
    z-index: 100;
  }
  
  /* --- GARMENT COLORS: Smaller, more compact --- */
  .garment-color-section {
    margin-bottom: 2px;
    width: 100%;
  }
  
  .garment-color-section h4,
  .color-section-title {
    font-size: 9px;
    margin-bottom: 2px;
    text-align: center;
  }
  
  .garment-color-options {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 2px 0;
    justify-content: center;
    scrollbar-width: none;
  }
  
  .garment-color-options::-webkit-scrollbar {
    display: none;
  }
  
  .garment-color-btn {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    flex-shrink: 0;
    border-radius: 50% !important;
    border: 2px solid #e5e7eb;
    padding: 0 !important;
  }
  
  .garment-color-btn.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  }
  
  /* --- ZOOM CONTROLS: Compact --- */
  .controls-container .zoom-controls {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 4px 8px !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .controls-container .zoom-slider,
  #zoom-slider {
    width: 100px !important;
    min-width: 80px !important;
    max-width: 120px !important;
    flex: 1 1 auto !important;
    height: 4px !important;
  }
  
  .controls-container .zoom-btn,
  #zoom-out-btn,
  #zoom-in-btn {
    padding: 4px !important;
    min-width: 24px !important;
    min-height: 24px !important;
  }
  
  .zoom-btn i,
  .zoom-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
  
  .controls-container .zoom-level,
  .zoom-controls .zoom-level {
    font-size: 10px !important;
    min-width: 35px !important;
    font-weight: 500;
  }
  
  /* --- GARMENT COLOR BUTTONS: Smaller size --- */
  .controls-container .garment-color-btn,
  #garment-color-options .garment-color-btn,
  .garment-color-options button.garment-color-btn {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
    border: 2px solid #e5e7eb !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* --- RESET BUTTON: Mobile size --- */
  .reset-button {
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 8px;
  }
  
  .reset-button svg,
  .reset-button i {
    width: 18px !important;
    height: 18px !important;
  }
  
  /* --- MOBILE TOOLBAR TOGGLE BUTTON --- */
  .mobile-toolbar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
  }
  
  .mobile-toolbar-toggle:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  }
  
  .mobile-toolbar-toggle .toggle-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
  }
  
  .mobile-toolbar-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
  }
  
  /* --- MOBILE TOOLBAR DRAWER --- */
  .toolbar-drawer {
    display: none !important;
    width: 100%;
    max-width: 100vw;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    box-sizing: border-box;
    animation: slideDown 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .toolbar-drawer.open {
    display: block !important;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* --- MAIN TOOLBAR (TOP): Drawer layout on mobile --- */
  .toolbar {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  .toolbar-group {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    width: 100%;
    max-width: 100%;
    padding: 0;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  .toolbar-group::-webkit-scrollbar {
    display: none;
  }
  
  .toolbar-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 8px !important;
    min-width: unset !important;
    width: 100% !important;
    font-size: 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    gap: 4px;
    transition: all 0.2s ease;
  }
  
  .toolbar-btn:hover {
    background: #e0f2fe;
    border-color: #3b82f6;
  }
  
  .toolbar-btn svg,
  .toolbar-btn i {
    width: 22px !important;
    height: 22px !important;
    color: #3b82f6;
    margin-bottom: 0;
  }
  
  .toolbar .toolbar-group .toolbar-btn span,
  .toolbar-btn span {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    line-height: 1.2;
    color: #374151;
    font-weight: 500;
  }
  
  /* Hide auto-save indicator on mobile drawer */
  .toolbar-btn .auto-save-indicator,
  .toolbar-group > .toolbar-btn:last-child {
    display: none !important;
  }
  
  /* --- TOOLBAR ZOOM CONTROLS: Visible next to toggle --- */
  .toolbar > .zoom-controls {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    order: 1; /* Place after toggle */
  }
  
  /* --- RESET AND PROFILE BUTTONS --- */
  .reset-button {
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
  }
  
  .reset-button svg,
  .reset-button i {
    width: 16px !important;
    height: 16px !important;
  }
  
  .profile-button {
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
  }
  
  .profile-button svg,
  .profile-button i {
    width: 16px !important;
    height: 16px;
  }
  
  /* --- CONTENT SIDEBAR PANELS: Better mobile layout --- */
  .content-sidebar {
    max-height: 50vh;
  }
  
  .panel-container {
    padding: 8px;
  }
  
  .panel {
    padding: 8px;
  }
  
  /* --- SEARCH CONTAINER --- */
  .search-container {
    padding: 8px;
  }
  
  .search-input {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* --- FILTER CONTAINERS --- */
  .filter-container {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .filter-container label {
    font-size: 12px;
  }
  
  .filter-container select {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }
  
  /* --- TEXT PANEL: Compact form --- */
  .text-tools-section {
    padding: 8px;
  }
  
  .text-tools-section h3 {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .text-customization .form-group {
    margin-bottom: 10px;
  }
  
  .text-customization label {
    font-size: 12px;
  }
  
  .text-customization input,
  .text-customization select {
    padding: 10px;
    font-size: 14px;
  }
  
  #add-text-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
  
  /* --- AI PANEL: Mobile optimized --- */
  .ai-generator-section {
    padding: 8px;
  }
  
  .ai-header {
    padding: 10px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .ai-header-content h2 {
    font-size: 16px;
  }
  
  .ai-description {
    font-size: 12px;
  }
  
  .ai-form textarea {
    min-height: 80px;
    font-size: 14px;
  }
  
  .example-tags {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .example-tag {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .ai-tips {
    padding: 10px;
  }
  
  .tips-list li {
    font-size: 11px;
  }
  
  .ai-generate-btn {
    width: 100%;
    padding: 14px;
    font-size: 14px;
  }
  
  /* --- IMAGE PANEL: Mobile optimized --- */
  .digitize-info-section {
    padding: 12px;
  }
  
  .digitize-notice h3 {
    font-size: 14px;
  }
  
  .digitize-description {
    font-size: 12px;
  }
  
  .digitize-size-section h4,
  .digitize-options-section h4,
  .image-upload-section h4 {
    font-size: 13px;
  }
  
  .digitize-size-dropdown {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }
  
  #upload-image-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
  
  /* --- LIBRARY PANEL: Mobile grid --- */
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .library-header h3 {
    font-size: 16px;
  }
  
  .library-description {
    font-size: 12px;
  }
  
  /* --- DASHBOARD PANEL: Mobile layout --- */
  .dashboard-panel-content {
    padding: 12px;
  }
  
  .dashboard-header h3 {
    font-size: 16px;
  }
  
  .dashboard-features li {
    font-size: 12px;
    padding: 8px 0;
  }
  
  .dashboard-open-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
  
  /* --- MODALS: Full width on mobile --- */
  .modal-content,
  .csd-modal-content {
    width: 95% !important;
    max-width: 95vw !important;
    margin: 10px auto !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* --- PRODUCTS/TEMPLATES GRID: 2 columns on mobile --- */
  .products-grid,
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .product-card,
  .template-card {
    padding: 8px;
  }
  
  .product-card img,
  .template-card img {
    height: 100px;
  }
  
  .product-name,
  .template-name {
    font-size: 11px;
  }

  /* --- TEXT POSITIONING SECTION --- */
  .text-positioning-section {
    padding: 8px;
    margin-bottom: 8px;
  }
  
  .text-positioning-section h3 {
    font-size: 13px;
  }
  
  .position-indicator {
    padding: 8px;
  }
  
  .status-text,
  .alignment-text {
    font-size: 12px;
  }
  
  .position-help-text small {
    font-size: 10px;
  }
  
  /* --- TOGGLE SWITCH: Larger for touch --- */
  .toggle-switch {
    min-width: 44px;
    min-height: 24px;
  }
  
  /* --- INFO BOXES: Mobile optimized --- */
  .info-box {
    padding: 10px;
  }
  
  .info-box .info-content strong {
    font-size: 12px;
  }
  
  .info-box .info-content p {
    font-size: 11px;
  }
  
  /* --- AI CREDIT BALANCE: Mobile layout --- */
  .ai-credit-balance {
    padding: 12px;
  }
  
  .credit-balance-display .balance-number {
    font-size: 24px;
  }
  
  .credit-balance-display .balance-label {
    font-size: 12px;
  }
  
  .topup-btn {
    width: 100%;
    padding: 10px;
  }
  
  /* --- MAIN CONTENT: Remove sidebar margin --- */
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  /* --- CONTAINER: Prevent horizontal overflow --- */
  .container {
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  body {
    overflow-x: hidden;
  }
}

/* ===== EXTRA SMALL PHONE FIXES (≤480px) ===== */
@media (max-width: 480px) {
  
  /* Even smaller toolbar buttons */
  .tool-btn {
    padding: 4px 6px;
    min-width: 38px;
    max-width: 44px;
  }
  
  .tool-btn i {
    width: 18px;
    height: 18px;
  }
  
  .tool-btn span {
    display: none !important;
  }
  
  /* View buttons even more compact */
  .view-btn {
    padding: 5px 8px !important;
    font-size: 10px !important;
  }
  
  /* Position and size buttons smaller */
  .position-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
  
  .size-btn {
    padding: 3px 8px;
    font-size: 9px;
  }
  
  /* Garment colors even smaller */
  .garment-color-btn {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px;
  }
  
  /* Canvas takes more space */
  .t-shirt-preview {
    max-height: calc(100vh - 250px);
  }
  
  /* Main content more space */
  .main-content {
    margin-bottom: 56px;
    height: calc(100vh - 56px);
  }
  
  /* Products/templates grid: 2 columns smaller */
  .product-card img,
  .template-card img {
    height: 80px;
  }
  
  /* Panels more compact */
  .panel {
    padding: 6px;
  }
  
  .text-tools-section {
    padding: 6px;
  }
  
  /* Form elements */
  .form-group {
    margin-bottom: 8px;
  }
  
  .form-group label {
    font-size: 11px;
    margin-bottom: 4px;
  }
  
  .form-group input,
  .form-group select {
    padding: 8px;
    font-size: 14px;
  }
  
  /* Toolbar completely icon-only */
  .toolbar-btn span {
    display: none !important;
  }
  
  .toolbar-btn {
    padding: 4px 6px;
  }
  
  .toolbar-btn i {
    width: 16px;
    height: 16px;
  }
  
  /* Controls container more compact */
  .controls-container {
    padding: 6px;
    gap: 6px;
  }
  
  .zoom-slider {
    width: 60px;
  }
  
  .zoom-level {
    font-size: 9px;
    min-width: 30px;
  }
}
