﻿/* =============================================================================
   Ui design variants - configured per area in the option main data.

   Each area brings its own option and renders data-mc-design onto its own
   container; for "default" no attribute is rendered at all, so this file is
   inert unless card or round is configured somewhere.

     page list (tab strip)   AppRendering_PageListDesign
                             AppRendering_PageListAccentColor
                             -> Controls/Desktop/PageListContainer.razor
     further areas (action tiles, panels, ...) get their own options and their
     own section here, using the same three values default | card | round.

   Convention (see TelerikAdaptions.css): colours belong to MedCubesTheme.css,
   telerik properties to TelerikAdaptions.css. Everything here is first-party
   McDesktopView / McAppContainer chrome.

   Must be loaded LAST, after all vendor stylesheets. No @layer - unlayered
   vendor css would win.

   -----------------------------------------------------------------------------
   GEOMETRY RULE - please read before adding anything
   Safe: colour, border-colour, border-radius, box-shadow, font-weight, opacity.
   NOT safe: gap, padding, width, height, min-*, and any border that ADDS width.
   The layout grid is calculated in C# (RazorHelper.GRID_GAP = 2 plus a matching
   calc()) and the tab strip sits in a fixed 44px row
   (.McDesktopView-LayoutRoot-ContentGrid, grid-row 3) whose content height is
   auto - so box-sizing:border-box does NOT absorb a border there, it grows the
   row. Frames are therefore drawn as inset box-shadow, which costs no layout
   space; the only border touched is the existing 1px left/right, and it is
   removed, never added.
============================================================================= */


/* Neutral tokens - same names and values as the full token file, so this block
   can simply be deleted once that one is in place. The accent colours are NOT
   defined here: they are configurable and arrive as --mc-pagelist-accent* on
   the container (see below).                                                 */
:root {
    --mc-n-0: #ffffff;
    --mc-n-25: #f8fafb;
    --mc-n-50: #f1f4f6;
    --mc-n-200: #d6dce2;
    --mc-n-500: #6b7885;
    --mc-n-800: #2a313a;

    --mc-surface: var(--mc-n-0);
    --mc-surface-subtle: var(--mc-n-25);
    --mc-surface-hover: var(--mc-n-50);
    --mc-border: var(--mc-n-200);

    --mc-text: var(--mc-n-800);
    --mc-text-muted: var(--mc-n-500);

    --mc-fw-semi: 600;
    --mc-radius-tab: 8px;
    --mc-radius-pill: 999px;
    --mc-statusbar-w: 3px;
}


/* =============================================================================
   PAGE LIST (tab strip)  -  .McDesktopView-PageListContainer-btn[-selected]
   rendered by Controls/Desktop/PageListContainer.razor

   The accent colour comes from the option AppRendering_PageListAccentColor.
   ClientGlobals.UiDesign.PageList (class UiAreaDesign) carries it plus two
   colours derived from it in C# and writes all three as inline custom
   properties onto the .btn-group - see UiAreaDesign.AppendCssVariables:

     --mc-pagelist-accent          the configured colour
     --mc-pagelist-accent-text     black or white, whichever stays readable on it
     --mc-pagelist-accent-subtle   the same colour mixed 88% into white, for hover

   The fallbacks below keep the strip sane if the attribute is set by hand (for
   instance while testing in the browser console) without the variables.

   border-radius and margin need !important: bootstrap's button group collapses
   the radii of every tab but the first and last
   (.btn-group>.btn:not(:last-child):not(.dropdown-toggle) - four classes) and
   overlaps the tabs with margin-left:-1px. Everything else wins on specificity
   alone, [data-mc-design="..."] .McDesktopView-PageListContainer-btn being two
   classes against one in DesktopViewStyles.css.

   background-color deliberately has NO !important: with the option
   Framework_CustomPageHeaderBackground every page can carry its own colour as
   an inline style (PageListContainer.razor), and that configured colour has to
   keep winning.
============================================================================= */

[data-mc-design="card"],
[data-mc-design="round"] {
    /* Space between two tabs. It replaces the 1px left/right border that is
       removed below, so a tab is exactly as wide as before; what is left over
       is bootstrap's -1px overlap, i.e. about 1px per tab. Set to 0px if the
       strip ever starts to scroll - the HorizontalListBox then shows its
       chevrons, nothing gets truncated. */
    --mc-tab-gap: 1px;
}


/* --- card: file cards ------------------------------------------------------
   Upper corners rounded, no bottom edge, so the selected tab merges into the
   content below it. The selected tab is marked by an accent edge along its
   top, which stays visible even when the page carries its own colour.       */

