/**
 * Metal Box - Sketch Generator
 * Technical drawing style, light gray background, no modern card design
 */

.sketch-generator {
    background: #e8e8e8;
    padding: 20px 0;
}

/* Desktop: controls left (fixed width), preview fills remaining space */
@media (min-width: 992px) {
    .sketch-container {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
    .sketch-row {
        display: flex;
        flex-wrap: nowrap;
    }
    .sketch-controls-col {
        flex: 0 0 320px !important;
        max-width: 320px !important;
    }
    .sketch-preview-col {
        flex: 1 1 0 !important;
        min-width: 0;
        max-width: none !important;
    }
}

.sketch-controls {
    background: #f5f5f5;
    border: 1px solid #bbb;
    padding: 20px;
    margin-bottom: 20px;
}

.sketch-controls h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
}

.sketch-controls .form-group {
    margin-bottom: 12px;
}

.sketch-controls label {
    display: block;
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 4px;
}

.sketch-controls input[type="text"],
.sketch-controls input[type="number"],
.sketch-controls select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #999;
    background: #fff;
    font-size: 0.9rem;
}

.sketch-controls input[type="checkbox"] {
    margin-right: 8px;
}

/* Special box type buttons - touch-friendly */
.sketch-type-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sketch-type-btn {
    padding: 10px 14px;
    min-height: 44px;
    border: 1px solid #333;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 2px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sketch-type-btn:hover {
    background: #eee;
}

.sketch-type-btn.active {
    background: #333;
    color: #fff;
}

.sketch-controls {
    -webkit-user-select: none;
    user-select: none;
}

.sketch-preview-outer {
    background: #d5d5d5;
    padding: 24px;
    border: 1px solid #999;
    overflow: auto;
    min-height: calc(100vh - 280px);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.sketch-svg-container {
    background: #e0e0e0;
    display: inline-block;
    padding: 24px;
    margin: 16px;
    border: 1px solid #999;
}

.sketch-svg-container svg {
    display: block;
}

.sketch-preview-outer {
    touch-action: manipulation;
}

/* Box color selector */
.sketch-color-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sketch-color-label {
    font-size: 0.9rem;
    color: #444;
}

.sketch-color-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sketch-color-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid #999;
    border-radius: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sketch-color-btn:hover {
    border-color: #333;
}

.sketch-color-btn.active {
    border-color: #333;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

.sketch-export-btns {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sketch-export-btns .btn {
    padding: 8px 16px;
    border: 1px solid #333;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
}

.sketch-export-btns .btn:hover {
    background: #333;
    color: #fff;
}

/* Mobile: full-width, controls first, touch-friendly */
@media (max-width: 991px) {
    .sketch-generator {
        padding: 12px 0;
    }
    .sketch-generator .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .sketch-generator .sketch-row {
        flex-direction: column;
    }
    .sketch-generator .sketch-controls-col {
        margin-bottom: 16px;
    }
    .sketch-controls {
        padding: 16px;
        margin-bottom: 0;
    }
    .sketch-controls h3 {
        font-size: 1rem;
    }
    .sketch-preview-col {
        width: 100%;
        max-width: 100%;
    }
    .sketch-preview-outer {
        padding: 12px;
        min-height: 250px;
        -webkit-overflow-scrolling: touch;
        overflow: auto;
    }
    .sketch-svg-container {
        margin: 8px;
    }
    .sketch-svg-container {
        min-width: min-content;
        padding: 12px;
    }
    .sketch-type-btns {
        gap: 6px;
    }
    .sketch-type-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 12px 6px;
        min-height: 48px;
        font-size: 0.8rem;
    }
    .sketch-export-btns {
        flex-direction: column;
        gap: 8px;
    }
    .sketch-export-btns .btn {
        width: 100%;
        min-height: 48px;
        padding: 14px 18px;
    }
    .section-head.m-b20 {
        margin-bottom: 12px !important;
    }
    .sketch-color-selector {
        flex-direction: column;
        align-items: flex-start;
    }
    .sketch-color-btn {
        width: 32px;
        height: 32px;
    }
}

/* Save Sketch Modal */
.sketch-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sketch-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.sketch-modal-content {
    position: relative;
    background: #fff;
    border: 1px solid #999;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.sketch-modal-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
}
.sketch-modal-content .form-group {
    margin-bottom: 14px;
}
.sketch-modal-content label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.sketch-modal-content input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #999;
    font-size: 0.95rem;
}
.sketch-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}
.sketch-modal-actions .btn {
    padding: 8px 18px;
    border: 1px solid #333;
    cursor: pointer;
    font-size: 0.95rem;
}
.sketch-modal-actions .btn-secondary {
    background: #f5f5f5;
    color: #333;
}
.sketch-modal-actions .btn-primary {
    background: #333;
    color: #fff;
}

/* Print: hide controls, show sketch and dimensions */
@media print {
    .sketch-controls,
    .sketch-export-btns,
    .sketch-color-selector,
    .sketch-modal,
    .no-print {
        display: none !important;
    }
    .sketch-preview-outer {
        border: none;
        padding: 0;
        background: #fff;
    }
    .sketch-svg-container {
        background: #fff;
        border: none;
        padding: 0;
    }
}
