/*
===============================================================
File: css.css
Project: Database View / Stored Procedure Browser
Updated: 2026-04-02 13:10

Changes in this update:
- supports the report browser UI
- includes modal popup styling for stored procedure parameters
- includes button styles for the parameter popup
- keeps the existing table, cards, pagination and busy cursor behaviour
===============================================================
*/

:root {
    --bg-1: #222c7f;
    --bg-2: #2b338f;
    --panel: rgba(255, 255, 255, 0.88);
    --text: #1f2937;
    --text-soft: #5b6677;
    --border: rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 10px 30px rgba(2, 8, 23, 0.08);
    --primary: #2563eb;
    --primary-2: #7c3aed;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --table-head: #f8fafc;
    --table-row: #ffffff;
    --table-row-alt: #f8fafc;
    --null-bg: #eef2ff;
    --null-text: #4338ca;
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
    min-height: 100vh;
}

body.busy,
body.busy * {
    cursor: wait !important;
}

.page-shell {
    width: min(1400px, calc(100% - 28px));
    margin: 16px auto 28px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.page-shell > .card + .card,
.page-shell > .card + .stats-grid,
.page-shell > .stats-grid + .card {
    margin-top: 18px;
}

.card--controls,
.card--table,
.card--pagination,
.card--error {
    padding: 14px 16px;
}

.controls-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 16px;
    align-items: start;
}

.field {
    display: flex;
    flex-direction: column;
}

.field--view label {
    margin-bottom: 8px;
}

.field--rows {
    align-self: start;
}

.field--modal label {
    margin-bottom: 8px;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.field-help-inline {
    font-size: 0.83rem;
    color: var(--text-soft);
    white-space: nowrap;
}

.field-help-inline--stack {
    margin-top: 8px;
    white-space: normal;
}

select,
input[type="number"],
input[type="text"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 0.98rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.stat-card {
    padding: 14px 16px;
    min-height: 70px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 0;
}

.stat-card__label {
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.2;
    margin-bottom: 10px;
}

.stat-card__value {
    font-size: clamp(1.1rem, 2vw, 1.15rem);
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.section-title {
    margin: 0;
    font-size: 1.35rem;
}

.section-subtitle {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.table-wrap {
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--table-head);
    color: var(--text);
    font-size: 0.88rem;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    white-space: nowrap;
}

.data-table tbody tr:nth-child(odd) {
    background: var(--table-row);
}

.data-table tbody tr:nth-child(even) {
    background: var(--table-row-alt);
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    vertical-align: top;
    white-space: nowrap;
    font-size: 0.93rem;
}

.data-table tbody tr:hover td {
    background: rgba(37, 99, 235, 0.045);
}

.null-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--null-bg);
    color: var(--null-text);
    font-size: 0.8rem;
    font-weight: 700;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.page-link,
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.94rem;
}

.page-link {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    border-color: rgba(37, 99, 235, 0.3);
}

.page-link--current {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.page-link--disabled {
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--text-soft);
}

.card--error {
    background: var(--danger-bg);
    border-color: rgba(185, 28, 28, 0.18);
}

.status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.status--error {
    background: rgba(185, 28, 28, 0.1);
    color: var(--danger);
}

.error-message {
    color: #7f1d1d;
    word-break: break-word;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.empty-state--small {
    padding: 36px 20px;
}

.empty-state__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.12));
    color: var(--primary);
    font-size: 1.6rem;
    font-weight: 800;
}

.empty-state h2 {
    margin: 0 0 8px;
    font-size: 1.3rem;
}

.empty-state p {
    margin: 0;
    color: var(--text-soft);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal-card {
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(2, 8, 23, 0.24);
    padding: 22px;
}

.modal-card__header {
    margin-bottom: 18px;
}

.modal-card__eyebrow {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.modal-card__title {
    margin: 0;
    font-size: 1.4rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 6px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.button--secondary {
    background: #fff;
    color: var(--text);
    border-color: rgba(15, 23, 42, 0.12);
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .controls-form {
        grid-template-columns: 1fr;
    }

    .field-head {
        justify-content: space-between;
    }

    .modal-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 16px, 1400px);
        margin: 8px auto 18px;
    }

    .card--controls,
    .card--table,
    .card--pagination,
    .card--error,
    .stat-card,
    .modal-card {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        min-width: 760px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }
}