:root {
    --vots-primary: #1b3a6b;
    --vots-primary-dark: #142c52;
    --vots-accent: #2c7be5;
    --vots-sidebar-w: 250px;
    --vots-bg: #f4f6f9;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--vots-bg);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: #2b2f38;
}

.vots-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.vots-sidebar {
    width: var(--vots-sidebar-w);
    background: var(--vots-primary);
    color: #cfe0f5;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left .2s ease;
}
.vots-brand {
    display: flex; align-items: center; gap: .5rem;
    padding: 1rem 1.1rem;
    font-size: 1.05rem; font-weight: 600; color: #fff;
    background: var(--vots-primary-dark);
    position: sticky; top: 0;
}
.vots-brand i { font-size: 1.3rem; }
.vots-nav { padding: .5rem 0 2rem; }
.vots-nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem 1.1rem;
    color: #cfe0f5; text-decoration: none;
    font-size: .9rem;
}
.vots-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.vots-nav a.active { background: var(--vots-accent); color: #fff; }
.vots-nav-group {
    padding: .9rem 1.1rem .3rem;
    text-transform: uppercase; font-size: .7rem; letter-spacing: .06em;
    color: #7ea3d6;
}
body.vots-collapsed .vots-sidebar { margin-left: calc(-1 * var(--vots-sidebar-w)); }

/* Main */
.vots-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vots-topbar {
    display: flex; align-items: center; gap: 1rem;
    background: #fff; padding: .6rem 1rem;
    border-bottom: 1px solid #e3e7ef;
    position: sticky; top: 0; z-index: 20;
}
.vots-page-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.vots-user { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.vots-user i { font-size: 1.2rem; color: var(--vots-primary); }
.vots-content { padding: 1.1rem; flex: 1; }

/* Cards / panels */
.vots-card {
    background: #fff; border: 1px solid #e3e7ef; border-radius: .5rem;
    padding: 1rem; margin-bottom: 1rem;
}
.vots-card-title { font-weight: 600; margin-bottom: .8rem; font-size: 1rem; }

/* Toolbar above grids */
.vots-toolbar {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
    margin-bottom: .8rem;
}
.vots-toolbar .spacer { flex: 1; }

/* Data grid */
.vots-grid { width: 100%; }
.vots-grid table { width: 100%; }
.vots-grid th { white-space: nowrap; background: #eef2f8; }
.vots-grid td { vertical-align: middle; }

/* Alerts host */
.vots-alert-host {
    position: fixed; top: 1rem; right: 1rem; z-index: 1080;
    display: flex; flex-direction: column; gap: .5rem; max-width: 360px;
}

/* Login */
.vots-login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--vots-primary), var(--vots-accent));
    padding: 1rem;
}
.vots-login-card {
    background: #fff; border-radius: .75rem; padding: 2rem;
    width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.vots-login-card h1 { font-size: 1.35rem; text-align: center; margin-bottom: 1.3rem; color: var(--vots-primary); }

@media (max-width: 768px) {
    .vots-sidebar { position: fixed; z-index: 40; margin-left: calc(-1 * var(--vots-sidebar-w)); }
    body.vots-show-sidebar .vots-sidebar { margin-left: 0; }
}


/* =========================================================================
   Real-time notifications: red popup ("Message" dialog) + scrolling feed.
   Colors mirror the desktop: red = message/reject, green = trade,
   gray = order/modify, pink = delete.
   ========================================================================= */

/* Floating bell toggle */
.vots-notif-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--vots-primary);
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
    cursor: pointer;
    z-index: 1080;
}
.vots-notif-toggle:hover { background: var(--vots-primary-dark); }
.vots-notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #dc3545;
    color: #fff;
    font-size: .72rem;
    line-height: 20px;
    font-weight: 700;
}

