/* ==========================================
   FENCE NET & LOGO VISUALIZER - CLEAN UI
   ========================================== */

/* CSS Variables */
.fence-logo-visualizer {
    --primary: #1a73e8;
    --border: #e0e0e0;
    --bg-light: #f8f9fa;
    --text: #202124;
    --text-secondary: #5f6368;
    --success: #1e8e3e;
    --danger: #d93025;
}

/* ==========================================
   MODAL STRUCTURE
   ========================================== */

.fence-visualizer-modal-parent {
    width: 100% !important;
    height: 100vh !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    margin: 0 !important;
    left: 0 !important;
    top: 0 !important;
}

.fence-visualizer-modal {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fence-visualizer-modal .modal-content {
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    border: none;
    overflow: hidden;
}

.fence-visualizer-modal .modal-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    min-height: auto;
}

.fence-visualizer-modal .modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.fence-visualizer-modal .modal-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    background: #fff;
}

/* ==========================================
   MAIN LAYOUT
   ========================================== */

#app-container {
    display: flex;
    gap: 0;
    padding: 0;
    padding-bottom: 70px;
    height: calc(100vh - 90px);
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

/* ==========================================
   VISUALIZER SECTION (LEFT)
   ========================================== */

/* ==========================================
   VISUALIZER SECTION (LEFT)
   ========================================== */

#visualizerSection {
    flex: 2;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border-right: 1px solid var(--border);
    height: 100%;
    overflow: auto;
    padding: 20px;
}

#visualizerDisplayArea {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#visualizerContainer {
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
    border: 1px solid var(--border);
}

#printableArea {
    position: absolute;
    box-sizing: border-box;
}

/* Zoom Reset Button */
.zoom-reset-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    padding: 8px 15px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom-reset-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.zoom-reset-btn svg {
    width: 16px;
    height: 16px;
}

.logo-placeholder {
    position: absolute;
    object-fit: contain;
    z-index: 5;
    box-sizing: border-box;
}

.logo-placeholder.invalid-pos {
    border: 2px solid var(--danger);
    opacity: 0.7;
}

#controlsAndInfoWrapper {
    width: 100%;
    margin-top: 65px;
}

#visualizerInfoPanel {
    font-size: 14px;
    color: var(--text);
    text-align: center;
    background: #fff;
    padding: 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: 100%;
}

#visualizerInfoPanel span {
    font-weight: 500;
    color: var(--primary);
}

#priceSection {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

#priceSection strong {
    color: var(--success);
}

/* Input section (RIGHT) - Enhanced styling */
/* Input section (RIGHT) - Enhanced styling */
#inputSection {
    flex: 1;
    min-width: 360px;
    max-width: 420px;
    background: #fff;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    box-sizing: border-box;
}
.fence-modal-footer{
    display: none;
}
#inputSection h2 {
    background: #fff;
    margin: 0 0 16px 0;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    z-index: 10;
}

#inputSection h3 {
    margin: 16px 0 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

/* Smooth scrolling */
#inputSection, #visualizerSection {
    scroll-behavior: smooth;
}

/* Scrollbar styling for better UX */
#inputSection::-webkit-scrollbar, 
#visualizerSection::-webkit-scrollbar {
    width: 6px;
}

#inputSection::-webkit-scrollbar-track, 
#visualizerSection::-webkit-scrollbar-track {
    background: transparent;
}

#inputSection::-webkit-scrollbar-thumb, 
#visualizerSection::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

#inputSection::-webkit-scrollbar-thumb:hover, 
#visualizerSection::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* Enhanced form styling */
.fence-form {
    margin-bottom: 16px;
    background: var(--bg-light);
    padding: 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.fence-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.fence-form input[type="number"],
#inputSection input[type="number"],
#inputSection select {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fence-form input[type="number"]:focus,
#inputSection input[type="number"]:focus,
#inputSection select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.fence-form .note {
    font-size: 12px;
    color: var(--text-secondary);
    margin: -4px 0 8px 0;
}

/* Enhanced buttons */
#inputSection button {
    padding: 8px 16px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    margin-top: 8px;
}

