/*
 Description:    Style for Phone Dimension Sim Tools page(s)
*/

:root { --bg:#f6f7fb; --panel:#ffffff; --ink:#0f172a; --muted:#64748b; --border:#e5e7eb; }
html,body{height:100%}
body{margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; color:var(--ink); background:linear-gradient(180deg,#f5f7fc,#eef2f7); display:grid; grid-template-rows:auto 1fr; gap:12px}
header{padding:14px 18px; background:var(--panel); border-bottom:1px solid var(--border); display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap}
header h1{font-size:18px; margin:0}
.muted{color:var(--muted)}
.small{font-size:12px}
.wrap{display:grid; grid-template-rows:auto 1fr; gap:12px; padding:0 12px 12px; max-width:100%; overflow:hidden}
.panel{background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:12px; box-shadow:0 1px 2px rgba(15,23,42,.06)}
.controls-panel{order:1; max-width:100%; overflow:hidden}
.canvas-panel{order:2; min-height:0; max-width:100%; overflow:hidden}
.controls{display:grid; gap:14px; width:100%; max-width:100%}
.phone-inputs{display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:12px; max-width:100%}
.control-actions{display:flex; flex-direction:column; gap:12px; max-width:100%}

/* Options section styling */
.options-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

/* jQuery UI Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--ink);
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    padding: 0;
}

/* Override jQuery UI checkbox styling to match theme */
.ui-checkboxradio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--ink);
    padding: 4px 0;
    line-height: 1.4;
}

.ui-checkboxradio-icon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 2px solid var(--border);
    background: white;
    display: inline-block;
    position: relative;
    transition: all 0.2s ease;
}

.ui-checkboxradio-checked .ui-checkboxradio-icon {
    background: #2563eb;
    border-color: #2563eb;
}

.ui-checkboxradio-checked .ui-checkboxradio-icon::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ui-checkboxradio-label:hover .ui-checkboxradio-icon {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.ui-checkboxradio-label.ui-state-active .ui-checkboxradio-icon {
    transform: scale(0.95);
}

/* Canvas header styling */
.canvas-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.canvas-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 4px 0;
}

.canvas-description {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    font-style: italic;
}
.zoom-controls{display:flex; flex-direction:column; gap:8px; align-items:flex-start; max-width:100%; width:100%}

/* Better organization for larger screens */
@media (min-width:1200px){
    .controls{display:grid; gap:14px; max-width:100%}
    .phone-inputs{max-width:100%}
    .control-actions{min-width:200px;}
    .zoom-controls{width:100%}
}
.field{display:grid; gap:6px}
.field label{font-size:12px; color:var(--muted)}
input,button{background:#ffffff; color:var(--ink); border:1px solid var(--border); border-radius:10px; padding:8px 10px; font-size:13px}
button{cursor:pointer; font-weight:600; width: 100%;}

/* Enhanced zoom controls styling */
.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 24px 6px 24px;
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 100%;
}

.zoom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.zoom-label {
    font-weight: 600;
    color: var(--ink);
    font-size: 14px;
}

.zoom-info {
    font-size: 13px;
    color: var(--muted);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.zoom-slider-container {
    position: relative;
    width: 100%;
    padding: 20px 0 20px 0;
}

/* jQuery UI Slider Styling */
#zoom-slider {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    border: none;
    margin: 12px 0;
    position: relative;
}

#zoom-slider .ui-slider-handle {
    width: 24px;
    height: 24px;
    background: #2563eb;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    top: 50%;
    transform: translateY(-50%);
    margin-left: -12px;
}

#zoom-slider .ui-slider-handle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

#zoom-slider .ui-slider-handle:active,
#zoom-slider .ui-slider-handle.ui-state-active {
    transform: translateY(-50%) scale(1.05);
    background: #1d4ed8;
}

#zoom-slider .ui-slider-handle:focus {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Slider tick marks and labels */
.ui-slider-tick-mark {
    position: absolute;
    width: 2px;
    height: 6px;
    background: var(--muted);
    top: 1px;
    transform: translateX(-50%);
}

.ui-slider-tick-label {
    position: absolute;
    font-size: 11px;
    color: var(--muted);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-weight: 500;
    text-align: center;
    top: -30px;
    transform: translateX(-50%);
}

/* Highlight the normal/default position */
.ui-slider-tick-label[data-value="3"] {
    color: #2563eb;
    font-weight: 600;
}

/* Bottom labels */
.zoom-bottom-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
    padding: 0 8px;
}

