/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Avenir Medium', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 930px;
    height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    min-height: 920px;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Left Control Panel */
.control-panel {
    width: 400px;
    background: white;
    padding: 15px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 250px;
}

.control-panel h1 {
    color: #000;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Mission Gothic Regular', sans-serif;
    border-bottom: 2px solid #ff6b35;
    padding-bottom: 10px;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.input-group {
    margin-bottom: 10px;
}

.input-group-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.input-group-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 2px;
    font-weight: 500;
    font-family: 'Mission Gothic Regular', sans-serif;
    color: #333;
    font-size: 14px;
    letter-spacing: 0.01em;
}

.input-group label .required-asterisk {
    color: #dc3545; /* Red color for asterisk */
    margin-left: 2px;
}

.dropdown, .dimension-input, .quantity-input, .text-input, textarea.text-input {
    width: 100%;
    padding: 8px 8px;
    border: 1px solid #bbbbbb;
    border-radius: 0px;
    font-size: 14px;
    background: white;
    color: #056839;
    transition: border-color 0.3s ease;
    font-family: 'Avenir Medium', sans-serif;
}

.dropdown:focus, .dimension-input:focus, .quantity-input:focus, .text-input:focus, textarea.text-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

textarea.text-input {
    resize: vertical;
    min-height: 60px;
}

.dropdown {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center; /* Adjust 'right 8px' to move arrow left/right, 'center' for vertical */
    background-size: 16px;
    padding-right: 35px; /* Adjust this to add space between content and arrow */
}

.dimension-input {
    text-align: right;
}

.disclaimer-text {
    margin: 6px 0 20px 0;
    font-size: 11px;
    color: #666;
    line-height: 1.1;
    font-style: italic;
    text-align: center;
}

.disclaimer-text a, .registration-text a {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 600;
}

.disclaimer-text a:hover, .registration-text a:hover {
    text-decoration: underline;
}

.generate-pdf-btn {
    width: 100%;
    padding: 15px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Mission Gothic Regular', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 15px;
    letter-spacing: 0.01em;
}

.generate-pdf-btn:hover:not(:disabled) {
    background: #e55a2b;
}

.generate-pdf-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.registration-text {
    font-size: 12px;
    color: #000;
    text-align: center;
}

/* Right Viewer Panel */
.viewer-panel {
    flex: 1;
    background: #F4F7F9;
    position: relative;
}

/* Floating Technical Drawing Drawer */
.technical-drawing-drawer {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 100%;
    min-width: 180px;
    max-width: 700px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 180px;
    transform-origin: left center;
}

.technical-drawing-drawer.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border-left: none;
    border-radius: 0 8px 8px 0;
    transform: scaleX(0);
    overflow: hidden;
}

/* Key Toggle Button in Sidebar */
.key-toggle-btn {
    width: 50%;
    padding: 6px;
    background: #056839;
    color: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Mission Gothic Regular', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    letter-spacing: 0.01em;
}

.key-toggle-btn:hover {
    background: #056839;
    border-color: #056839;
}

.key-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.key-text {
    font-weight: 600;
}

.key-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    transform: rotate(90deg); /* Right arrow when closed */
}

.technical-drawing-drawer:not(.collapsed) + .key-toggle-btn .key-arrow,
.key-toggle-btn:not(.collapsed) .key-arrow {
    transform: rotate(-90deg); /* Left arrow when open */
}


/* Drawer Content */
.drawer-content {
    padding: 4px 8px 8px;
    /* max-height: 420px; */
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    transform: scaleX(1);
    transform-origin: left center;
}

.technical-drawing-drawer.collapsed .drawer-content {
    opacity: 0;
    visibility: hidden;
    transform: scaleX(0);
    padding: 0;
}

/* Images Container */
.images-container {
    display: flex;
    gap: 8px;
    width: 100%;
}

.images-container .static-drawing {
    flex: 1;
    width: calc(50% - 4px);
}

