/*
 * ViaVote shared styles
 *
 * Global application shell:
 * - top navigation
 * - shared typography
 * - buttons
 * - layout primitives
 * - common surfaces
 */


/* =========================================================
   Design tokens
   ========================================================= */

:root {
    --vv-text: #1f2937;
    --vv-muted: #6b7280;

    --vv-border: #dbe3ea;

    --vv-primary: #2563eb;
    --vv-primary-hover: #1d4ed8;

    --vv-surface: #ffffff;
    --vv-background: #f8fafc;

    --vv-radius: 10px;
}


/* =========================================================
   Global
   ========================================================= */

body {
    margin: 0;
    color: var(--vv-text);
    background: var(--vv-background);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


a {
    color: var(--vv-primary);
}


a:hover {
    color: var(--vv-primary-hover);
}


/* =========================================================
   Shared container
   ========================================================= */

.vv-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
}


/* =========================================================
   Top navigation
   ========================================================= */

.top-nav {
    height: 64px;
    background: var(--vv-surface);
    border-bottom: 1px solid var(--vv-border);
}


.top-nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-nav-context-toggle {
    display: grid;
    place-items: center;
    width: 30px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--vv-text);
    box-shadow: none;
}

.top-nav-context-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.top-nav-context-toggle:hover {
    border: 0;
    background: #f1f5f9;
}

.top-nav-context-toggle:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}


.top-nav-brand-link {
    display: inline-flex;
    align-items: center;
    color: var(--vv-text);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.top-nav-logo {
    display: block;
    width: auto;
    height: 27px;
}


.top-nav-brand-link:hover {
    color: var(--vv-text);
}


.top-nav-user {
    display: flex;
    align-items: center;
}


.top-nav-signin {
    color: var(--vv-muted);
    text-decoration: none;
}


.top-nav-signin:hover {
    color: var(--vv-text);
}


.user-menu {
    position: relative;
}

.user-menu-trigger {
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 8px 12px;

    color: var(--vv-text);
    font-size: 0.875rem;
    font-weight: 600;

    border-radius: 999px;
}

.user-menu-trigger:hover {
    background: #f8fafc;
    border-color: var(--vv-border);
    color: var(--vv-text);
}

.user-menu-caret {
    font-size: .8rem;
    color: var(--vv-muted);
}

.user-menu-dropdown {
    display: none;

    position: absolute;
    right: 0;
    top: calc(100% + 10px);

    min-width: 180px;

    background: white;
    border: 1px solid var(--vv-border);
    border-radius: 10px;

    box-shadow: 0 8px 20px rgba(0,0,0,.08);

    padding: 6px 0;

    z-index: 20;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.user-menu-dropdown a {
    display: block;

    padding: 9px 14px;

    color: var(--vv-text);
    text-decoration: none;
}

.user-menu-dropdown a:hover {
    background: #f3f4f6;
}

.user-menu-divider {
    height: 1px;
    background: var(--vv-border);
    margin: 6px 0;
}


/* =========================================================
   Entity header
   ========================================================= */

.entity-header {
    margin-top: 16px;
}


/* =========================================================
   Buttons
   ========================================================= */

.primary {
    background: #cfece9;
    color: #188a89;
    border-color: #b7ddd9;
}

.vv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 16px;

    border-radius: 8px;

    font-weight: 600;
    text-decoration: none;

    cursor: pointer;
}


.vv-button-primary {
    color: white;
    background: var(--vv-primary);
}


.vv-button-primary:hover {
    color: white;
    background: var(--vv-primary-hover);
}


/* =========================================================
   Shared surfaces
   ========================================================= */

.vv-card {
    background: var(--vv-surface);
    border: 1px solid var(--vv-border);
    border-radius: var(--vv-radius);
}



/* Page shell spacing */
.wrap {
    padding-top: 24px;
    padding-bottom: 48px;
}

@media (max-width: 600px) {
    .wrap {
        padding-top: 16px;
        padding-bottom: 32px;

    }
}


/* =========================================================
   Responsive overflow safeguards
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.wrap,
.workspace,
.left-panel,
.right-panel,
.matrix,
.detail,
.table-wrap {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 600px) {

    .workspace {
        width: 100%;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        flex-basis: auto;
    }

    .matrix,
    .detail,
    .table-wrap {
        width: 100%;
    }

}

/* Restore radar matrix visibility */
.left-panel {
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: stretch;
}

.left-panel .detail,
.left-panel .matrix {
    align-self: stretch;
    box-sizing: border-box;
}

.left-panel .detail {
    flex: 1 1 52%;
    min-height: 0;
    overflow-y: auto;
}

.left-panel .matrix {
    flex: 0 0 48%;
    min-height: 320px;
}

@media (min-width: 901px) {

    .left-panel {
        align-items: stretch;
        height: auto;
        min-height: 320px;
    }

    .left-panel .detail {
        flex: 1 1 52%;
        min-height: 320px;
    }

    .left-panel .matrix {
        flex: 0 0 48%;
        min-height: 320px;
        height: auto;
    }

}

@media (max-width: 900px) {

    .left-panel {
        flex-direction: column;
        height: auto;
        min-height: 0;
        max-height: none;
        gap: 18px;
    }

    .left-panel .detail,
    .left-panel .matrix {
        width: 100%;
        flex: none;
        height: auto;
        min-height: 0;
    }

    .left-panel .matrix {
        height: 300px;
    }

    .left-panel .detail {
        overflow: visible;
    }

}

@media (max-width: 900px) {
    .vv-container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (max-width: 900px) {
    .left-panel,
    .right-panel {
        width: 100%;
    }
}