#inputSection button:hover {
    background: #188038;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

#inputSection button:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#inputSection button:disabled {
    background: #dadce0;
    cursor: not-allowed;
    color: #5f6368;
    box-shadow: none;
}

#resetFenceInputsBtn {
    background: var(--danger);
    margin-left: 8px;
}

#resetFenceInputsBtn:hover {
    background: #b3000c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Radio button sections */
#printingModeSection {
    background: var(--bg-light);
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
    border: 1px solid var(--border);
}

#printingModeSection label,
#layoutOptions label {
    display: block;
    padding: 6px 0;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: normal;
}

#printingModeSection input[type="radio"],
#layoutOptions input[type="radio"] {
    margin-right: 6px;
    vertical-align: middle;
}

/* Logo input styling */
.logo-input-group {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.15s;
}

.logo-input-group:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.logo-input-group h4 {
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-input-group input[type="file"] {
    width: 100%;
    padding: 6px 0;
    font-size: 13px;
    cursor: pointer;
}

.logo-input-group input[type="file"]::-webkit-file-upload-button {
    background: var(--primary);
    color: #fff;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 8px;
    transition: background 0.15s;
}

.logo-input-group input[type="file"]::-webkit-file-upload-button:hover {
    background: #1765cc;
}

.logo-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.remove-logo-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.remove-logo-btn:hover {
    background: #b3000c;
}

.position-inputs {
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.position-inputs > div {
    flex: 1;
    min-width: 140px;
}

.logo-preview {
    max-width: 80px;
    height: auto;
    margin: 8px 0;
    border: 1px solid var(--border);
    padding: 4px;
    background: #fff;
    display: none;
    border-radius: 4px;
}

.size-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: -4px 0 8px 0;
}

/* Layout controls styling */
#layoutControlsWrapper,
#autoLayoutControls {
    background-color: var(--light-gray);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#layoutOptions {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
}

#layoutOptions label {
    margin-right: 20px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

#verticalAlign,
#horizontalDist {
    border-radius: 4px;
    border: 1px solid var(--border-color);
    width: 100%;
    margin-bottom: 15px;
    background-color: white;
}

.help-text {
    font-size: 0.9em;
    color: #6c757d;
    margin: 5px 0 15px;
    line-height: 1.5;
}

/* Group repeat controls */
#groupRepeatControls {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#groupRepeatControls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 10px;
}

#groupRepeatControls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#groupRepeatCountRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

#groupRepeatCountInput {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

/* Add logo button styling */
#addLogoBtn {
    width: 100%;
    background-color: var(--primary-color);
    padding: 12px;
    font-weight: 600;
    margin-top: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

#addLogoBtn:before {
    content: "+";
    font-size: 18px;
    font-weight: bold;
}

#addLogoBtn:hover {
    background-color: #0056b3;
}

/* Manual position controls */
.manual-position-controls {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

.manual-position-controls p {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 600;
}

.manual-position-controls hr {
    margin: 15px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

/* Canvas Add button styling */
#canvas-add {
    margin: 20px 0;
    text-align: center;
}
#visualizerWrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

#visualizerContainer {
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
}
#canvas-add button {
    padding: 12px 25px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

#canvas-add button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#canvas-add button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Full-screen modal styles */
.modals-overlay {
    z-index: 899 !important;
}

.modal-popup.modal-slide {
    left: 0 !important;
    top: 0 !important;
}

.modal-popup.modal-slide .modal-inner-wrap {
    width: 100% !important;
    height: 100vh !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
}

.modal-popup.modal-slide .modal-content {
    height: calc(100vh - 120px) !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: auto;
}

/* Custom modal styles */
.fence-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}

header.page-header.amsearch-full-width.sticky-mobile.fixed {
    z-index: 999!important;
}

.fence-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
.fence-modal-header span{
    font-size: 16px;
    font-weight: 600;
}
.fence-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #556cec;
    color: #fff;
}
button#startTourBtn {
    color: #000;
}
.fence-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #495057;
    transition: color 0.2s ease;
}