.drawer-header {
    padding: 0 6px 4px;
    /* background: #f8f9fa; */
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0px 0px 0 0;
}

.drawer-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    font-family: 'Mission Gothic Regular', sans-serif;
}

.drawer-content {
    padding: 4px 8px 8px;
    /* max-height: 300px; */
    overflow: hidden;
    transition: max-height 0.3s ease;
}


.static-drawing {
    width: 100%;
    height: auto;
    position: relative;
}

/* Hole drawing container - circular with connecting lines */
.hole-drawing-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

/* Circular border around the container */
.hole-drawing-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    border: 1px solid #666;
    border-radius: 50%;
    z-index: 3;
    box-sizing: border-box;
}

/* Connecting line from circle to the other image - default/base */
.hole-drawing-container::after {
    content: '';
    position: absolute;
    top: 42%;
    right: -60px;
    transform: translateY(-50%);
    width: 87px;
    height: 0;
    border-top: 1px dashed #666;
    z-index: 2;
}

/* Flat-plate specific connecting line */
.hole-drawing-container.flat-plate::after {
    top: 42%;
    right: -60px;
    width: 87px;
    border-top: 1px dashed #666;
}

/* U-head specific connecting line */
.hole-drawing-container.u-head::after {
    top: 26%;
    right: -73px;
    width: 122px;
    border-top: 1px dashed #666;
}

/* L-head specific connecting line */
.hole-drawing-container.l-head::after {
    top: 34%;
    right: -178px;
    width: 212px;
    border-top: 1px dashed #666;
}

/* Bucket specific connecting line */
.hole-drawing-container.bucket::after {
    top: 38%;
    right: -198px;
    width: 228px;
    border-top: 1px dashed #666;
}

.drawing-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    font-family: 'Mission Gothic Regular', sans-serif;
    text-align: center;
    margin-bottom: 0px;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 3;
}

/* Label above hole drawing container - positioned at top of circle */
.drawing-label {
    top: 14px;
    margin-bottom: -2px;
    z-index: 3;
}

.technical-drawing-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Special styling for hole drawing image - contained within circle */
.hole-drawing-container .technical-drawing-img {
    width: 72%;
    max-width: 72%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    margin-bottom: 6px;
}

/* Dynamic Labels */
.dynamic-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Labels inside hole drawing container need to be positioned relative to the circle */
.hole-drawing-container .dynamic-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.dynamic-labels > div {
    position: absolute;
    background: white;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 2px 4px;
    font-family: 'Mission Gothic Regular', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: #333;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.label-f {
    top: 20%;    /* Positioned above the F dimension line */
    left: 38%;
    transform: translate(-50%, -50%);
}

.label-e {
    top: 60%;    /* Positioned to the right of the E dimension line */
    left: 78%;
    transform: translate(-50%, -50%);
}

.label-g {
    top: 81%;    /* Positioned below the G dimension line */
    left: 49%;
    transform: translate(-50%, -50%);
}

/* Labels for second image (A, B, C, D) */
.label-a {
    top: 13%;    
    left: 34%;
    transform: translate(-50%, -50%);
}

.label-b {
    top: 84%;    
    left: 33%;
    transform: translate(-50%, -50%);
}

.label-h {
    top: 16%;    
    left: 82.5%;
    transform: translate(-50%, -50%);
}

.label-c {
    top: 62%;   
    left: 92%;
    transform: translate(-50%, -50%);
}

.label-d {
    top: 38%;    
    left: 7%;
    transform: translate(-50%, -50%);
}
/* Labels for flat-plate */
.static-drawing.top-type.flat-plate .label-a {
    top: 23%;
    left: 31%;
}
.static-drawing.top-type.flat-plate .label-b {
    top: 82%;
    left: 30%;
}
.static-drawing.top-type.flat-plate .label-c {
    top: 55%;
    left: 90%;
}

