/* TGS Product Customizer - Frontend Styles */

/* Reset and Main Container */
.tgs-customizer-container {
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    position: relative;
    box-sizing: border-box;
}

/* Main wrapper */
.tgs-customizer-main {
    position: relative;
    width: 100%;
    background: none;
    min-height: 800px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transform: scale(1.1);
    transform-origin: center top;
    overflow: visible;
    padding-bottom: 8%;
}

/* Image Container */
.tgs-image-container {
    position: relative;
    height: auto;
    width: 771px;
    overflow: visible;
    margin-left: calc(50% - 550px);
    box-sizing: border-box;
    zoom: 1.1;

}

.tgs-image-container:hover {
    cursor: zoom-in;
}

.tgs-zoom-wrapper {
    position: relative;
    transition: transform 0.3s ease-in-out;
}

.tgs-zoom-wrapper.zoomed {
    transform: scale(2.7);
    z-index: 10;
}

/* Shirt Container */
.tgs-shirt-container {
    position: relative;
    text-align: center;
    width: 100%;
    margin: auto;
    box-sizing: border-box;
}

.tgs-shirt-image {
    width: 771px;
    height: auto;
    display: block;
}

/* Pocket Container */
.tgs-pocket-container {
    width: 180px;
    min-height: 110px;
    position: absolute;
    top: 69%;
    left: 60%;
    transform: translate(-50%, -50%) scale(0.9);
    pointer-events: none;
    box-sizing: border-box;
}

.tgs-pocket-image {
    width: 90px;  /* Changed from 80px */
    padding: 0;
    height: auto;
    opacity: 1;
    margin-left: 20px;  /* Changed from padding-left: 30px */
    transition: opacity 0.3s ease;
}

/* Hide pocket image when in upload mode but no file uploaded */
.tgs-customizer-container.upload-mode .tgs-pocket-image:not(.tgs-custom-image) {
    opacity: 0;
    visibility: hidden;
}

/* Custom uploaded image styling*/
.tgs-pocket-image.tgs-custom-image {
    filter: none;
    /* Constrain to proper pocket size */
    width: 110px !important;
    height: auto !important;
    max-width: 110px !important;
    max-height: 110px !important;
    padding: 0;
    margin-left: 9px;  /* Changed from 20px to center visually */
    margin-top: -12px;  /* Added to center vertically */
    
    /* Use smooth rendering for better quality */
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

/* Loading state for pocket image */
.tgs-pocket-image.tgs-loading {
    opacity: 0.5;
    position: relative;
}

.tgs-pocket-image.tgs-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #D4AF37;
    border-radius: 50%;
    animation: tgs-spin 1s linear infinite;
}

/* Hidden Canvas Styling */
#tgs-image-canvas {
    position: absolute;
    top: -9999px;
    left: -9999px;
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
    
    /* Ensure canvas maintains quality during rendering */
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

/* Canvas-rendered images should have smooth scaling */
.tgs-pocket-image[src^="data:image/png"] {
    image-rendering: auto;
    -ms-interpolation-mode: bicubic;
}

/* SVG Clipping Paths Container*/
.tgs-svg-clip-paths {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 0;
    height: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

/* Processing state for clipped images */
.tgs-pocket-image.tgs-processing {
    opacity: 0.7;
    position: relative;
}

.tgs-pocket-image.tgs-processing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-top: 3px solid #D4AF37;
    border-radius: 50%;
    animation: tgs-spin 0.8s linear infinite;
}

.tgs-controls-container {
    position: absolute;
    top: 20%;
    right: 15%;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 350px;
    background: rgba(255, 255, 255);
    border-radius: 5px;
    padding: 15px;
    box-sizing: border-box;
    z-index: 100;
}

