/* RadiaCode Controller Panel Styles */

/* Using CSS variables for easy theme changes */

.radiacode-tab {
    position: fixed;
    right: 0;
    top: 60%;
    transform: translateY(-50%);
    background-color: var(--primary-color); /* Using global primary-color */
    color: var(--dark-color); /* Using global dark-color */
    padding: 15px 10px;
    cursor: pointer;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 1.2em;
    transition: transform 0.3s ease-in-out;
}

.radiacode-tab.shifted {
    transform: translateY(-50%) translateX(-350px);
}

.radiacode-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background-color: var(--dark-color); /* Using global dark-color */
    color: var(--light-color); /* Using global light-color */
    box-shadow: -2px 0 10px rgba(0,0,0,0.5);
    transition: transform 0.3s ease-in-out, visibility 0s linear 0.3s;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    transform: translateX(100%);
    visibility: hidden;
    overflow-y: auto; /* Make it scrollable */
}

.radiacode-sidebar.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s ease-in-out, visibility 0s linear 0s;
}

.radiacode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.radiacode-header h2 {
    color: var(--primary-color); /* Using global primary-color */
    font-size: 1.8em;
    margin: 0;
}

.radiacode-section h3 {
    font-size: 1.2em;
    color: var(--primary-color); /* Using global primary-color */
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #444; /* Keeping #444 as it's a common border color */
}

.radiacode-status {
    display: grid; /* Use grid for better control */
    grid-template-columns: 1fr auto auto; /* Name | Status | Buttons */
    align-items: center;
    gap: 10px; /* Space between items */
    background-color: rgba(var(--dark-color-rgb), 0.7);
    padding: 10px;
    border-radius: 5px;
}

.radiacode-status .btn-sm {
    padding: 5px 10px;
    font-size: 0.8em;
}

#radiacode-device-name {
    font-weight: bold;
    font-size: 1.1em;
}

.status-indicator {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    color: var(--light-color); /* Using global light-color */
}
.status-indicator.connected { background-color: green; }
.status-indicator.disconnected { background-color: red }


/* --- NEW Current Reading Card --- */
.current-reading-card {
    background-color: rgba(var(--dark-color-rgb), 0.7); /* Using global dark-color with transparency */
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.current-reading-card {
    background-color: rgba(var(--dark-color-rgb), 0.7);
    border-radius: 8px;
    padding: 15px; /* Slightly reduced padding */
    text-align: center;
}

.reading-pair {
    display: flex;
    justify-content: space-around; /* Distribute items evenly */
    align-items: center;
    gap: 10px; /* Space between the two reading displays */
}

.reading-item-display {
    flex: 1; /* Allow items to grow and shrink */
    cursor: pointer;
    user-select: none;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    border: 1px solid rgba(var(--primary-color-rgb), 0.3); /* Subtle border */
}

.reading-item-display:hover {
    background-color: rgba(var(--dark-color-rgb), 0.8);
}

.reading-item-display .reading-value {
    font-size: 2.2em; /* Smaller than previous primary, larger than previous secondary */
    line-height: 1;
    color: var(--primary-color);
    display: block; /* Ensure value and unit are on separate lines */
}

.reading-item-display .reading-unit {
    font-size: 0.9em; /* Smaller unit font size */
    color: var(--secondary-color);
    display: block;
    margin-top: 5px; /* Space between value and unit */
}
/* --- End of New Styles --- */

.radiacode-data-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(var(--light-color-rgb), 0.2);
}

.radiacode-data-item:last-of-type {
    border-bottom: none;
}

.radiacode-data-item .label {
    color: var(--secondary-color);
    font-size: 0.95em;
}

.radiacode-data-item .value {
    color: var(--light-color);
    font-weight: bold;
    font-size: 1em;
}

.radiacode-section .chart-container {
    background-color: rgba(var(--dark-color-rgb), 0.7);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    height: 200px; /* Adjust height as needed for the graph */
    display: flex;
    align-items: center;
    justify-content: center;
}

.radiacode-section .chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

.radiacode-section.recording-controls-section {
    margin-top: 20px; /* Add some space above */
}

.radiacode-section.recording-controls-section.hidden {
    display: none;
}

.recording-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.readings-list, .uploads-list {
    max-height: 200px; /* Increased height */
    overflow-y: auto;
    background-color: rgba(var(--dark-color-rgb), 0.7); /* Using global dark-color with transparency */
    padding: 10px;
    border-radius: 5px;
    list-style-type: none; /* Removes bullet points from <ul> */
    margin: 0;
}

.uploads-list .upload-item { /* Assuming you'll have these */
    padding: 5px;
    border-bottom: 1px solid #444; /* Keeping #444 as it's a common border color */
}

.no-readings, .no-uploads {
    color: var(--text-medium); /* Using global text-medium */
    text-align: center;
    padding: 10px 0;
}

/* --- Mobile Overlay for RadiaCode Readings --- */
.radiacode-mobile-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--dark-color); /* Using global dark-color */
    color: var(--light-color); /* Using global light-color */
    font-family: var(--font-mono);
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.radiacode-mobile-overlay.visible {
    display: block;
}

.radiacode-mobile-overlay-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
}

.radiacode-mobile-overlay-item {
    flex: 1;
}

.radiacode-mobile-overlay-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color); /* Using global primary-color */
}

.radiacode-mobile-overlay-unit {
    font-size: 0.9em;
    color: var(--secondary-color); /* Using global secondary-color */
}

/* --- Responsive Design for Mobile --- */
@media (max-width: 600px) {
    .radiacode-sidebar {
        width: 100%;
        right: 0;
        transform: translateX(100%);
    }
    .radiacode-tab.shifted {
        transform: translateY(-50%) translateX(-100%); /* Adjust for full width on mobile */
    }
    .radiacode-sidebar.open {
        width: 100%;
    }
}