/* =========================================================================
   EventRent global styles
   Only things used on more than one page go here. Anything used on just
   one page goes in static/content-style/<page>-content.css.
   Mobile styles are in the section at the bottom of this file.
   ========================================================================= */


/* ---------- Theme colors ----------
   Light theme is the default. Dark theme overrides the same variables.
   Every color on the site should use one of these variables. */

:root {
    --bg: #f2f3f5;
    --panel: #ffffff;
    --text: #1d1f23;
    --muted: #6b7280;
    --border: #d4d7dd;
    --border-light: #e6e8ec;
    --input-bg: #ffffff;
    --link: #1a5fb4;
    --primary: #1a5fb4;
    --primary-text: #ffffff;
    --danger: #c01c28;
    --danger-text: #ffffff;
    --ok: #2e7d32;
    --topbar-bg: #22262e;
    --topbar-text: #e8eaed;
    --topbar-active: #3a404c;
    --row-hover: #f6f8fb;
    --flash-success-bg: #e3f4e5;
    --flash-success-text: #1e5e24;
    --flash-error-bg: #fbe4e6;
    --flash-error-text: #8a1c24;
    --flash-info-bg: #e4eefb;
    --flash-info-text: #1a4a8a;
}

[data-theme="dark"] {
    color-scheme: dark;   /* makes checkboxes, date pickers and scrollbars dark too */
    --bg: #16181c;
    --panel: #20232a;
    --text: #e4e6ea;
    --muted: #9aa1ad;
    --border: #3a3f49;
    --border-light: #2c3038;
    --input-bg: #181a1f;
    --link: #78aeed;
    --primary: #3584e4;
    --primary-text: #ffffff;
    --danger: #e5484d;
    --danger-text: #ffffff;
    --ok: #57b65f;
    --topbar-bg: #0f1114;
    --topbar-text: #e4e6ea;
    --topbar-active: #2a2e36;
    --row-hover: #262a32;
    --flash-success-bg: #1d3a22;
    --flash-success-text: #a8e2ae;
    --flash-error-bg: #452025;
    --flash-error-text: #f5b3b8;
    --flash-info-bg: #1d2f48;
    --flash-info-text: #a9c9f2;
}


/* ---------- Base ---------- */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--link);
}

h1 {
    font-size: 1.5rem;
    margin: 0.4rem 0 1rem;
}

h2 {
    font-size: 1.15rem;
    margin: 1.2rem 0 0.6rem;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.95em;
}

.muted {
    color: var(--muted);
}

/* Page content uses about 95% of the screen width. */
.page {
    width: 95%;
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.breadcrumb {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}


/* ---------- Top bar and navigation ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    padding: 0 2.5%;
    min-height: 50px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--topbar-text);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    white-space: nowrap;
}

.brand img {
    height: 32px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.nav a,
.nav-logout button {
    color: var(--topbar-text);
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

.nav a:hover,
.nav a.active,
.nav-logout button:hover {
    background: var(--topbar-active);
}

.nav-spacer {
    flex: 1;
}

.nav-logout {
    margin: 0;
}

.nav-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--topbar-active);
    color: var(--topbar-text);
    font-size: 1.3rem;
    padding: 0.1rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
}


/* ---------- Flash messages ---------- */

.flashes {
    margin-bottom: 1rem;
}

.flash {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    border-radius: 5px;
    margin-bottom: 0.4rem;
}

.flash-success { background: var(--flash-success-bg); color: var(--flash-success-text); }
.flash-error   { background: var(--flash-error-bg);   color: var(--flash-error-text); }
.flash-info,
.flash-message { background: var(--flash-info-bg);    color: var(--flash-info-text); }

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}


/* ---------- Forms ---------- */

.form label {
    display: block;
    font-weight: 600;
    margin: 0.8rem 0 0.25rem;
}

