/*
 * icosmo-ui.css
 * Shared interface styles of all Icosmo plugins (panels, labels, inputs, buttons, sliders, result tables).
 *
 * - Applies only inside a plugin container with the class "icosmo-app".
 * - Colours use the variables of the Icosmo theme (--ic-*). Without the theme, the fallback
 *   values are used, so the plugins look the same on every website.
 * - Plugins keep only their own, unique styles in their stylesheets.
 */

/* === BASE & CONTAINER === */
.icosmo-app {
    --font-size-module-title: 0.9em;
    --font-size-label: 0.75em;
    --font-size-input-text: 0.85em;
    --font-size-button: 0.8em;
    --font-size-value-display: 0.7em;
    --font-size-results-base: 1.15em;
    --font-size-results-table: 0.9em;

    font-family: Arial, sans-serif;
    font-size: 1rem;
    font-weight: lighter;
    line-height: 1.5;
    color: var(--ic-text, #e0e0e0);
    box-sizing: border-box;
    background-color: transparent;
}

.icosmo-app *,
.icosmo-app *::before,
.icosmo-app *::after {
    box-sizing: inherit;
}

/* === MODULE (PANEL) === */
.icosmo-app .module {
    border: 1px solid var(--ic-border, #4f4f4f);
    padding: 8px;
    border-radius: 6px;
    background-color: var(--ic-surface, #191919);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.35),
        0 8px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* === PANEL HEADING === */
.icosmo-app .control-group-heading {
    display: flex;
    align-items: left;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--ic-border, #4f4f4f);
    font-size: var(--font-size-module-title) !important;
    font-weight: bold !important;
    color: var(--ic-heading, #f0f0f0) !important;
    text-align: left;
    min-height: 28px;
    flex-wrap: nowrap !important;
}

.icosmo-app .control-group-heading > span {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icosmo-app .control-group-heading .heading-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* === FORMS === */
.icosmo-app .control-group {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.icosmo-app label.control-group-label {
    display: block;
    font-size: var(--font-size-label);
    color: var(--ic-muted, #bdbdbd);
    margin-bottom: 4px;
}

.icosmo-app label.control-group-label-inline {
    font-size: var(--font-size-label);
    color: var(--ic-muted, #bdbdbd);
    margin-right: 2px;
}

.icosmo-app input[type="text"],
.icosmo-app input[type="number"],
.icosmo-app select {
    background-color: var(--ic-input-bg, #111111);
    color: var(--ic-input-text, #cccccc);
    border: 1px solid var(--ic-input-border, #777777);
    padding: 4px 6px;
    font-size: var(--font-size-input-text);
    border-radius: 3px;
    box-sizing: border-box;
    width: 100%;
    height: calc(var(--font-size-input-text) + 10px + 2px);
}

/* Row of controls side by side, each with its label above */
.icosmo-app .input-row-compact {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
}

.icosmo-app .input-row-compact .inline-control-item {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}

/* === BUTTONS === */
.icosmo-app button,
.icosmo-app .play-stop,
.icosmo-app .standard-button-inline {
    background-color: var(--ic-button-bg, #555555);
    color: var(--ic-button-text, #e0e0e0);
    border: 1px solid #111111;
    border-radius: 5px;
    padding: 2px 6px;
    font-size: var(--font-size-button);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.1s ease, transform 0.1s ease;
    user-select: none;
    line-height: 1.4;
    min-height: 20px;
}

.icosmo-app button:hover,
.icosmo-app .play-stop:hover,
.icosmo-app .standard-button-inline:hover {
    background-color: var(--ic-button-hover, #6c6c6c);
}

.icosmo-app button:active,
.icosmo-app .play-stop:active,
.icosmo-app .standard-button-inline:active {
    background-color: #7d7d7d;
    transform: translateY(1px);
}

.icosmo-app .play-stop.playing {
    color: #222222;
    border-color: #c0c0c0;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}

/* === SLIDERS (standard horizontal faders inside .fader-group) === */
.icosmo-app .fader-group {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.icosmo-app .fader-group .value-display {
    min-width: 3em;
    text-align: right;
    font-size: var(--font-size-value-display);
}

.icosmo-app .fader-group input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
}

.icosmo-app .fader-group input[type="range"]::-webkit-slider-runnable-track {
    background: #5f5f5f;
    height: 7px;
    border-radius: 3px;
}

.icosmo-app .fader-group input[type="range"]::-moz-range-track {
    background: #5f5f5f;
    height: 7px;
    border-radius: 3px;
}

.icosmo-app .fader-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    margin-top: -6.5px;
    width: 10px;
    height: 20px;
    background: var(--ic-muted, #bdbdbd);
    border-radius: 3px;
    border: 1px solid #333333;
}

.icosmo-app .fader-group input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 20px;
    background: var(--ic-muted, #bdbdbd);
    border-radius: 3px;
    border: 1px solid #333333;
}

/* === RESULT PANELS AND TABLES === */
.icosmo-app .results-panel > h3 {
    font-size: 1em !important;
    text-align: center;
    border-bottom: 1px solid var(--ic-border, #4f4f4f);
    padding-bottom: 4px;
    margin: 0 0 8px 0;
}

.icosmo-app .results-panel table {
    font-size: var(--font-size-results-table) !important;
    width: 100% !important;
    border-collapse: collapse;
}

.icosmo-app .results-panel th {
    text-align: left;
    background-color: var(--ic-table-head, #262626);
    font-weight: bold;
    padding: 3px 4px;
    border: 1px solid var(--ic-table-border, #333333);
}

.icosmo-app .results-panel td {
    padding: 3px 4px !important;
    border: 1px solid var(--ic-table-border, #333333) !important;
    color: var(--ic-input-text, #cccccc);
}

.icosmo-app .results-panel tr:nth-child(even) {
    background-color: var(--ic-table-stripe, #1f1f1f);
}

/* === DATA TABLES (class "icosmo-table") ===
   One table design for all Icosmo plugins, as the Icosmo Matrix tables.
   Works on any table with the class, also outside .icosmo-app. */
table.icosmo-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background-color: var(--ic-table-bg, #191919);
    font-size: inherit;
}

table.icosmo-table th,
table.icosmo-table td {
    padding: 4px 6px;
    text-align: left;
    vertical-align: middle;
    border: 1px solid var(--ic-table-border, #333333);
    color: var(--ic-text, #e0e0e0);
    font-size: 0.85em;
}

table.icosmo-table th {
    background-color: var(--ic-table-head, #262626);
    color: var(--ic-heading, #f0f0f0);
    font-weight: bold;
    text-transform: none;
    letter-spacing: normal;
}

table.icosmo-table tbody tr > td {
    background-color: var(--ic-table-bg, #191919);
}

table.icosmo-table tbody tr:nth-child(even) > td {
    background-color: var(--ic-table-stripe, #1f1f1f);
}

/* The whole row lights up on hover */
table.icosmo-table tbody tr:hover > td {
    background-color: var(--ic-table-hover, #2c2c2c);
}