[data-mc-design="card"] .McDesktopView-PageListContainer-btn,
[data-mc-design="card"] .McDesktopView-PageListContainer-btn-selected {
    margin: 0 var(--mc-tab-gap) !important;
    border-radius: var(--mc-radius-tab) var(--mc-radius-tab) 0px 0px !important;
    border: 0;
    background-color: var(--mc-surface-subtle);
    color: var(--mc-text-muted);
    opacity: 1;
    box-shadow: inset 0 1px 0 0 var(--mc-border), inset 1px 0 0 0 var(--mc-border), inset -1px 0 0 0 var(--mc-border);
}

[data-mc-design="card"] .McDesktopView-PageListContainer-btn:hover:enabled {
    background-color: var(--mc-pagelist-accent-subtle, var(--mc-surface-hover));
    color: var(--mc-text);
    opacity: 1;
}

/* The accent edge takes the place of the top frame line. */
[data-mc-design="card"] .McDesktopView-PageListContainer-btn-selected,
[data-mc-design="card"] .McDesktopView-PageListContainer-btn-selected:hover:enabled {
    background-color: var(--mc-surface);
    color: var(--mc-text);
    font-weight: var(--mc-fw-semi);
    opacity: 1;
    box-shadow: inset 0 var(--mc-statusbar-w) 0 0 var(--mc-pagelist-accent, var(--mc-text)), inset 1px 0 0 0 var(--mc-border), inset -1px 0 0 0 var(--mc-border);
}


/* --- round: pills ----------------------------------------------------------
   Fully rounded, ring as inset shadow, a fine drop shadow underneath.       */

[data-mc-design="round"] .McDesktopView-PageListContainer-btn,
[data-mc-design="round"] .McDesktopView-PageListContainer-btn-selected {
    margin: 0 var(--mc-tab-gap) !important;
    border-radius: var(--mc-radius-pill) !important;
    border: 0;
    background-color: var(--mc-surface);
    color: var(--mc-text);
    opacity: 1;
    box-shadow: inset 0 0 0 1px var(--mc-border), 0 1px 2px rgba(23, 28, 34, .06);
}

[data-mc-design="round"] .McDesktopView-PageListContainer-btn:hover:enabled {
    background-color: var(--mc-pagelist-accent-subtle, var(--mc-surface-hover));
    opacity: 1;
    box-shadow: inset 0 0 0 1px var(--mc-pagelist-accent, var(--mc-border)), 0 1px 2px rgba(23, 28, 34, .06);
}

/* Selected: accent ring and bold - readable no matter which background wins. */
[data-mc-design="round"] .McDesktopView-PageListContainer-btn-selected,
[data-mc-design="round"] .McDesktopView-PageListContainer-btn-selected:hover:enabled {
    font-weight: var(--mc-fw-semi);
    opacity: 1;
    box-shadow: inset 0 0 0 2px var(--mc-pagelist-accent, var(--mc-text));
}

/* The filled accent pill - only where the page does NOT bring its own colour.
   PageListContainer.razor writes "background-color:" into the inline style
   exactly then, and the derived text colour would otherwise end up on a
   configured colour it was not computed for. */
[data-mc-design="round"] .McDesktopView-PageListContainer-btn-selected:not([style*="background-color"]),
[data-mc-design="round"] .McDesktopView-PageListContainer-btn-selected:not([style*="background-color"]):hover:enabled {
    background-color: var(--mc-pagelist-accent, var(--mc-surface));
    color: var(--mc-pagelist-accent-text, var(--mc-text));
}

/* =============================================================================
   ACTION TILES  -  .TileControl, rendered by Controls/Tile/McTileControl.razor

   Only the round variant exists here; there is no card design for tiles.
   Only the shape changes here, the colour stays whatever the tile brings.

   GEOMETRY RULE: tiles are sized by inline style (73x73, 150x73, 47x23, 75x75)
   and sit in height:100% containers, so no border, no gap, no padding. Corners
   and the hover lift cost no layout space; overflow:hidden already comes from
   ActionTileStyles.css, so the radius clips the content on its own.
============================================================================= */

.TileControl[data-mc-design="round"] {
    border-radius: 6px;
    transition: box-shadow .14s ease, background-color .14s ease;
}

.TileControl[data-mc-design="round"]:hover:enabled {
    box-shadow: 0 3px 10px rgba(23, 28, 34, .16);
}