/* Scrolling feed panel (bottom-right) */
.vots-notif-feed {
    position: fixed;
    right: 18px;
    bottom: 78px;
    width: 380px;
    max-width: calc(100vw - 36px);
    max-height: 60vh;
    background: #fff;
    border: 1px solid #d9dee6;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1080;
}
.vots-notif-feed.open { display: flex; }
.vots-notif-feed-head {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .75rem;
    background: var(--vots-primary);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
}
.vots-notif-feed-head > span:first-child { flex: 1; }
.vots-notif-conn {
    font-size: .68rem; font-weight: 600;
    padding: 1px 7px; border-radius: 8px;
    text-transform: uppercase; letter-spacing: .03em;
    background: #6c757d; color: #fff;
}
.vots-notif-conn.online { background: #198754; }
.vots-notif-conn.polling { background: #fd7e14; }
.vots-notif-conn.offline { background: #6c757d; }
.vots-notif-clear, .vots-notif-close {
    background: transparent; border: none; color: #fff; cursor: pointer;
    font-size: .8rem;
}
.vots-notif-close { font-size: 1.2rem; line-height: 1; }
.vots-notif-list { overflow-y: auto; padding: .4rem; background: #f7f8fa; }
.vots-notif-empty { color: #8a919e; text-align: center; padding: 1.2rem .5rem; font-size: .85rem; }

.vots-notif-item {
    border-left: 4px solid #dc3545;
    background: #fff;
    border-radius: 5px;
    padding: .45rem .6rem;
    margin-bottom: .4rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.vots-notif-item.c-red { border-left-color: #dc3545; background: #fff5f5; }
.vots-notif-item.c-green { border-left-color: #198754; background: #f2fbf6; }
.vots-notif-item.c-gray { border-left-color: #6c757d; background: #f6f7f9; }
.vots-notif-item.c-pink { border-left-color: #d63384; background: #fdf4f9; }
.vots-notif-item-head { display: flex; justify-content: space-between; align-items: baseline; }
.vots-notif-item-title { font-weight: 700; font-size: .85rem; }
.vots-notif-item-time { font-size: .72rem; color: #8a919e; }
.vots-notif-item-body { font-size: .82rem; color: #3a3f49; margin-top: .15rem; }

/* Red modal popup - the desktop "Message" dialog */
.vots-msg-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: none; align-items: center; justify-content: center;
    z-index: 1090;
}
.vots-msg-box {
    width: 440px; max-width: calc(100vw - 40px);
    background: #dc3545;                /* red like the desktop popup */
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,.4);
    overflow: hidden;
    border: 2px solid #fff;
}
.vots-msg-box.c-green { background: #198754; }
.vots-msg-box.c-gray { background: #495057; }
.vots-msg-box.c-pink { background: #ab296a; }
.vots-msg-title {
    padding: .55rem .9rem;
    font-weight: 700;
    background: rgba(0,0,0,.15);
    font-size: .95rem;
}
.vots-msg-body {
    padding: .9rem;
    font-size: .9rem;
    line-height: 1.4;
    max-height: 50vh;
    overflow-y: auto;
    word-break: break-word;
}
.vots-msg-foot { padding: .6rem .9rem; text-align: center; background: rgba(0,0,0,.08); }
.vots-msg-ok {
    min-width: 90px;
    padding: .35rem 1rem;
    border: 1px solid #fff;
    border-radius: 4px;
    background: #fff;
    color: #212529;
    font-weight: 600;
    cursor: pointer;
}
.vots-msg-ok:hover { background: #f1f1f1; }


/* =========================================================================
   Master Add/Edit form as a centered POPUP (applied globally).

   All Master pages render their add/edit form as <asp:Panel ID="pnlEdit"
   CssClass="vots-card">. Server code still just toggles its Visible flag; when
   it is present we render it as a centered modal (fixed position) with a
   backdrop, instead of a footer panel. Presentation only - no per-page markup
   or server changes, and the panel stays inside its UpdatePanel so partial
   postbacks (Save / validation) keep working.

   JS adds body.vots-modal-active when #pnlEdit exists, and toggles the
   #votsEditBackdrop element.
   ========================================================================= */

/* Dimmed backdrop shown behind the popup while editing. */
#votsEditBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: none;
    z-index: 1084;
}
body.vots-modal-active #votsEditBackdrop { display: block; }

/* Lift the in-place edit panel into a centered modal. It stays in its original
   DOM position (inside the UpdatePanel); only its visual box is repositioned. */
body.vots-modal-active #pnlEdit {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 720px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
    margin: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0,0,0,.35);
    z-index: 1085;
    animation: votsModalIn .15s ease-out;
}

@keyframes votsModalIn {
    from { transform: translate(-50%, -54%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

/* Give the panel a clear modal header look using its existing title element. */
body.vots-modal-active #pnlEdit .vots-card-title,
body.vots-modal-active #pnlEdit > h5:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .6rem;
    margin-bottom: .9rem;
    border-bottom: 1px solid #e6e9ef;
    font-size: 1.05rem;
    font-weight: 600;
}

/* Close (x) button injected by JS into the panel header. */
.vots-modal-x {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0 .25rem;
}
.vots-modal-x:hover { color: #212529; }