/* Labels for u-head */
.static-drawing.top-type.u-head .label-d {
    top: 34%;
    left: 6.5%;
}
.static-drawing.top-type.u-head .label-c {
    top: 56%;
    left: 90%;
}
.static-drawing.top-type.u-head .label-b {
    top: 82%;
    left: 32.5%;
}
.static-drawing.top-type.u-head .label-a {
    top: 13%;
    left: 34%;
}
.static-drawing.top-type.u-head .label-h {
    left: 85%;
}
/* Labels for l-head */
.static-drawing.top-type.l-head .label-a {
    top: 15%;
    left: 67.5%;
}
.static-drawing.top-type.l-head .label-b {
    top: 80%;
    left: 31%;
}
.static-drawing.top-type.l-head .label-c {
    top: 46.5%;
    left: 4.5%;
}
.static-drawing.top-type.l-head .label-d {
    top: 34.5%;
    left: 89%;
}
.static-drawing.top-type.l-head .label-h {
    top: 29%;
    left: 35%;
}


/* Labels for bucket */
  /* Different positioning for bucket */

.label-text {
    display: block;
}

.label-value {
    display: block;
    font-size: 14px;
    color: #000;
    margin-top: 0px;
}

.model-viewer {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #666;
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

/* Ultra-wide monitor adjustments */
@media (min-width: 1920px) {
    .modal-content {
        margin: 2% auto;
    }
}

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

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #333;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Mission Gothic Regular', sans-serif;
    margin: 0;
    letter-spacing: -0.01em;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff6b35;
}

.modal-body {
    padding: 30px;
}

.auth-sections {
    display: flex;
    gap: 40px;
}

.auth-section {
    flex: 1;
}

.auth-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 500;
    font-family: 'Mission Gothic Regular', sans-serif;
    border-bottom: 2px solid #ff6b35;
    padding-bottom: 10px;
    letter-spacing: 0.01em;
}

.auth-section input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #bbbbbb;
    border-radius: 0px;
    font-size: 16px;
    color: #056839;
    transition: border-color 0.3s ease;
}

.auth-section select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #bbbbbb;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    color: #056839;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.auth-section select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.auth-section input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Mission Gothic Regular', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
    letter-spacing: 0.01em;
}

.auth-btn:hover {
    background: #e55a2b;
}

.auth-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.g-recaptcha {
    margin-bottom: 20px;
}

.forgot-password {
    display: block;
    text-align: right;
    margin-bottom: 15px;
    color: #ff6b35;
    text-decoration: none;
    font-size: 14px;
}

.forgot-password:hover {
    text-decoration: underline;
}

