/* Design Page Styles */

.design-page-container {
    width: 100vw;
    height: calc(100vh - var(--header-height, 75px));
    background: #f8f9fa;
    overflow: hidden; /* Remove all scrolling from main container */
    position: relative;
}

.design-content {
    width: 100%;
    height: 100%; /* Use full height instead of min-height */
}

.design-left-panel {
    background: #ffffff;
    padding: 0;
    overflow: hidden; /* Remove inner scrolling */
    height: 100%; /* Ensure full height */
    display: flex;
    flex-direction: column;
    position: relative;
}

.design-right-panel {
    background: #ffffff;
    padding: 0;
    overflow: hidden; /* Remove inner scrolling */
    height: 100%; /* Ensure full height */
    display: flex;
    flex-direction: column;
}

/* Centered border line between panels */
.design-left-panel::after {
    content: '';
    position: absolute;
    top: 20px; /* Don't touch top edge */
    bottom: 20px; /* Don't touch bottom edge */
    right: -1px; /* Position at the center between panels */
    width: 2px;
    background-color: var(--primary-color);
    border-radius: 1px;
    z-index: 10;
}

/* Left Panel Styling */
.design-studio-title {
    font-size: 1.5rem; /* Reduce font size to save space */
    font-weight: 700;
    color: #495057;
    margin-bottom: 1rem; /* Reduce margin */
    text-align: center;
    flex-shrink: 0; /* Prevent shrinking */
    padding: 1rem 1rem 0 1rem; /* Add padding for title */
}

.tools-controls-section {
    flex-shrink: 0; /* Don't shrink */
    overflow-y: visible; /* No scrolling needed */
    margin-bottom: 0.5rem;
    padding: 0 1rem; /* Add horizontal padding */
}

/* Product Configuration Card */
.product-config-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem; /* Reduced from 1rem */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.config-row {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* First row: Product, Type, Colors, Quantity */
.config-row:first-child {
    grid-template-columns: 1.2fr 1fr 1.5fr 0.8fr; /* Optimized widths */
}

/* Second row: Sizes, Size Chart, Fabric, Quality */
.config-row:last-child {
    grid-template-columns: 2fr 0.5fr 0.9fr 0.9fr; /* More space for 8 size chips, compact chart button, smaller dropdowns */
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #000000; /* Consistent black color */
    margin-bottom: 0.25rem;
    font-family: inherit;
}

.config-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8rem;
    background-color: #ffffff;
    color: #495057;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.config-select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: nowrap; /* Keep all colors in one row */
    gap: 0.2rem; /* Reduced gap for better fit */
    justify-content: flex-start;
}

.color-swatch {
    width: 20px; /* Slightly smaller for better fit */
    height: 20px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007bff;
}

.color-swatch.selected {
    box-shadow: 0 0 0 2px #007bff;
    transform: scale(1.1);
}

/* Size Chips */
.size-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem; /* Reduced gap for more chips */
    justify-content: flex-start;
}

.size-chip {
    width: 24px; /* Fixed width for perfect circle */
    height: 24px; /* Fixed height for perfect circle */
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 50%; /* Perfect circle */
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent shrinking */
}

.size-chip:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.size-chip.selected {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

.size-chip.selected:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}


/* Size Chart Button */
.config-button {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8rem;
    background-color: #ffffff;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-align: center;
}

.config-button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.config-button:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.size-chart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem; /* Larger icon */
    padding: 0.375rem 0.25rem; /* Compact padding */
}

/* Size Chart Modal Styles */
.size-chart-table {
    margin-bottom: 0;
}

.size-chart-table th {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
}

.size-chart-table td {
    font-size: 0.8rem;
    text-align: center;
    vertical-align: middle;
}

.size-chart-note {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

/* Design Tools Tabs */
.design-tools-tabs {
    margin-top: 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    margin-left: 1rem;
    margin-right: 1rem;
}

/* Tab Navigation */
.tabs-nav {
    margin: 0.25rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    background: transparent; /* No background */
}

.tab-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background: transparent; /* No background by default */
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 25px; /* Pill/capsule shape */
    min-width: 100px;
}