.zoom-bottom-labels span {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.zoom-bottom-labels span:nth-child(2) {
    color: #2563eb;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .zoom-controls {
        padding: 16px;
    }
    
    .ui-slider-tick-label {
        font-size: 10px;
        top: -18px;
    }
    
    .zoom-bottom-labels {
        font-size: 10px;
        padding: 0 6px;
    }
    
    .zoom-bottom-labels span {
        font-size: 9px;
    }
    
    #zoom-slider .ui-slider-handle {
        width: 20px;
        height: 20px;
        margin-left: -10px;
    }
}
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    font-size: 13px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.ui-autocomplete-category {
    font-weight: bold;
    padding: 4px 8px;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
}
.ui-menu .ui-menu-item a {
    padding: 6px 8px;
    font-size: 13px;
    border: none;
    color: var(--ink);
}
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active {
    background: var(--bg);
    border: none;
    color: var(--ink);
}
.ui-autocomplete-loading {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48c3R5bGU+LnNwaW5uZXJfVjhtMXt0cmFuc2Zvcm0tb3JpZ2luOmNlbnRlcjthbmltYXRpb246c3Bpbm5lcl96S09hIDFzIGxpbmVhciBpbmZpbml0ZX0uc3Bpbm5lcl96S09he3RyYW5zZm9ybTpyb3RhdGUoMzYwZGVnKX08L3N0eWxlPjxwYXRoIGQ9Im0xNS41IDRsLTEgLTJoLTVsLTEgMmgtMnYxaDJ2MTNoNXYtMTNoMnYtMXoiIGZpbGw9IiM3NjdmOGQiLz48cGF0aCBkPSJtMTcuNSA2djJoLTExdi0yaC0xdjJjMCAuNTUyLjQ0OCAxIDEgMWgydjUuNWMwIC44MjguNjcyIDEuNSAxLjUgMS41aDVjLjgyOCAwIDEuNS0uNjcyIDEuNS0xLjV2LTUuNWgyYy41NTIgMCAxLS40NDggMS0xdi0yaC0xeiIgZmlsbD0iIzc2N2Y4ZCIgY2xhc3M9InNwaW5uZXJfVjhtMSIvPjwvc3ZnPg==');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px 16px;
}
button.primary{background:#e9f2ff; border-color:#bfdbfe}
button.ghost{background:transparent}
.row{display:flex; gap:8px; align-items:center; max-width:100%; overflow:hidden}
.stage-wrap{position:relative; overflow:auto; width:100%; max-width:100%; border:1px solid var(--border); border-radius:12px; background:#fafafa; min-height:400px}
#stage{display:block; border-radius:14px; background:#fdfefe; border:1px solid var(--border); touch-action:none; pointer-events:auto}
.legend{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.dot{width:10px; height:10px; border-radius:50%; display:inline-block}
.draggable{ cursor: grab; }
.draggable.dragging{ cursor: grabbing; }
.zoom-labels{display:grid; grid-template-columns:1fr 1fr 1fr; width:100%; max-width:240px; font-size:12px; color:var(--muted); box-sizing:border-box}
.zoom-labels span{text-align:center}
input[type=range]{ width:100%; max-width:240px; accent-color:#2563eb; box-sizing:border-box }
.toolbar{display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-top:8px}
.toolbar .left{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.legend-label{font-size: 12px; font-weight: 600; color: var(--ink); margin-right: 4px;}

/* Responsive Design */
@media (max-width:480px){
    .phone-inputs{grid-template-columns:1fr}
    .control-actions{gap:8px}
    .control-actions .row{flex-direction:column; align-items:flex-start; gap:6px}
    .control-actions .row label{font-size:11px}
    .options-section .row{flex-direction:column; align-items:flex-start; gap:4px}
    .canvas-label{font-size:14px}
    .canvas-description{font-size:11px}
    .zoom-controls{align-items:stretch}
    .zoom-labels{width:100%; font-size:11px}
    input[type=range]{width:100%}
    .stage-wrap{min-height:300px}
    .toolbar{flex-direction:column; align-items:stretch; gap:8px}
    .toolbar .left{justify-content:center}
    .toolbar .right{justify-content:center; font-size:12px}
    .wrap{padding:0 8px 8px; gap:8px}
    .panel{padding:8px}
    .controls{grid-template-columns:1fr !important}
}
@media (min-width:481px) and (max-width:768px){
    .phone-inputs{grid-template-columns:1fr}
    .control-actions{gap:8px}
    .control-actions .row{flex-direction:column; align-items:flex-start; gap:6px}
    .options-section .row{flex-direction:column; align-items:flex-start; gap:4px}
    .canvas-label{font-size:15px}
    .zoom-controls{align-items:stretch}
    .zoom-labels{width:100%}
    input[type=range]{width:100%}
    .stage-wrap{min-height:350px}
    .toolbar{flex-direction:column; align-items:stretch; gap:8px}
    .toolbar .left{justify-content:center}
    .toolbar .right{justify-content:center}
    .controls{grid-template-columns:1fr !important}
}
@media (min-width:769px) and (max-width:1024px){
    .phone-inputs{grid-template-columns:repeat(2, 1fr)}
    .stage-wrap{min-height:400px}
    .controls{grid-template-columns:1fr !important}
}
@media (min-width:1025px){
    .stage-wrap{min-height:450px}
}
@media (min-width:769px){
    .phone-inputs{grid-template-columns: repeat(2, 1fr)}
}
