/* Brand palette taken from industel.co.uk: navy headings on a light grey page, with
   Raleway for headings and Open Sans for body text.

   --accent is set per folder as an inline style and inherited by everything inside it.
   Anything that should pick up a folder's colour reads from it, falling back to the brand
   navy when a folder has no colour of its own. */
:root {
    --industel-navy: #052670;
    --industel-navy-dark: #03184a;
    --industel-page: #f1f1f1;
    --accent: var(--industel-navy);

    --bs-link-color: #052670;
    --bs-link-hover-color: #03184a;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    background-color: var(--industel-page);
    font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6, .navbar-brand, .quick-panel-label {
    font-family: "Raleway", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 { color: var(--industel-navy); }

/* ---- Top bar --------------------------------------------------------------------- */

/* industel.co.uk puts its logo on a light background, and the logo itself is a navy disc,
   so a navy bar would swallow it. White bar, navy rule underneath, navy text. */
.site-header {
    background-color: #fff;
    border-bottom: 3px solid var(--industel-navy) !important;
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.site-header .navbar-brand,
.site-header .nav-link {
    color: var(--industel-navy);
}

.site-header .nav-link:hover { color: var(--industel-navy-dark); }

.navbar-brand { display: inline-flex; align-items: center; font-weight: 700; }

.site-logo {
    display: block;
    height: 2.75rem;
    width: auto;
    max-width: 18rem;
    object-fit: contain;
}

.btn-primary {
    --bs-btn-bg: var(--industel-navy);
    --bs-btn-border-color: var(--industel-navy);
    --bs-btn-hover-bg: var(--industel-navy-dark);
    --bs-btn-hover-border-color: var(--industel-navy-dark);
    --bs-btn-active-bg: var(--industel-navy-dark);
    --bs-btn-active-border-color: var(--industel-navy-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--industel-navy);
    --bs-btn-border-color: var(--industel-navy);
    --bs-btn-hover-bg: var(--industel-navy);
    --bs-btn-hover-border-color: var(--industel-navy);
}

/* ---- Folder tabs ---------------------------------------------------------------- */

.folder-tabs .nav-link {
    border-top-left-radius: .5rem;
    border-top-right-radius: .5rem;
    color: #55606b;
    background: #eceff2;
    border-color: #dee2e6;
    margin-right: 2px;
    display: flex;
    align-items: center;
    gap: .15rem;
}

.folder-tabs .nav-link:hover { background: #e2e6ea; }

.folder-tabs .nav-link.active {
    background: #fff;
    font-weight: 600;
    color: var(--accent);
    border-top: 3px solid var(--accent);
    padding-top: calc(.5rem - 2px);
}

.tab-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    display: inline-block;
    margin-right: .4rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15) inset;
}

/* ---- The folder surface: accent, gradient and optional background image ---------- */

/* The tile fills whatever is left of the window rather than stopping at its content, so a
   background reaches the bottom of the page even when the folder holds one file. */
.folder-surface {
    background-color: #fff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.folder-surface > .folder-veil {
    flex: 1 1 auto;
}

/* An uploaded image is unpredictable, so the content gets a fairly opaque sheet over it.
   A gradient is smooth and chosen by the user, so far less is needed. */
.folder-surface.has-image > .folder-veil {
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(2px);
}

 /* A gradient is smooth and deliberately chosen, so barely veil it — the point is to see it.
    Readability comes from the panels below and, on a dark gradient, from .backdrop-dark. */
.folder-surface.has-gradient:not(.has-image) > .folder-veil {
    background: rgba(255, 255, 255, .06);
}

/* Text sitting directly on a dark gradient, with nothing white behind it.
   These selectors name those elements one by one on purpose: a blanket
   `.backdrop-dark .text-muted` also hits the white panels (tables, the upload zone, the
   share links list) and turns their text and outline buttons invisible. */
.folder-surface.backdrop-dark .folder-heading,
.folder-surface.backdrop-dark .folder-heading h4 {
    color: #fff;
}

.folder-surface.backdrop-dark .folder-summary,
.folder-surface.backdrop-dark > .folder-veil > nav .breadcrumb-item,
.folder-surface.backdrop-dark > .folder-veil > nav .breadcrumb-item.active,
.folder-surface.backdrop-dark > .folder-veil > nav .breadcrumb-item + .breadcrumb-item::before,
.folder-surface.backdrop-dark > .folder-veil > div nav .breadcrumb-item,
.folder-surface.backdrop-dark > .folder-veil > div nav .breadcrumb-item.active,
.folder-surface.backdrop-dark > .folder-veil > div nav .breadcrumb-item + .breadcrumb-item::before {
    /* !important because Bootstrap's .text-muted utility carries it too. */
    color: rgba(255, 255, 255, .85) !important;
}

.folder-surface.backdrop-dark .breadcrumb-item a { color: rgba(255, 255, 255, .9) !important; }

/* Only the toolbar beside the heading sits on the backdrop; every other outline button
   is inside a light panel and must keep its normal colours. */
.folder-surface.backdrop-dark .folder-toolbar .btn-outline-secondary {
    color: rgba(255, 255, 255, .9);
    border-color: rgba(255, 255, 255, .5);
}

.folder-surface.backdrop-dark .folder-toolbar .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

/* The empty-state panel should fill the page the same way a folder tile does. */
.empty-state {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---- Company logo in place of the page title ------------------------------------ */

.folder-logo {
    display: block;
    max-height: 3.5rem;
    max-width: min(100%, 22rem);
    width: auto;
    object-fit: contain;
}

.logo-preview {
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    padding: .5rem;
    background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 12px 12px;
}

.logo-preview img {
    display: block;
    max-height: 3rem;
    max-width: 100%;
    object-fit: contain;
}

/* ---- Collapsible share links panel ---------------------------------------------- */

.share-panel {
    display: block;
    border: 1px solid rgba(0, 0, 0, .1);
    border-left: 4px solid var(--accent);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .92);
    overflow: hidden;
}

.share-panel-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: .55rem .8rem;
    border: 0;
    background: transparent;
    color: #212529;
    text-align: left;
}

.share-panel-toggle:hover { background: rgba(0, 0, 0, .04); }

.share-panel-toggle .toggle-chevron { transition: transform .15s ease; }

.share-panel-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(180deg); }

