@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&family=Source+Sans+3:wght@600;700;900&display=swap');

/*
    Massively-inspired site theme
    Designed as a drop-in replacement for the original Site.css.
*/

:root {
    --page-bg: #212931;
    --page-bg-deep: #1e252d;
    --surface: #ffffff;
    --surface-muted: #f5f5f5;
    --text: #212931;
    --text-muted: #717981;
    --border: #eeeeee;
    --border-dark: #d8d8d8;
    --accent: #18bfef;
    --accent-dark: #149ac2;
    --nav-bg: rgba(255, 255, 255, 0.175);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        linear-gradient(rgba(33, 41, 49, 0.88), rgba(33, 41, 49, 0.96)),
        radial-gradient(circle at top, #4a5560 0, #212931 48%, #1e252d 100%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1rem;
    font-weight: 300;
    line-height: 2.15;
    min-height: 100vh;
}

body,
input,
select,
textarea,
button {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    border-bottom: 1px dotted currentColor;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--accent);
    border-bottom-color: transparent;
}

strong,
b {
    font-weight: 700;
}

p {
    margin: 0 0 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar,
.btn,
button,
input[type='submit'],
input[type='button'],
input[type='reset'],
label,
th {
    font-family: 'Source Sans 3', Arial, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1.25;
    margin: 0 0 1rem;
    text-transform: uppercase;
}

h1 { font-size: clamp(2.5rem, 7vw, 5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.8rem; }

hr {
    border: 0;
    border-top: 2px solid var(--border);
    margin: 3rem 0;
}

img {
    max-width: 100%;
    height: auto;
}

/* Main page container */
.body-content {
    width: min(100% - 2rem, 1180px);
    margin: 5rem auto 3rem;
    padding: clamp(2rem, 5vw, 5rem);
    background: var(--surface);
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.22);
}

/* Optional hero/header area */
.jumbotron,
.hero,
.page-header {
    margin: 0 0 4rem;
    padding: clamp(3rem, 8vw, 7rem) 1rem;
    background: transparent;
    border: 0;
    color: #fff;
    text-align: center;
}

.jumbotron h1,
.hero h1,
.page-header h1,
.jumbotron h2,
.hero h2,
.page-header h2 {
    color: #fff;
}

.jumbotron p,
.hero p,
.page-header p {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    font-style: italic;
}

/* Bootstrap-style navbar, restyled */
.navbar {
    width: min(100% - 2rem, 1180px);
    min-height: 4rem;
    margin: 2rem auto 0;
    border: 0;
    border-radius: 0;
    background: var(--nav-bg);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    font-weight: 900;
}

.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a,
.navbar-brand,
.navbar-nav > li > a {
    color: #fff !important;
    border-bottom: 0;
}

.navbar-brand {
    font-weight: 900;
    letter-spacing: 0.12em;
}

.navbar-inverse .navbar-nav > li > a,
.navbar-nav > li > a {
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
}

.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus,
.navbar-nav > .active > a,
.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus {
    background: #fff !important;
    color: var(--text) !important;
}

.navbar-toggle {
    border-color: rgba(255,255,255,.45) !important;
}

/* Account links on the right: wrap so the (often long) email/username never has to
   share a row with "My Profile"/"Log off" - it gets its own line, they wrap beneath
   it, at any width, not just the collapsed mobile menu. */
.account-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.account-name-item {
    flex-basis: 100%;
    text-align: right;
}

/* Buttons */
.btn,
button,
input[type='submit'],
input[type='button'],
input[type='reset'] {
    display: inline-block;
    min-height: 3rem;
    padding: 0 1.75rem;
    border: 2px solid var(--text);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 2.75rem;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.btn:hover,
.btn:focus,
button:hover,
button:focus,
input[type='submit']:hover,
input[type='submit']:focus,
input[type='button']:hover,
input[type='button']:focus,
input[type='reset']:hover,
input[type='reset']:focus {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
    outline: 0;
}

.btn-primary,
.btn-success,
.btn-info {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

/* .btn-sm is used throughout the app (Gallery, Users, TableData) but was never
   actually styled, so every "small" button was rendering at full size - that's what
   let Cancel overflow its container next to Delete Folder. */
.btn-sm {
    min-height: 2.25rem;
    padding: 0 1rem;
    font-size: .72rem;
    line-height: 2rem;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus,
.btn-info:hover,
.btn-info:focus {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Forms */
label {
    display: block;
    margin: 0 0 .6rem;
    color: var(--text);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    max-width: none;
    border: 1px solid var(--border-dark);
    border-radius: 0;
    background: #fff;
    color: var(--text);
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1rem;
    outline: 0;
    box-shadow: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input,
select,
.form-control {
    min-height: 3rem;
    padding: .65rem .8rem;
}

textarea,
textarea.form-control {
    min-height: 8rem;
    padding: .8rem;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Password field with an eye-icon toggle overlaid on the right of the input,
   styled after https://foolishdeveloper.com/show-hide-password-toggle-javascript/ */
.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: .5rem;
    width: 1.75rem;
    height: 1.75rem;
    min-height: auto;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus {
    border: 0;
    background: transparent;
    outline: 0;
}

/* Active state (password currently visible) mirrors the reference: the eye
   icon switches from muted gray to the site accent color. */
.password-toggle-btn.is-active {
    color: var(--accent);
}

/* Tables */
table,
.table {
    width: 100%;
    margin: 0 0 2rem;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
}

table th,
table td,
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    padding: .85rem 1rem;
    border: 0;
    border-bottom: 1px solid var(--border-dark);
    text-align: left;
    vertical-align: middle;
}

table th,
.table > thead > tr > th {
    color: var(--text);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

table tbody tr:nth-child(odd),
.table-striped > tbody > tr:nth-of-type(odd) {
    background: rgba(220, 220, 220, 0.22);
}

/* Lets a wide table scroll horizontally within its own bounds instead of
   overflowing past the page's content area. */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Caps a tall table to a set height, scrolling vertically within its own
   bounds instead of pushing the rest of the page down. */
.table-scroll {
    height: 65vh;
    overflow-y: auto;
}

.table-scroll table tr:first-child th,
.table-scroll table tr:first-child td {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-muted);
}

.gridview-pager-external {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.gridview-pager-info {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.gridview-filter-btn {
    width: auto;
    min-height: auto;
    padding: .4rem 1rem;
    font-size: .72rem;
    line-height: 1.4;
}

/* Sort link + filter box stacked inside each column header cell. */
.gv-sort-link {
    display: block;
    margin-bottom: .4rem;
    border-bottom: 0;
    white-space: nowrap;
}

.gv-filter-input {
    min-height: 2rem;
    width: 100%;
    min-width: 6rem;
    padding: .3rem .5rem;
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

/* Panels/cards */
.panel,
.card,
.well {
    margin-bottom: 2rem;
    border: 1px solid var(--border-dark);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.panel-heading,
.card-header {
    padding: 1rem 1.25rem;
    border: 0;
    border-bottom: 1px solid var(--border-dark);
    border-radius: 0;
    background: var(--surface-muted) !important;
    color: var(--text) !important;
    font-family: 'Source Sans 3', Arial, sans-serif;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.panel-body,
.card-body,
.well {
    padding: 1.5rem;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin: 0 0 2rem;
}

/* Marks the Upload card as a drop target - dropping actually works anywhere on the
   page (see galleryDropOverlay), this is just the persistent visual cue for it. */
.upload-dropzone {
    border: 2px dashed var(--accent);
    background: rgba(24, 191, 239, 0.05);
}

.upload-dropzone-hint {
    margin: -.25rem 0 .75rem;
    font-size: .82rem;
}

.folder-select-row {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.folder-select-row .form-select {
    flex: 1;
}

.folder-delete-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 900;
    font-size: 1.1rem;
    line-height: 1;
}

.folder-delete-btn:hover,
.folder-delete-btn:focus {
    border-color: #e44;
    color: #e44;
}

.folder-delete-confirm {
    margin-top: .6rem;
    padding: .75rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    background: var(--surface-muted);
}

.folder-delete-warning {
    margin: 0 0 .6rem;
    font-size: .82rem;
    font-weight: 700;
    color: #c0392b;
}

.folder-delete-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .5rem;
}

.folder-delete-confirm-actions .btn {
    flex: 1 1 auto;
    white-space: normal;
}

.gallery-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
}

.gallery-select-all {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.gallery-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.gallery-toolbar-btn {
    width: auto;
    min-height: auto;
    padding: .4rem 1rem;
    font-size: .72rem;
    line-height: 1.4;
}

.gallery-item {
    position: relative;
    border: 1px solid var(--border-dark);
    background: #fff;
}

.gallery-item-select {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 1;
    margin: 0;
    padding: .2rem;
    background: transparent;
}

/* Plain <input type="checkbox" class="gallery-select">, used identically for
   server-rendered items and photos appended client-side via infinite scroll. */
.gallery-select,
.gallery-select-all-toggle {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    display: inline-block;
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
    min-height: 1.15rem;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
}

.gallery-select {
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.gallery-select-all-toggle {
    border: 2px solid var(--text);
}

.gallery-select:checked,
.gallery-select-all-toggle:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    cursor: zoom-in;
}

.gallery-item-caption {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
    padding: .6rem .75rem;
    border-top: 1px solid var(--border);
}

.gallery-item-name {
    overflow: hidden;
    max-width: 100%;
    font-size: .8rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gallery-item-delete {
    min-height: auto;
    padding: .3rem .8rem;
    font-size: .68rem;
    line-height: 1.4;
}

.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.5);
}

.gallery-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 191, 239, 0.15);
    border: 4px dashed var(--accent);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.gallery-drop-overlay.active {
    opacity: 1;
}

.gallery-drop-message {
    background: #fff;
    color: #212529;
    padding: 1rem 2rem;
    border-radius: .5rem;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, 0.25);
}

/* Alerts */
.alert {
    border: 0;
    border-left: 4px solid var(--text);
    border-radius: 0;
}

.alert-info { border-left-color: var(--accent);
    top: 0px;
    left: 1px;
}
.alert-success { border-left-color: #3c9; }
.alert-warning { border-left-color: #e5aa28; }
.alert-danger { border-left-color: #e44; }

/* Pagination */
.pagination > li > a,
.pagination > li > span {
    border-radius: 0 !important;
    border-color: var(--border-dark);
    color: var(--text);
    font-family: 'Source Sans 3', Arial, sans-serif;
    font-weight: 700;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

/* Useful Massively-style content helpers */
.featured-title,
.section-title {
    margin-bottom: 2.5rem;
    text-align: center;
}

.meta,
.date,
.small,
small {
    color: var(--text-muted);
    font-size: .8rem;
}

blockquote {
    margin: 0 0 2rem;
    padding: .5rem 0 .5rem 1.5rem;
    border-left: 4px solid var(--border-dark);
    color: var(--text-muted);
    font-style: italic;
}

code,
pre {
    border-radius: 0;
}

footer,
.footer {
    width: min(100% - 2rem, 1180px);
    margin: 0 auto 3rem;
    padding: 2rem;
    color: rgba(255,255,255,.7);
    font-size: .8rem;
    text-align: center;
}

footer a,
.footer a {
    color: rgba(255,255,255,.85);
}

/* Responsive */
@media screen and (max-width: 991px) {
    .body-content {
        margin-top: 2rem;
        padding: 2.5rem;
    }
}

@media screen and (max-width: 767px) {
    body {
        font-size: .95rem;
        line-height: 1.9;
    }

    .navbar {
        width: 100%;
        margin-top: 0;
        background: var(--page-bg-deep);
    }

    .navbar-inverse .navbar-nav > .active > a,
    .navbar-inverse .navbar-nav > li > a:hover,
    .navbar-inverse .navbar-nav > li > a:focus {
        background: rgba(255,255,255,.08) !important;
        color: #fff !important;
    }

    /* In the collapsed mobile menu everything stacks in one column, so the
       email should line up with Home/Gallery instead of staying right-aligned
       (a leftover from the wide-screen layout), and "My Profile"/"Log off"
       are indented under it to read as belonging to that account row. */
    .account-name-item {
        text-align: left;
    }

    .account-sub-item .nav-link {
        padding-left: 2rem;
    }

    .body-content {
        width: 100%;
        margin: 0;
        padding: 2rem 1.25rem;
        box-shadow: none;
    }

    .jumbotron,
    .hero,
    .page-header {
        padding: 3rem 0;
    }

    .btn,
    button,
    input[type='submit'],
    input[type='button'],
    input[type='reset'] {
        max-width: 100%;
    }

    table,
    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Tables that opt in to a stacked, card-per-row layout instead of
       horizontal scrolling, so every column stays visible on narrow screens. */
    .stack-table {
        display: block;
        overflow-x: visible;
        white-space: normal;
    }

    .stack-table thead {
        display: none;
    }

    /* ASP.NET's GridView renders a flat <table> with no <thead>; its header
       row is just the first <tr>, containing <th> cells. */
    .stack-table tr:first-child {
        display: none;
    }

    .stack-table tbody,
    .stack-table tr,
    .stack-table td {
        display: block;
        width: 100%;
    }

    .stack-table tr {
        margin-bottom: 1.25rem;
        border: 1px solid var(--border-dark);
    }

    .stack-table td {
        border: 0;
        border-bottom: 1px solid var(--border);
        padding: .6rem 1rem;
        text-align: left;
        white-space: normal;
        word-break: break-word;
    }

    .stack-table td:last-child {
        border-bottom: 0;
    }

    .stack-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .2rem;
        color: var(--text-muted);
        font-size: .78rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    /* These are sized tight for desktop density; on touch screens they're well
       under the ~44px target size that's comfortable to tap accurately. */
    .gallery-select,
    .gallery-select-all-toggle {
        width: 1.6rem;
        height: 1.6rem;
        min-width: 1.6rem;
        min-height: 1.6rem;
    }

    .gallery-item-select {
        padding: .35rem;
    }

    .gallery-toolbar-btn,
    .gallery-item-delete,
    .gridview-filter-btn {
        min-height: 2.75rem;
        padding: .5rem 1.1rem;
        font-size: .78rem;
    }
}
