/* FDM Ruthex Inserts – Frontend Styles
   Matches the 3dprint plugin's p3d-info / stellarnav / p3d-fieldset look. */

/* ── Sidebar wrapper – matches stellarnav.mobile.light li ───── */
#ruthex-wrapper {
    display: block;
    margin: 0;
    padding: 0;
    background: rgb(204, 204, 204);
    border-top: 1px solid rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    width: 100%;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: rgb(77, 85, 95);
    line-height: normal;
    position: relative;
    text-align: left;
}

/* ── Activation button – matches stellarnav li a ─────────────── */
.ruthex-activate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: rgb(0, 0, 0);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
    overflow-wrap: break-word;
    line-height: normal;
    transition: all 0.3s ease-out;
    outline: none;
}
.ruthex-activate-btn .ruthex-activate-icon {
    font-size: 16px;
    line-height: 1;
}

/* ── Selection list below button ──────────────────────────────── */
.ruthex-selection-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(229, 229, 229, 0.8);
}
.ruthex-selection-list:empty {
    display: none;
}
.ruthex-selection-list li {
    padding: 8px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ruthex-selection-list li:last-child {
    border-bottom: none;
}
.ruthex-selection-list .ruthex-sel-hole {
    font-weight: 600;
}
.ruthex-selection-list .ruthex-sel-insert {
    color: #555;
}
.ruthex-selection-list .ruthex-sel-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-left: 8px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    color: #aaa;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ruthex-selection-list .ruthex-sel-remove:hover {
    background: #fee;
    border-color: #e55;
    color: #c33;
}

/* ── Badge (hole count on activation button) ─────────────────── */
.ruthex-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #00b1ea;
    color: #fff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════
   MODAL – Split layout: 3D viewer (left) + hole list (right)
   ══════════════════════════════════════════════════════════════ */

.ruthex-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ruthex-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
}

/* ── Dialog container ────────────────────────────────────────── */
.ruthex-modal-dialog {
    position: relative;
    width: 95vw;
    max-width: 1100px;
    height: 80vh;
    max-height: 720px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ruthex-modal-in 0.2s ease-out;
}
@keyframes ruthex-modal-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Header ──────────────────────────────────────────────────── */
.ruthex-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #333;
    color: #fff;
    flex-shrink: 0;
}
.ruthex-modal-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}
.ruthex-modal-close {
    flex-shrink: 0;
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.ruthex-modal-close:hover {
    opacity: 1;
}

/* ── Content area: two-column split ──────────────────────────── */
.ruthex-modal-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left column: 3D viewer ──────────────────────────────────── */
.ruthex-modal-viewer {
    flex: 1;
    min-width: 0;
    background: #1e1e1e;
    position: relative;
    overflow: hidden;
}
/* Override the plugin's viewer sizing when inside our modal */
.ruthex-modal-viewer #p3d-viewer {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.ruthex-modal-viewer #p3d-viewer canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Right column: hole list panel ───────────────────────────── */
.ruthex-modal-panel {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e5e5e5;
    background: #fff;
}

/* ── Panel body (scrollable hole list) ───────────────────────── */
.ruthex-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    min-height: 0;
}

/* ── Panel footer (summary + done button) ────────────────────── */
.ruthex-modal-footer {
    flex-shrink: 0;
    padding: 12px 16px 14px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}
.ruthex-modal-done-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 0;
    background: #00b1ea;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.ruthex-modal-done-btn:hover {
    background: #0095c8;
}
.ruthex-modal-done-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 177, 234, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   HOLE LIST COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Loading state ───────────────────────────────────────────── */
#ruthex-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: #666;
    font-size: 14px;
}
.ruthex-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-top-color: #00b1ea;
    border-radius: 50%;
    animation: ruthex-spin 0.7s linear infinite;
}
@keyframes ruthex-spin {
    to { transform: rotate(360deg); }
}

/* ── Hole color dot ──────────────────────────────────────────── */
.ruthex-hole-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ── Hole card ───────────────────────────────────────────────── */
.ruthex-hole-card {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    margin-bottom: 2px;
    background: #fff;
    border: 1px solid #e5e5e5;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.ruthex-hole-card:last-child {
    margin-bottom: 0;
}
.ruthex-hole-card:hover {
    background-color: #e2e2e2;
}
.ruthex-hole-card.ruthex-active {
    border-color: #00b1ea;
}
.ruthex-hole-card.ruthex-selected {
    background: #f1f8e9;
    border-color: #4CAF50;
}
.ruthex-hole-card.ruthex-selected.ruthex-active {
    border-color: #4CAF50;
}

/* ── Hole info ───────────────────────────────────────────────── */
.ruthex-hole-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.ruthex-hole-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}
.ruthex-hole-dims {
    font-size: 12px;
    color: #777;
}

/* ── Direction toggle button (through-holes only) ────────────── */
.ruthex-dir-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 16px;
    line-height: 28px;
    text-align: center;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ruthex-dir-btn:hover {
    background: #e2e2e2;
    border-color: #00b1ea;
    color: #00b1ea;
}
.ruthex-dir-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 177, 234, 0.25);
}

/* ── Remove insert button ────────────────────────────────────── */
.ruthex-remove-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 18px;
    line-height: 22px;
    text-align: center;
    color: #999;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ruthex-remove-btn:hover {
    background: #fee;
    border-color: #e55;
    color: #c33;
}

/* ── Select dropdown ─────────────────────────────────────────── */
.ruthex-hole-select {
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 10px;
}
.ruthex-insert-select {
    font-size: 13px;
    padding: 5px 8px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: #fff;
    min-width: 120px;
    max-width: 170px;
    cursor: pointer;
}
.ruthex-insert-select:focus {
    outline: none;
    border-color: #00b1ea;
}

/* ── Summary ─────────────────────────────────────────────────── */
.ruthex-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}
.ruthex-summary-line strong {
    color: #333;
}

/* ── Empty / error states ────────────────────────────────────── */
.ruthex-no-holes,
.ruthex-error {
    padding: 16px 0;
    font-size: 14px;
    color: #888;
    text-align: center;
}
.ruthex-error {
    color: #c62828;
}
