/* RF Tool - Nested Table Layout */

/* Ensure parent containers don't interfere with full-width layout */
body {
    overflow-x: auto;
}

.e-content.entry-content {
    overflow: visible !important;
}

/* Break out of Nikola's container constraint */
/* The container has max-width: 1140px, we need to escape it */
.rf-outer-table {
    /* Use position relative with calculated margins to break out */
    position: relative;
    width: calc(100vw - 40px);
    max-width: none;

    /* Calculate offset from container edge to viewport edge */
    /* Container is max 1140px centered, so we need to shift left by the difference */
    left: 50%;
    transform: translateX(-50%);

    /* Add padding to prevent content from touching edges */
    padding-left: 20px;
    padding-right: 20px;

    /* Table styling */
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;

    /* Ensure table takes full width */
    box-sizing: border-box;
}

.rf-sidebar-cell {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    vertical-align: top;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px 0 0 4px;
}

.rf-right-sidebar-cell {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    vertical-align: top;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0 4px 4px 0;
}

.rf-canvas-cell {
    vertical-align: top;
    padding: 20px;
    background-color: #ffffff;
    /* Let this cell take remaining width */
    width: auto;
}

/* Nested table: 3x3 grid for rulers and canvas */
.rf-ruler-table {
    border-collapse: collapse;
    margin: 0 auto;
    /* Allow table to size naturally based on canvas */
    width: auto;
    display: inline-table;
}

.rf-ruler-table td {
    padding: 0;
    margin: 0;
}

/* Ensure canvas cell doesn't constrain canvas */
.rf-ruler-table .rf-canvas-container {
    width: auto;
    height: auto;
}

/* Ruler cells */
.rf-ruler-top,
.rf-ruler-bottom {
    height: 30px;
    background-color: #34495e;
    position: relative;
    overflow: hidden;
}

.rf-ruler-left,
.rf-ruler-right {
    width: 30px;
    background-color: #34495e;
    position: relative;
    overflow: hidden;
}

/* Empty corner cells */
.rf-ruler-corner {
    width: 30px;
    height: 30px;
    background-color: #2c3e50;
}

/* Canvas container cell */
.rf-canvas-container {
    text-align: center;
    background-color: #1a1a1a;
    padding: 0;
    margin: 0;
    /* Prevent any shrinking */
    min-width: 800px;
    min-height: 600px;
}

#rfCanvas {
    display: block;
    background-color: #1a1a1a;
    cursor: default;
    /* Canvas dimensions are set by JavaScript, ensure they're respected */
    max-width: none;
    width: auto;
    height: auto;
}

/* Ruler tick marks and labels */
.rf-ruler-tick {
    position: absolute;
    background-color: #ecf0f1;
}

.rf-ruler-tick-major {
    background-color: #3498db;
}

.rf-ruler-label {
    position: absolute;
    color: #ecf0f1;
    font-size: 9px;
    font-family: monospace;
    white-space: nowrap;
}

/* Sidebar sections */
.rf-sidebar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #343a40;
}

.rf-sidebar-subtitle {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 20px;
}

.rf-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.rf-section:last-child {
    border-bottom: none;
}

.rf-section-title {
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    color: #495057;
    margin-bottom: 10px;
}

/* Upload area */
.rf-upload-area {
    border: 2px dashed #6c757d;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.rf-upload-area:hover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.rf-upload-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.rf-upload-text {
    font-size: 13px;
    color: #495057;
}

.rf-upload-hint {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
}

/* Form controls */
.rf-form-group {
    margin-bottom: 10px;
}

.rf-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #495057;
}

.rf-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
}

.rf-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.rf-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: white;
}

.rf-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rf-btn-primary {
    background-color: #007bff;
    color: white;
}

.rf-btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
}

.rf-btn-primary:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.rf-btn-success {
    background-color: #28a745;
    color: white;
    margin-bottom: 5px;
}

.rf-btn-success:hover {
    background-color: #1e7e34;
}

.rf-btn-secondary {
    background-color: #6c757d;
    color: white;
    margin-bottom: 5px;
}

.rf-hint {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

/* Materials list */
#materialList {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

#materialList::-webkit-scrollbar {
    width: 6px;
}

#materialList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#materialList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#materialList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.rf-material-item {
    padding: 8px 10px;
    margin-bottom: 5px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.rf-material-item:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.rf-material-item.selected {
    background-color: #cfe2ff;
    border-color: #0d6efd;
    font-weight: bold;
}

/* Hardware list */
#hardwareList {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    margin-top: 10px;
}

#hardwareList::-webkit-scrollbar {
    width: 6px;
}

#hardwareList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#hardwareList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#hardwareList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.rf-hardware-item {
    padding: 8px 10px;
    margin-bottom: 5px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: move;
    transition: all 0.2s ease;
    font-size: 11px;
}

.rf-hardware-item:hover {
    background-color: #e9ecef;
    border-color: #28a745;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rf-hardware-item.dragging {
    opacity: 0.5;
}

.rf-hardware-icon {
    display: inline-block;
    margin-right: 5px;
    font-size: 14px;
}

.rf-hardware-name {
    font-weight: 500;
    display: block;
    margin-bottom: 3px;
}

.rf-hardware-specs {
    font-size: 10px;
    color: #6c757d;
}

/* AP Properties Panel */
.rf-btn-danger {
    background-color: #dc3545;
    color: white;
    margin-top: 10px;
}

.rf-btn-danger:hover {
    background-color: #c82333;
}

.rf-slider-group {
    margin-bottom: 10px;
}

.rf-slider-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #495057;
}

.rf-slider-value {
    float: right;
    color: #007bff;
    font-weight: bold;
}

.rf-slider {
    width: 100%;
    margin-bottom: 5px;
}

/* Wall drawing mode indicator */
.rf-mode-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 10px;
}

.rf-mode-indicator.active {
    background-color: #28a745;
    color: white;
}

.rf-mode-indicator.inactive {
    background-color: #6c757d;
    color: white;
}

/* Status bar */
.rf-status-bar {
    background-color: #343a40;
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 12px;
}

.rf-status-left {
    display: inline-block;
    width: 70%;
}

.rf-status-right {
    display: inline-block;
    width: 28%;
    text-align: right;
}