.form fieldset {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.45rem 0.55rem;
    font: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

fieldset:disabled input,
fieldset:disabled select,
fieldset:disabled textarea {
    opacity: 0.75;
}

.form .checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-weight: normal;
    margin: 0.35rem 0;
    cursor: pointer;
}

.checkbox input {
    margin-top: 0.2rem;
}

.checkbox small {
    display: block;
    color: var(--muted);
}

.checkbox.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row > div {
    flex: 1;
    min-width: 0;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.static-value {
    margin: 0;
    padding: 0.2rem 0;
}

/* Role checkboxes (user edit and invite codes pages) */
.role-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.2rem 1rem;
}


/* ---------- Buttons ---------- */

.button {
    display: inline-block;
    padding: 0.45rem 1rem;
    font: inherit;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover {
    border-color: var(--muted);
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
}

.button-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--danger-text);
}

.button-small {
    padding: 0.2rem 0.6rem;
    font-size: 0.9rem;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.9rem;
    color: var(--link);
    cursor: pointer;
    text-decoration: underline;
}

.link-button.danger {
    color: var(--danger);
}

.danger-zone {
    margin: 1rem 0;
}


/* ---------- Tables ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.table th {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--row-hover);
}

.row-muted td {
    color: var(--muted);
}

.filter-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}

.filter-tabs a {
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid transparent;
}

.filter-tabs a.active {
    border-color: var(--border);
    background: var(--panel);
    color: var(--text);
}


/* ---------- Pills (statuses) ---------- */

.pill {
    display: inline-block;
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.pill-ok {
    background: var(--flash-success-bg);
    color: var(--flash-success-text);
}

.pill-off {
    background: var(--border-light);
    color: var(--muted);
}


/* ---------- Login / register box ---------- */

.auth-box {
    max-width: 380px;
    margin: 3rem auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem 1.8rem;
}

.auth-box h1 {
    text-align: center;
}

.auth-box .button {
    width: 100%;
    margin-top: 1rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 0;
}


/* ---------- Audit log (collapsed by default) ---------- */

.audit-log {
    margin-top: 1.5rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 1rem;
}

.audit-log summary {
    cursor: pointer;
    font-weight: 600;
}

.audit-table {
    margin-top: 0.6rem;
    border: none;
}

.audit-changes {
    margin: 0;
    padding-left: 1.1rem;
}

.audit-old {
    color: var(--muted);
    text-decoration: line-through;
}


/* =========================================================================
   MOBILE (screens 960px wide or less)
   ========================================================================= */

@media (max-width: 960px) {

    .page {
        width: 96%;
    }

    /* Navigation collapses behind the menu button. */
    .topbar {
        flex-wrap: wrap;
        gap: 0;
        padding: 0.4rem 3%;
    }

    .nav-toggle {
        display: block;
    }

    .nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        padding: 0.4rem 0;
    }

    .nav.open {
        display: flex;
    }

    .nav-spacer {
        display: none;
    }

    .nav-logout button {
        width: 100%;
        text-align: left;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Tables with class "stack-on-mobile": each row becomes a block with
       every field labeled, so no information is hidden.
       Each <td> needs a data-label="Column name". */
    .stack-on-mobile thead {
        display: none;
    }

    .stack-on-mobile,
    .stack-on-mobile tbody,
    .stack-on-mobile tr,
    .stack-on-mobile td {
        display: block;
        width: 100%;
    }

    .stack-on-mobile tr {
        border-bottom: 1px solid var(--border);
        padding: 0.4rem 0;
    }

    .stack-on-mobile td {
        border: none;
        padding: 0.2rem 0.6rem;
    }

    .stack-on-mobile td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--muted);
    }

    .audit-table thead {
        display: none;
    }

    .audit-table tr,
    .audit-table td {
        display: block;
    }

    .audit-table td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--muted);
    }

    .auth-box {
        margin: 1.5rem auto;
        padding: 1.2rem;
    }
}