.tab-btn:hover {
    color: #495057;
}

.tab-btn.active {
    background: #007bff; /* Accent color background */
    color: #ffffff; /* Primary text color (white) */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Tab Content */
.tab-content {
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    padding: 1rem;
    position: relative;
}

.tab-pane.active {
    display: block;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    aspect-ratio: 1;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-item:hover {
    border-color: #007bff;
    transform: scale(1.02);
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-templates {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Text Input - Simplified Structure */
.text-main-card {
    width: 100%;
    max-width: 500px;
    margin: 0.5rem auto;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.text-input-field {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    resize: none;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    min-height: 160px;
}

.text-input-field:focus {
    outline: none;
    border-color: #007bff;
}

.text-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Action Buttons - Below Card */
.text-action-buttons {
    width: 100%;
    max-width: 500px;
    margin: 0.5rem auto 0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.format-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #ffffff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.format-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.format-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.format-divider {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 0.25rem;
}

.font-style-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
    cursor: pointer;
    min-width: 120px;
}

.font-style-select:focus {
    outline: none;
    border-color: #007bff;
}

.text-color-picker {
    width: 32px;
    height: 32px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 2px;
}

.text-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.text-input-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.text-action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #007bff;
    color: white;
}

.text-action-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.text-action-btn.clear-btn {
    background: #6c757d;
}

.text-action-btn.clear-btn:hover {
    background: #545b62;
}

.text-input-label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.text-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.text-control-btn {
    padding: 0.5rem 1.5rem;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.text-control-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.text-control-btn.secondary {
    background: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.text-control-btn.secondary:hover {
    background: #6c757d;
    color: white;
}

/* Upload Area */
.upload-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.upload-area {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-area:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.upload-lottie {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem auto;
}

.upload-text h4 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.upload-text p {
    margin: 0 0 0.5rem 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.upload-text small {
    color: #adb5bd;
    font-size: 0.8rem;
}

/* Right Panel - Dynamic Square Boxes */
.design-canvas-area {
    display: flex;
    gap: 5px; /* Fixed 5px gap between boxes */
    margin-bottom: 0.5rem; /* Minimal margin to maximize box space */
    justify-content: center; /* Center the boxes */
    align-items: flex-start; /* Align to top */
    height: auto; /* Let content determine height */
    flex-shrink: 0; /* Prevent shrinking */
    padding: 1rem; /* Add padding around canvas area */
    width: 100%;
    box-sizing: border-box;
}

.design-square-box {
    /* Maximum space utilization for laptop screens:
       - Right panel is approximately 58% of viewport width (more accurate)
       - Use 90% of viewport height with minimal reserved space for product details
       - Reduce reserved space to absolute minimum
       - Perfect fit calculation for laptop screens
    */
    width: min(calc((58vw - 15px) / 2), calc(90vh - 100px));
    height: min(calc((58vw - 15px) / 2), calc(90vh - 100px));
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevent shrinking below calculated size */
    transition: all 0.3s ease; /* Smooth transitions when resizing */
    position: relative; /* For positioning the preview icon */
}

.design-square-box .placeholder-text {
    color: #6c757d;
    font-size: 1.1rem;
    text-align: center;
}

/* Preview Icon */
.preview-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.preview-icon:hover {
    background: rgba(0, 123, 255, 0.8);
    transform: scale(1.1);
}

.preview-icon i {
    color: white;
    font-size: 0.9rem;
}

/* Preview Modal - Perfect Square */
.preview-modal-dialog {
    width: 60vw;
    height: 60vh;
    max-width: 60vw;
    max-height: 60vh;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-dialog .modal-content {
    width: 60vw;
    height: 60vh;
    display: flex;
    flex-direction: column;
}

.preview-modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Product Details Section - Ultra Compact */
.product-details-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 0.25rem; /* Minimal padding for maximum box space */
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: auto; /* Push to bottom */
    margin-left: 1rem; /* Add horizontal margin */
    margin-right: 1rem; /* Add horizontal margin */
    margin-bottom: 1rem; /* Add bottom margin */
    flex-shrink: 0; /* Don't shrink */
    position: relative; /* For positioning fixed buttons */
}

.product-details-text {
    font-size: 0.8rem; /* Smaller text */
    color: #6c757d;
    line-height: 1.3; /* Tighter line height */
    margin: 0; /* Remove margins */
}

.product-details-title {
    font-size: 1rem; /* Further reduce font size */
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem; /* Space for grid */
    text-align: center; /* Center the title */
    text-transform: uppercase; /* Upper case */
    letter-spacing: 0.5px;
}

/* Product Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem 0.5rem;
    margin-bottom: 3.5rem; /* Extra space for fixed buttons */
    padding-right: 1rem; /* Prevent overlap with buttons */
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.detail-value {
    font-size: 0.75rem;
    color: #007bff;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
    flex-shrink: 1;
    min-width: 0;
}

/* Action Buttons - Fixed Bottom Right */
.action-buttons {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.action-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: #007bff; /* Accent color */
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 25px; /* Pill/capsule shape */
    min-width: 90px;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.action-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

/* Specific button styling */
.save-btn {
    background: #007bff;
}

.save-btn:hover {
    background: #0056b3;
}

.buy-btn {
    background: #007bff;
    font-weight: 700; /* Slightly bolder for emphasis */
}

.buy-btn:hover {
    background: #0056b3;
}

/* Make product details text more compact */
.product-details-section p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.3;
}

/* Responsive Design - Dynamic and Flexible */

/* For very large screens (30+ inch monitors), allow boxes to grow larger */
@media (min-width: 2560px) {
    .design-square-box {
        /* For ultra-wide monitors, maximize space utilization with upper limit */
        width: min(calc((58vw - 15px) / 2), min(calc(90vh - 100px), 800px));
        height: min(calc((58vw - 15px) / 2), min(calc(90vh - 100px), 800px));
    }
}

/* For medium to large screens (tablets in landscape to large desktops) */
@media (min-width: 768px) and (max-width: 2559.98px) {
    .design-left-panel {
        border-right: 1px solid #e9ecef;
        border-bottom: none;
    }
    
    /* Boxes automatically resize based on viewport - no fixed sizes needed */
    .design-canvas-area {
        flex-wrap: nowrap; /* Always keep side by side */
    }
}

/* For small screens and mobile devices - stack vertically */
@media (max-width: 767.98px) {
    .design-left-panel {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding: 5px; /* Maximum 5px padding */
    }
    
    .design-right-panel {
        padding: 5px; /* Maximum 5px padding */
    }
    
    .design-studio-title {
        font-size: 1.5rem;
    }
    
    .design-square-box {
        /* On mobile, use viewport width for sizing with 5px padding */
        width: min(calc(100vw - 20px), 400px);
        height: min(calc(100vw - 20px), 400px);
    }
    
    .design-canvas-area {
        flex-direction: column;
        align-items: center;
        gap: 5px; /* Fixed 5px gap */
        padding: 0 5px; /* Maximum 5px padding */
    }
    
    /* Mobile responsive for config card */
    .config-row {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
        gap: 0.5rem;
    }
    
    .config-item {
        margin-bottom: 0.5rem;
    }
    
    .config-label {
        font-size: 0.8rem;
    }
    
    .config-select {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .color-swatch {
        width: 18px;
        height: 18px;
    }
    
    .size-chip {
        width: 22px; /* Slightly smaller on mobile */
        height: 22px;
        font-size: 0.65rem;
    }
    
    .size-chips {
        gap: 0.1rem; /* Tighter spacing on mobile */
    }
    
    .product-config-card {
        padding: 0.4rem; /* Even more compact on mobile */
    }
}