.fence-modal-close:hover {
    color: #000;
}

.fence-modal-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.fence-modal-footer {
    padding: 10px 15px;
}

/* Fix for small screens */
@media (max-width: 480px) {
    .position-inputs > div {
        flex: 1 1 100%;
    }
    
    #layoutOptions label {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #groupRepeatCountRow {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========================================
   GLOBAL LOGO ACTION FOOTER
   ======================================== */
#global-logo-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #ffffff;
    border-top: 2px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    gap: 20px;
}

#global-logo-action .left-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

#global-logo-action .right-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

#global-logo-action .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

#global-logo-action .action-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#global-logo-action .action-btn .btn-icon {
    font-size: 16px;
    font-weight: bold;
}

#global-logo-action .color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
}

#global-logo-action .color-picker-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0;
}

#global-logo-action .color-picker-input {
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
}

#global-logo-action .color-picker-input:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

#global-logo-action .btn-close {
    padding: 10px 25px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#global-logo-action .btn-close:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#global-logo-action .btn-primary {
    padding: 10px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* ========================================
   FENCE DETAILS POPUP
   ======================================== */
.frame-details-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(3px);
}

.frame-details-overlay.active {
    display: block;
}

.frame-details-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 9999;
    overflow: hidden;
}

.frame-details-popup.active {
    display: block;
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.frame-details-popup .popup-content {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.frame-details-popup .popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-details-popup .popup-close:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    transform: rotate(90deg);
}

.frame-details-popup h2 {
    margin: 0 0 25px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

#popup-fence-details .detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

#popup-fence-details .detail-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

#popup-fence-details .detail-value {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #global-logo-action {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    #global-logo-action .left-actions,
    #global-logo-action .right-actions {
        flex: 1;
        justify-content: center;
    }
    
    .frame-details-popup {
        width: 95%;
        max-width: none;
    }
    
    .frame-details-popup .popup-content {
        padding: 20px;
    }
    #controlsAndInfoWrapper{
        display: none;
    }
    
    .zoom-reset-btn {
        top: 5px;
        right: 5px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .zoom-reset-btn svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    #global-logo-action {
        flex-direction: column;
        gap: 10px;
    }
    
    #global-logo-action .action-btn,
    #global-logo-action .btn-close,
    #global-logo-action .btn-primary {
        text-align: center;
        justify-content: center;
    }
}


.fence-modal-save {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.fence-modal-save:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tour-tooltip { 
    position:absolute; 
    background:#fff; 
    padding:20px; 
    border-radius:8px; 
    box-shadow:0 4px 32px rgba(0,0,0,0.18); 
    z-index:9999; 
    box-sizing: border-box;
}

.tour-highlight { 
    box-shadow:0 0 0 4px #007bff !important; 
    transition:box-shadow .2s !important; 
    z-index:10000 !important; 
    border-radius:5px !important;
}

span.tour-error {
    width: 100%;
    text-align: left;
    margin-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    #app-container {
        flex-direction: column;
        align-items: center;
    }
    
    #visualizerSection, 
    #inputSection {
        min-width: 100%;
        max-width: 100%;
        order: unset;
    }
    
    #visualizerSection {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .fence-modal-header h2 {
        font-size: 16px;
    }
    div#inputSection {
        padding-bottom: 50px;
    }
    .actions.fixedbutton{
        z-index: 9!important;
    }
    #app-container {
        flex-direction: column;
        padding: 10px;
    }
    
    #visualizerSection, 
    #inputSection {
        flex: auto;
        padding: 15px;
    }
    
    .fence-form label,
    .logo-input-group label {
        font-size: 14px;
    }
    
    #inputSection button {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .logo-input-group {
        padding: 15px;
    }
    
    .fence-modal-header,
    .fence-modal-footer {
        padding: 10px 15px;
    }
}

/* Fix for small screens */
@media (max-width: 480px) {
    .position-inputs > div {
        flex: 1 1 100%;
    }
    
    #layoutOptions label {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #groupRepeatCountRow {
        flex-direction: column;
        align-items: flex-start;
    }
}

