/**
 * Settings Panel & Style Popover (Images 2, 3, 4 Replica)
 */

/* Wrench Panel (Image 4) */
.desmos-wrench-panel {
    position: absolute;
    width: 290px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 12px 14px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #1d2939;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.desmos-wrench-panel.hidden-wrench {
    display: none !important;
}

.wrench-header-tabs {
    display: flex;
    background: #eaecf0;
    border-radius: 4px;
    padding: 2px;
}

.font-size-btn {
    flex: 1;
    background: transparent;
    border: none;
    font-weight: 700;
    font-size: 13px;
    padding: 4px;
    border-radius: 3px;
    cursor: pointer;
    color: #475467;
}

.font-size-btn.active {
    background: #344054;
    color: #ffffff;
}

.wrench-section {
    border-top: 1px solid #eaecf0;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wrench-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
}

.wrench-grid-types {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grid-icon-pills {
    display: flex;
    gap: 4px;
}

.grid-type-btn {
    width: 26px;
    height: 26px;
    background: #f2f4f7;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-type-btn.active {
    background: #344054;
    color: #ffffff;
    border-color: #344054;
}

.axis-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.axis-label-input {
    width: 90px;
    padding: 2px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.bounds-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #475467;
}

.bound-input {
    width: 58px;
    padding: 2px 4px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 11px;
    outline: none;
}

.step-input {
    width: 48px;
    padding: 2px 4px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 11px;
    outline: none;
}

.angle-mode-pills {
    display: flex;
    background: #eaecf0;
    border-radius: 4px;
    padding: 2px;
    border-top: 1px solid #eaecf0;
    margin-top: 4px;
}

.angle-btn {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 600;
    padding: 5px;
    border-radius: 3px;
    cursor: pointer;
    color: #475467;
}

.angle-btn.active {
    background: #344054;
    color: #ffffff;
}

/* Style Popover (Images 2 & 3) */
.desmos-style-popover {
    position: fixed;
    width: 220px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    padding: 12px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #1d2939;
    font-size: 12.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.desmos-style-popover.hidden-popover {
    display: none !important;
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.popover-title {
    font-weight: 700;
    font-size: 13px;
}

.style-row {
    display: flex;
    gap: 6px;
}

.style-btn {
    flex: 1;
    height: 32px;
    background: #f2f4f7;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.style-btn.active {
    background: #2d70b3;
    color: #ffffff;
    border-color: #2d70b3;
}

.thickness-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.thickness-row input {
    width: 55px;
    padding: 2px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding-top: 4px;
}

.swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
}

.swatch:hover {
    transform: scale(1.15);
}

.swatch.active {
    border-color: #1d2939;
    box-shadow: 0 0 0 1px #ffffff inset;
}

.popover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f2f4f7;
    padding-top: 6px;
}

/* Desmos Toggle Switch (Images 2 & 5) */
.desmos-toggle-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.desmos-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.desmos-toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d0d5dd;
    transition: 0.2s;
    border-radius: 18px;
}

.desmos-toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.desmos-toggle-switch input:checked + .slider {
    background-color: #344054;
}

.desmos-toggle-switch input:checked + .slider:before {
    transform: translateX(14px);
}

.secondary-shapes {
    margin-top: 4px;
}

.popover-row-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    color: #475467;
}

.size-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.size-control input {
    width: 44px;
    padding: 2px 4px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
}

.popover-check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.popover-section-divider {
    height: 1px;
    background: #eaecf0;
    margin: 4px 0;
}

.label-text-input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 12px;
}