.share-panel-body {
    padding: .6rem .8rem;
    border-top: 1px solid rgba(0, 0, 0, .08);
}

/* Inside the panel everything sits on a light background, whatever the backdrop, so the
   ordinary muted grey is what we want and is left alone. */
.share-panel { color: #212529; }

.gradient-preview {
    width: 6rem;
    height: calc(1.5em + .5rem + 2px);   /* matches the height of the small select beside it */
    border-radius: .375rem;
    border: 1px solid #dee2e6;
}

/* ---- Quick access panel --------------------------------------------------------- */

.quick-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    padding: .6rem .8rem;
    border: 1px solid rgba(0, 0, 0, .1);
    border-left: 4px solid var(--accent);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .92);
    color: #212529;
}

.quick-panel-label {
    font-weight: 600;
    font-size: .85rem;
    color: var(--accent);
    white-space: nowrap;
}

/* Horizontal row of buttons that wraps instead of overflowing on a narrow window. */
.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

/* A quick-access button is now just its label; the notes arrive as a hover tooltip. */
.quick-btn {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
}

.quick-btn:hover,
.quick-btn:focus {
    background: var(--accent);
    color: #fff;
    filter: brightness(1.12);
}

/* ---- File row actions ------------------------------------------------------------ */

/* The buttons and the delete form sit on one line; a plain inline layout let the form
   wrap onto its own row and made the action column two rows tall. */
.row-actions {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    white-space: nowrap;
}

.row-actions form { margin: 0; display: inline-flex; }

/* ---- Information icons ---------------------------------------------------------- */

.info-btn.as-icon {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    cursor: pointer;
    line-height: 1;
}

.info-btn.as-icon:hover { filter: brightness(1.3); }

/* Notes are plain text, so keep the author's line breaks. */
.info-body { white-space: pre-wrap; }

/* ---- Subfolders ----------------------------------------------------------------- */

.subfolder-card {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .8rem;
    border: 1px solid #dee2e6;
    border-left: 4px solid var(--accent);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .85);
    color: #212529;
    text-decoration: none;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.subfolder-card:hover {
    background: #fff;
    box-shadow: 0 .25rem .6rem rgba(0, 0, 0, .1);
    transform: translateY(-1px);
    color: var(--accent);
}

.subfolder-card .bi-folder-fill { color: var(--accent); font-size: 1.15rem; }

.subfolder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Upload dropzone ------------------------------------------------------------ */

.dropzone {
    border: 2px dashed #ced4da;
    border-radius: .75rem;
    background: rgba(251, 252, 253, .8);
    transition: background-color .15s ease, border-color .15s ease;
}

.dropzone.dragging {
    border-color: var(--accent);
    background: rgba(231, 241, 255, .95);
}

/* ---- Bits and pieces ------------------------------------------------------------ */

.share-url input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }

.background-preview {
    height: 7rem;
    border-radius: .5rem;
    border: 1px solid #dee2e6;
    background-size: cover;
    background-position: center;
}

.breadcrumb { margin-bottom: 0; }

.footer {
    white-space: nowrap;
    line-height: 60px;
    background: #fff;
    border-top-color: var(--industel-navy) !important;
}