.tgs-control-section {
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

/* Mode Toggle Section */
.tgs-control-section.tgs-mode-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Mode Toggle Container */
.tgs-mode-toggle {
    display: flex;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* Mode Toggle Options - Styled to match size boxes */
.tgs-mode-option {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #D4AF37;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #B3902F;
    box-sizing: border-box;
}

.tgs-mode-option:hover {
    background: #F5E1A4;
}

.tgs-mode-option.selected {
    background: #D4AF37;
    font-weight: bold;
    color: #FAFAFA;
}

/* Hide designs-only sections when in upload mode */
.tgs-customizer-container.upload-mode .tgs-designs-only {
    display: none;
}

/* Smooth transitions for mode switching */
.tgs-designs-only {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tgs-customizer-container.upload-mode .tgs-designs-only {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Hide all labels */
.tgs-control-title,
.tgs-size-label,
.tgs-categories-label {
    display: none;
}

/* Upload Interface Section */
.tgs-control-section.tgs-upload-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Upload Area */
.tgs-upload-area {
    width: 100%;
    min-height: 120px;
    border: 2px dashed #D4AF37;
    border-radius: 8px;
    background: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

.tgs-upload-area:hover {
    background: #F5E1A4;
    border-color: #B3902F;
}

.tgs-upload-area.drag-over {
    background: #D4AF37;
    border-color: #B3902F;
    transform: scale(1.02);
}

/* Upload Instructions */
.tgs-upload-instructions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tgs-upload-icon {
    font-size: 32px;
    opacity: 0.6;
}

.tgs-upload-instructions h4 {
    margin: 0;
    font-size: 18px;
    color: #001A33;
    font-weight: 600;
}

.tgs-upload-instructions p {
    margin: 0;
    font-size: 14px;
    color: #333333;
    line-height: 1.4;
}

.tgs-upload-requirements {
    margin-top: 5px;
}

.tgs-upload-requirements small {
    color: #888;
    font-size: 12px;
}

/* Show upload-only sections when in upload mode */
.tgs-customizer-container.upload-mode .tgs-upload-only {
    display: block !important;
}

/* Upload Progress Styles */
.tgs-upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tgs-upload-progress .tgs-upload-icon {
    font-size: 32px;
    opacity: 0.8;
    animation: pulse 1.5s infinite;
}

.tgs-upload-progress h4 {
    margin: 0;
    font-size: 18px;
    color: #001A33;
    font-weight: 600;
}

.tgs-progress-bar {
    width: 200px;
    height: 8px;
    background: #CCCCCC;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.tgs-progress-fill {
    height: 100%;
    background: #D4AF37;
    border-radius: 4px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.tgs-progress-text {
    margin: 0;
    font-size: 14px;
    color: #333333;
    font-weight: 500;
}

.tgs-upload-area.uploading {
    pointer-events: none;
    background: #F1F1F1;
    border-color: #003388;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

/* File Info Display */
.tgs-file-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tgs-file-icon {
    font-size: 32px;
    opacity: 0.8;
}

/* Style checkmark with gold color */
.tgs-file-icon .tgs-checkmark {
    background: #D4AF37;
    color: #FAFAFA;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

/* Remove emoji filter - not needed anymore */
.tgs-file-icon img.emoji {
    display: none;
}

.tgs-file-details h4 {
    margin: 0;
    font-size: 18px;
    color: #001A33;
    font-weight: 600;
}

.tgs-file-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #333333;
}

.tgs-change-file-btn {
    background: #D4AF37;
    color: #FAFAFA;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    transition: background 0.2s ease;
    font-weight: 500;
}

.tgs-change-file-btn:hover {
    background: #B3902F;
}

/* Upload Messages */
.tgs-upload-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
}

.tgs-upload-message.tgs-upload-success {
    background-color: #F5E1A4;
    color: #001A33;
    border: 1px solid #D4AF37;
}

.tgs-upload-message.tgs-upload-error {
    background-color: #ffebee;
    color: #721c24;
    border: 1px solid #f44336;
}

/* Size Section */
.tgs-control-section.tgs-size-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Size Grid for boxes */
.tgs-size-grid {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.tgs-size-option {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #D4AF37;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tgs-size-option:hover {
    background: #F5E1A4;
}

.tgs-size-option.selected {
    background: #D4AF37;
    font-weight: bold;
    color: #FAFAFA;
}

/* Hide size dropdown */
.tgs-size-dropdown {
    display: none;
}

/* Color Section */
.tgs-control-section.tgs-color-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Color Grid */
.tgs-color-grid {
    display: flex;
    flex-direction: row;
    gap: 5px;
    width: 100%;
    overflow-x: auto;
    border: 1px solid #CCCCCC;
    padding: 8px;
    border-radius: 5px;
    min-height: 36px;
    scroll-snap-type: x mandatory;
    box-sizing: border-box;
    margin: 0;
}

.tgs-color-grid::-webkit-scrollbar {
    height: 8px;
}

.tgs-color-grid::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

.tgs-color-grid::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

.tgs-color-option {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 2px;
    box-sizing: border-box;
}

.tgs-color-option.selected {
    border-color: #D4AF37;
}

.tgs-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #CCCCCC;
    box-sizing: border-box;
}

.tgs-color-name {
    display: none;
}

/* Category Section */
.tgs-control-section.tgs-category-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.tgs-category-row {
    width: 100%;
    box-sizing: border-box;
}

.tgs-category-dropdown {
    width: 100%;
    background: #fff;
    padding: 10px;
    border: 2px solid #D4AF37;
    border-radius: 5px;
    color: #001A33;
    font-size: 18px;
    height: 44px;
    text-align: center;
    text-align-last: center;
    -moz-text-align-last: center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6"><path d="M0,0l6,6l6,-6z" fill="%23333333"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    box-sizing: border-box;
    margin: 0;
}

.tgs-category-dropdown option {
    text-align: center;
    font-size: 16px;
}

/* Pocket Design Section */
.tgs-control-section.tgs-pocket-section {
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Pocket Grid */
.tgs-pocket-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #CCCCCC;
    border-radius: 5px;
    box-sizing: border-box;
    margin: 0;
}

.tgs-pocket-grid::-webkit-scrollbar {
    width: 8px;
}

.tgs-pocket-grid::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

.tgs-pocket-grid::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

.tgs-pocket-grid::-webkit-scrollbar-track {
    background-color: #F1F1F1;
    border-radius: 4px;
}

.tgs-pocket-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 2px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tgs-pocket-option:hover .tgs-pocket-thumbnail {
    border: solid 2px #D4AF37;
    border-radius: 5px;
}

.tgs-pocket-option.selected .tgs-pocket-thumbnail {
    background-color: #F5E1A4;
    border: solid 2px #D4AF37;
    border-radius: 5px;
}

.tgs-pocket-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 3px;
    transition: all 0.2s ease;
    border: 1px solid #CCCCCC;
    box-sizing: border-box;
}

.tgs-pocket-name {
    display: none;
}

/* Add to Cart Button */
.tgs-control-section.tgs-cart-section {
    width: 100%;
    text-align: center;
    margin-top: 10px;
    box-sizing: border-box;
}

.tgs-add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: #D4AF37;
    color: #FAFAFA;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tgs-add-to-cart-btn:hover {
    background: #B3902F;
}

/* Hide selection summary */
.tgs-selection-summary {
    display: none;
}

/* No pockets message styling */
.tgs-no-pockets {
    grid-column: 1 / -1;
    text-align: center;
    color: #333333;
    font-style: italic;
    padding: 20px;
    box-sizing: border-box;
}

/* Loading states */
.tgs-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.tgs-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #F1F1F1;
    border-top: 2px solid #D4AF37;
    border-radius: 50%;
    animation: tgs-spin 1s linear infinite;
}

@keyframes tgs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message Styling */
.tgs-message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
}

.tgs-message.tgs-success {
    background-color: #F5E1A4;
    color: #001A33;
    border: 1px solid #D4AF37;
}

.tgs-message.tgs-error {
    background-color: #ffebee;
    color: #721c24;
    border: 1px solid #f44336;
}

.tgs-message.tgs-info {
    background-color: #F1F1F1;
    color: #001A33;
    border: 1px solid #003388;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pocket border outline */
.tgs-customizer-container.upload-mode .tgs-pocket-container::before {
    content: '';
    position: absolute;
    top: -12px;  /* Changed from 0 to match custom image */
    left: 9px;   /* Changed from 20px to match custom image */
    width: 110px;  /* Desktop default */
    height: 110px;  /* Desktop default */
    pointer-events: none;
    z-index: 10;
    box-sizing: border-box;
    
    /* Use SVG background to create the hexagonal dashed border */
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110' viewBox='0 0 110 110'%3E%3Cpath d='M 15.125 13.75 L 94.875 13.75 L 94.875 76.0 L 55 103.125 L 15.125 76.0 Z' fill='none' stroke='%23D4AF37' stroke-width='2' stroke-dasharray='4,4' opacity='0.6'/%3E%3C/svg%3E");

}

/* Hide border when custom image is present - ensure this still works on mobile */
.tgs-pocket-container.hide-border::before {
    display: none !important;
}

/* Edit Position Mode Styling */

.tgs-edit-btn {
    background: #D4AF37;
    color: #FAFAFA;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    transition: background 0.2s ease;
    font-weight: 500;
}

.tgs-edit-btn:hover {
    background: #B3902F;
}

.tgs-edit-confirm-controls {
   display: flex;
   flex-direction: column;
   gap: 10px;
   margin-top: 10px;
}

.tgs-confirm-btn {
   background: #D4AF37;
   color: #FAFAFA;
   border: none;
   padding: 8px 16px;
   border-radius: 4px;
   cursor: pointer;
   font-size: 14px;
   font-weight: 500;
   transition: background-color 0.3s ease;
   flex: 1;
}

.tgs-confirm-btn:hover {
   background: #B3902F;
}

.tgs-cancel-btn {
   background: #333333;
   color: white;
   border: none;
   padding: 8px 16px;
   border-radius: 4px;
   cursor: pointer;
   font-size: 14px;
   font-weight: 500;
   transition: background-color 0.3s ease;
   flex: 1;
}

.tgs-cancel-btn:hover {
   background: #001A33;
}

/* Control columns side by side */
.tgs-control-columns {
    display: flex !important;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 15px;
    width: 100%;
    flex-direction: row !important;
}

.tgs-control-column {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.tgs-control-column h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #001A33;
}

.tgs-position-controls {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 2px;
}

.tgs-move-row {
   display: flex;
   gap: 5px;
}

.tgs-move-btn {
   width: 35px;
   height: 35px;
   background: white;
   color: #D4AF37;
   border: 2px solid #D4AF37;
   border-radius: 4px;
   cursor: pointer;
   font-size: 14px;
   font-weight: 500;
   display: flex;
   align-items: center;
   justify-content: center;
   transition: all 0.3s ease;
}

.tgs-move-btn:hover {
   background: #D4AF37;
   color: #001A33;
}

.tgs-transform-controls {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 5px;
}

.tgs-transform-btn {
   width: 35px;
   height: 35px;
   background: white;
   color: #CCCCCC;
   border: 2px solid #CCCCCC;
   border-radius: 4px;
   cursor: not-allowed;
   font-size: 14px;
   font-weight: 500;
   display: flex;
   align-items: center;
   justify-content: center;
   opacity: 0.5;
}

/* Draggable cursor for edit mode */
.tgs-draggable {
   cursor: move !important;
   cursor: grab !important;
}

.tgs-draggable:active {
   cursor: grabbing !important;
}

/* Show pocket border during edit mode */
.tgs-customizer-container.upload-mode .tgs-pocket-border {
   display: none; /* Hidden by default in upload mode */
}

/* Force show border during edit mode */
.tgs-pocket-border {
   transition: opacity 0.3s ease;
}

.tgs-pocket-border:not(:visible) {
   opacity: 0;
}

.tgs-pocket-border:visible {
   opacity: 1;
}

/* Enhanced drag cursor and visual feedback for edit mode */
.tgs-customizer-container.edit-position-mode .tgs-pocket-image.tgs-draggable {
    cursor: grab !important;
    position: relative;
}

.tgs-customizer-container.edit-position-mode .tgs-pocket-image.tgs-draggable:hover {
    cursor: grab !important;
    
    transition: transform 0.2s ease;
}

.tgs-customizer-container.edit-position-mode .tgs-pocket-image.tgs-draggable:active {
    cursor: grabbing !important;
    
}

/* Prevent dragging the shirt image during edit mode */
.tgs-customizer-container.edit-position-mode .tgs-shirt-image {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    
}

/* Make pocket container interactive during edit mode */
.tgs-customizer-container.edit-position-mode .tgs-pocket-container {
    pointer-events: auto !important;
    z-index: 10 !important;
}

/* Disable zoom wrapper dragging during edit mode */
.tgs-zoom-wrapper.tgs-edit-mode-active {
    cursor: default !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}

.tgs-rotate-row {
    display: flex;
    gap: 3px;
    margin-bottom: 5px;
}

.tgs-rotate-btn {
    width: 35px;
    height: 35px;
    background: white;
    color: #D4AF37;
    border: 2px solid #D4AF37;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tgs-rotate-btn:hover {
    background: #D4AF37;
    color: #001A33;
}

/* Rotation handle - compensates for zoom */
.tgs-rotation-handle {
   position: absolute;
   top: -10px;
   right: 25px;
   width: 30px;
   height: 30px;
   background: rgba(212, 175, 55, 0.9);
   border: 1px solid white;
   border-radius: 50%;
   cursor: grab;
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 20;
   box-shadow: 0 1px 4px rgba(0,0,0,0.3);
   transition: all 0.2s ease;
}

/* Compensate for zoom scaling */
.tgs-zoom-wrapper.zoomed .tgs-rotation-handle {
   transform: scale(0.4); /* 1/2.7 to counteract the zoom scale */
}

.tgs-rotation-handle:hover {
   background: #D4AF37;
   
   cursor: grab;
}

.tgs-rotation-handle:active {
   cursor: grabbing;
   
}

.tgs-rotation-grip {
   color: white;
   font-size: 24px;
   font-weight: bold;
   pointer-events: none;
}

.tgs-scale-row {
   display: flex;
   gap: 3px;
   margin-bottom: 5px;
}

.tgs-scale-btn {
   width: 35px;
   height: 35px;
   background: white;
   color: #D4AF37;
   border: 2px solid #D4AF37;
   border-radius: 4px;
   cursor: pointer;
   font-size: 18px;
   font-weight: 500;
   display: flex;
   align-items: center;
   justify-content: center;
   transition: all 0.3s ease;
}

.tgs-scale-btn:hover {
   background: #D4AF37;
   color: #001A33;
}

.tgs-scale-handle {
   position: absolute;
   top: -10px;
   left: -25px;
   width: 30px;
   height: 30px;
   background: rgba(212, 175, 55, 0.9);
   border: 1px solid white;
   border-radius: 50%;
   cursor: grab;
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 20;
   box-shadow: 0 1px 4px rgba(0,0,0,0.3);
   transition: all 0.2s ease;
}

/* Compensate for zoom scaling */
.tgs-zoom-wrapper.zoomed .tgs-scale-handle {
   transform: scale(0.4); /* 1/2.7 to counteract the zoom scale */
}

.tgs-scale-handle:hover {
   background: #D4AF37;
   cursor: grab;
}

.tgs-scale-handle:active {
   cursor: grabbing;
}

.tgs-scale-grip {
   color: white;
   font-size: 16px;
   font-weight: bold;
   pointer-events: none;
}

.tgs-action-buttons {
   display: flex;
   gap: 10px;
   justify-content: center;
   margin-top: 15px;
   width: 100%;
}

.tgs-confirm-btn,
.tgs-cancel-btn {
   flex: 1;
   padding: 10px 16px;
   border: none;
   border-radius: 4px;
   font-size: 14px;
   font-weight: 500;
   cursor: pointer;
   transition: background-color 0.3s ease;
}

.tgs-confirm-btn {
   background: #D4AF37;
   color: #FAFAFA;
}

.tgs-confirm-btn:hover {
   background: #B3902F;
}

.tgs-cancel-btn {
   background: #333333;
   color: white;
}

.tgs-cancel-btn:hover {
   background: #001A33;
}

/* Screenshot Generation System */
.tgs-screenshot-confirmation {
   background: rgba(245, 225, 164, 0.3);
   border: 1px solid #D4AF37;
   border-radius: 5px;
   padding: 15px;
   margin: 10px 0;
   animation: tgs-fade-in 0.3s ease-out;
}

.tgs-screenshot-preview {
   display: flex;
   align-items: center;
   gap: 15px;
}

.tgs-screenshot-preview img {
   width: 60px;
   height: 60px;
   object-fit: cover;
   border-radius: 3px;
   border: 1px solid #CCCCCC;
}

.tgs-screenshot-preview p {
   margin: 0;
   color: #001A33;
   font-weight: 500;
   font-size: 14px;
}

.tgs-hires-badge {
   display: inline-block;
   background: #D4AF37;
   color: #001A33;
   font-size: 10px;
   padding: 2px 6px;
   border-radius: 10px;
   margin-left: 5px;
   font-weight: 500;
}

@keyframes tgs-fade-in {
   from {
       opacity: 0;
       transform: translateY(-10px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

@media only screen and (max-width: 600px) {
   
   .tgs-upload-area {
       min-height: 100px;
       padding: 15px;
   }
   
   .tgs-upload-icon {
       font-size: 28px;
   }
   
   .tgs-upload-instructions h4 {
       font-size: 16px;
   }
   
   .tgs-upload-instructions p {
       font-size: 13px;
   }
   
   .tgs-mode-option {
       font-size: 14px;
       height: 36px;
   }
   
   .tgs-customizer-main {
       flex-direction: column;
       justify-content: center;
       align-items: center;
       padding: 0px;
       transform: scale(1.0);
       min-height: 500px;
   }
   
   .tgs-image-container {
       width: 100% !important;
       zoom: 0;
       margin: 0px;
       
   }
   
   .tgs-shirt-image {
       width: 100%;
       max-width: 500px;
   }
   
   .tgs-controls-container {
       position: relative;
       top: 20px;
       right: 0;
       width: 90%;
       margin: 0 auto;
   }
   
   .tgs-pocket-grid {
       grid-template-columns: repeat(3, 1fr);
   }
   
   .tgs-size-option {
       font-size: 14px;
   }
   
   .tgs-pocket-container {
       width: 100px;
       top: 70%;
       left: 64%;
   }
   
   /* Mobile design pocket positioning and sizing */
   .tgs-pocket-image {
       width: 40px;
       margin-left: 5px;
       margin-top: 25px;
       padding: 0;
       padding-left: 0px;
   }

   /* Mobile responsive for file info */
   .tgs-file-details h4 {
       font-size: 16px;
   }
   
   .tgs-file-details p {
       font-size: 13px;
   }
   
   .tgs-change-file-btn {
       font-size: 12px;
       padding: 6px 12px;
   }
   
   .tgs-screenshot-confirmation {
       padding: 10px;
       margin: 8px 0;
   }
   
   .tgs-screenshot-preview {
       gap: 10px;
   }
   
   .tgs-screenshot-preview img {
       width: 50px;
       height: 50px;
   }
   
   .tgs-screenshot-preview p {
       font-size: 13px;
   }
}

/* Tablet sizing - intermediate breakpoint */
@media only screen and (max-width: 1024px) and (min-width: 601px) {
   .tgs-controls-container {
       position: relative;
       top: 20px;
       right: 0;
       width: 90%;
       margin: 0 auto;
   }
   
/* Tablet border positioning */
    .tgs-customizer-container.upload-mode .tgs-pocket-container::before {
       width: 80px;
       height: 80px;
       left: 15px;
   }
}


/* Mobile custom image positioning */
@media only screen and (max-width: 600px) {
    /* Fix the custom uploaded image positioning to match mobile pocket positioning */
    .tgs-pocket-image.tgs-custom-image {
        width: 45px !important;           /* 50px CSS = 40px actual display */
        max-width: 45px !important;       /* We changed this from 40px */
        height: auto !important;          /* Natural aspect ratio */
        max-height: none !important;      /* CRITICAL: Remove desktop max-height constraint */
        min-width: 0 !important;          /* Remove any min constraints */
        min-height: 0 !important;         /* Remove any min constraints */
        margin-left: 3px !important;      /* Match design pocket position */
        margin-top: 20px !important;      /* Match design pocket position */
        padding: 0 !important;            /* Remove all padding (was causing size/position issues) */
    }
    
    /* Ensure border stays correctly positioned throughout upload workflow */
    .tgs-customizer-container.upload-mode .tgs-pocket-container::before {
            width: 45px !important;
            height: 45px !important;
            left: 3px !important;
            top: 20px !important;
            background-size: contain;
            background-position: center;
        }
}

@media only screen and (max-width: 600px) {
    .tgs-move-btn, 
    .tgs-rotate-btn, 
    .tgs-scale-btn,
    .tgs-mode-option,
    .tgs-size-option,
    .tgs-edit-btn,
    .tgs-confirm-btn,
    .tgs-cancel-btn,
    .tgs-add-to-cart-btn {
        font-size: 16px !important;  /* Critical: 16px prevents zoom */
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        touch-action: manipulation;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Ensure minimum touch target size */
    .tgs-move-btn, 
    .tgs-rotate-btn, 
    .tgs-scale-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Hide desktop-only manipulation handles on mobile */
    .tgs-scale-handle,
    .tgs-rotation-handle {
        display: none !important;
    }
}

/* Price Display Section */
.tgs-control-section.tgs-price-section {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
    box-sizing: border-box;
}

.tgs-price-section {
    display: none;
}

.tgs-price-section.show {
    display: block;
}

.tgs-price-display {
    background: #FAFAFA;
    border: 2px solid #D4AF37;
    border-radius: 5px;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    color: #001A33;
}

.tgs-price-amount {
    color: #D4AF37;
    font-size: 20px;
}

.tgs-price-shipping {
    color: #333333;
    font-size: 14px;
    margin-left: 5px;
}

/* Tablet sizing - intermediate breakpoint */
@media only screen and (max-width: 1024px) and (min-width: 601px) {
   /* Controls container positioning - keep absolute position */
   .tgs-controls-container {
       position: absolute;
       top: 10%;
       right: 5%;
       width: 300px;
   }
   
   /* Design pocket image - larger */
   .tgs-pocket-image {
       width: 85px;
       margin-left: 15px;
   }
   
   /* Custom uploaded image - larger than design pocket */
   .tgs-pocket-image.tgs-custom-image {
       width: 100px !important;
       height: auto !important;
       max-width: 100px !important;
       max-height: 100px !important;
       margin-left: 10px !important;
       margin-top: -5px !important;
   }
   
   /* Border sizing to match upload pocket */
   .tgs-customizer-container.upload-mode .tgs-pocket-container::before {
       width: 100px;
       height: 100px;
       left: 10px;
       top: -5px;
   }
}