.auth-link {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.auth-link a {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

.return-to-store {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 600;
}

.return-to-store:hover {
    text-decoration: underline;
}

.disclaimer-content {
    line-height: 1.6;
    color: #555;
}

.disclaimer-content p {
    margin-bottom: 20px;
}

.ok-btn {
    padding: 12px 30px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ok-btn:hover {
    background: #e55a2b;
}

/* Success Modal Styles */
.success-content {
    text-align: center;
    line-height: 1.6;
    color: #333;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.download-link {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
}

.download-link:hover {
    text-decoration: underline;
}

.order-info {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.order-info h4 {
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #ff6b35;
    padding-bottom: 5px;
}

.order-summary {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    
    .control-panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .input-group-row {
        flex-direction: column;
        gap: 0;
    }
    
    .input-group-row .input-group {
        margin-bottom: 15px;
    }
    
    .viewer-panel {
        height: auto;
        min-height: 500px;
    }
    
    .technical-drawing-drawer {
        width: 100% !important; /* Full width on mobile */
        min-width: 100% !important;
        max-width: 100% !important;
        bottom: 10px;
        left: 0 !important; /* Start from left edge */
        right: 0 !important; /* Extend to right edge */
        height: fit-content; /* Fit exactly to content */
        min-height: auto; /* No minimum height constraint */
    }
    
    .technical-drawing-drawer.collapsed {
        width: 0;
        min-width: 0;
        max-width: 0;
    }
    
    
    .drawer-content {
        height: auto; /* Allow content to determine height */
        overflow: visible; /* Allow content to be visible */
        padding: 4px 4px 4px !important; /* Minimal padding - just enough for border */
    }
    
    .drawer-header {
        padding: 0 4px 2px !important; /* Minimal header padding */
        margin-bottom: 0 !important;
    }
    
    .images-container {
        flex-direction: row; /* Keep images side-by-side on mobile */
        gap: 6px;
        height: auto; /* Let images determine height */
        align-items: flex-start; /* Align images at top */
        margin: 0 !important; /* Remove any margins */
    }
    
    .images-container .static-drawing {
        width: calc(50% - 3px); /* Each image takes half width minus gap */
        height: auto; /* Allow height to adjust based on image */
    }
    
    /* On mobile, keep aspect-ratio to maintain perfect circle */
    .hole-drawing-container {
        aspect-ratio: 1 !important; /* Keep perfect circle on mobile */
        padding: 4px !important; /* Minimal padding */
        overflow: visible !important; /* Allow line to extend beyond container */
    }
    
    /* Make the circle bigger on mobile */
    .hole-drawing-container::before {
        width: 90% !important; /* Bigger circle (was 85%) */
        height: 90% !important; /* Bigger circle (was 85%) */
    }
    
    .static-drawing {
        padding: 0 !important; /* No padding on static drawing containers */
        margin: 0 !important; /* No margins */
        overflow: visible !important; /* Allow connecting line to extend beyond */
    }
    
    .images-container {
        overflow: visible !important; /* Allow connecting line to extend beyond */
    }
    
    /* Let images scale naturally on mobile */
    .technical-drawing-img {
        height: auto !important; /* Let images determine their own height */
        width: 100% !important; /* Full width of container */
    }
    
    /* Make dimension labels scale proportionally with image on mobile */
    /* Labels are positioned with percentages, but need to scale font/box size with container */
    .static-drawing.top-type .dynamic-labels > div {
        font-size: clamp(10px, 2.2vw, 13px) !important; /* Scale font with viewport */
        padding: clamp(1px, 0.4vw, 4px) clamp(3px, 0.8vw, 6px) !important; /* Scale padding */
        min-width: clamp(26px, 6.5vw, 32px) !important; /* Scale min-width */
        border-width: clamp(0.5px, 0.15vw, 1px) !important; /* Scale border */
    }
    
    /* Ensure labels maintain their percentage-based positioning */
    .static-drawing.top-type .dynamic-labels > div {
        transform: translate(-50%, -50%) !important; /* Keep centered transform */
    }
    
    /* Mobile-specific adjustments for connecting line */
    /* Line starts at circle's right edge and extends to hole on second image */
    .hole-drawing-container::after {
        top: 42% !important;
        left: 95% !important; /* Circle's right edge */
        right: auto !important;
        width: 120% !important; /* Extend well past container to reach second image */
    }
    
    .hole-drawing-container.flat-plate::after {
        top: 40% !important; 
        left: 95% !important; 
        right: auto !important;
        width: 25% !important;
    }
    
    .hole-drawing-container.u-head::after {
        top: 24% !important; 
        left: 88% !important;
        right: auto !important;
        width: 35% !important;
    }
    
    .hole-drawing-container.l-head::after {
        top: 31.5% !important;
        left: 91% !important;
        right: auto !important;
        width: 63% !important;
    }
    
    .hole-drawing-container.bucket::after {
        top: 36% !important; 
        left: 93% !important;
        right: auto !important;
        width: 67% !important;
    }
    
    .dynamic-labels > div {
        font-size: 12px;
        padding: 2px 6px;
        min-width: 35px;
    }
    
    .label-value {
        font-size: 10px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .auth-sections {
        flex-direction: column;
        gap: 30px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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