/* =========================================================
   Semodia Certificate Manager
   Glassmorphism theme
   ========================================================= */

/* --- Brand tokens ---------------------------------------- */
:root {
    --primary:   #002454;
    --accent:    #00b3cc;
    --light:     #ececec;
    --success:   #5cb779;
    --muted:     #667b98;
    --danger:    #eb5e71;
    --warning:   #f4a16a;

    --glass-bg:     rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-blur:   blur(16px);
    --radius:       14px;
    --radius-sm:    8px;
}

/* --- Reset / Base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    color: var(--light);
    background: linear-gradient(145deg, #001534 0%, var(--primary) 45%, #003a55 80%, #005566 100%) fixed;
}

/* decorative ambient blobs */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(0,179,204,0.25) 0%, transparent 70%);
    top: -150px; right: -150px;
}
body::after {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,36,84,0.6) 0%, transparent 70%);
    bottom: -120px; left: -120px;
}

/* --- Glass utility --------------------------------------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* --- Layout shell --------------------------------------- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.app-content {
    flex: 1;
    padding: 2rem;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

/* --- Navbar --------------------------------------------- */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
    background: rgba(0, 18, 45, 0.65);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-bottom: 1px solid rgba(0, 179, 204, 0.25);
}

.app-nav .brand {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--light);
    white-space: nowrap;
}

.app-nav .brand em {
    font-style: normal;
    color: var(--accent);
}

.app-nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.app-nav-links a {
    font-size: 0.875rem;
    color: rgba(236,236,236,0.75);
    text-decoration: none;
    transition: color .18s;
}
.app-nav-links a:hover { color: var(--accent); }

/* --- Demo mode banner ----------------------------------- */
.demo-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 2rem;
    background: rgba(244, 161, 106, 0.12);
    border-bottom: 1px solid rgba(244, 161, 106, 0.30);
    font-size: 0.82rem;
    color: #f7c08a;
    position: sticky;
    top: 53px; /* sit flush below the navbar */
    z-index: 190;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.demo-banner-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* --- Footer --------------------------------------------- */
.app-footer {
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: rgba(236,236,236,0.65);
    border-top: 1px solid rgba(255,255,255,0.07);
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* --- Login layout --------------------------------------- */
.app-footer-fixed {
    position: fixed;
    bottom: 0;
    width: 100%;
}

.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 2rem;
}

.login-card {
    width: 380px;
    padding: 2.75rem 2.5rem;
}

.login-card .login-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.login-card .login-logo em {
    font-style: normal;
    color: var(--accent);
}

.login-card .login-sub {
    font-size: 0.82rem;
    color: rgba(236,236,236,0.70);
    margin-bottom: 2rem;
}

/* --- Buttons -------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .18s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: default; }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #0095aa);
    color: #fff;
    border-color: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    letter-spacing: 0.02em;
    width: 100%;
}
.btn-accent:hover:not(:disabled) {
    background: linear-gradient(135deg, #00c9e6, var(--accent));
    box-shadow: 0 4px 18px rgba(0,179,204,0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.15);
    color: var(--light);
}
.btn-ghost:hover:not(:disabled) {
    background: rgba(0,179,204,0.15);
    border-color: rgba(0,179,204,0.5);
}

.btn-page {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: var(--light);
    padding: 0.3rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 6px;
}
.btn-page:hover:not(:disabled) {
    background: rgba(0,179,204,0.18);
    border-color: rgba(0,179,204,0.45);
}

/* --- Forms --------------------------------------------- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.8rem;
    color: rgba(236,236,236,0.78);
    font-weight: 500;
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

/* Shared base for all inputs and selects */
.form-control,
.filter-select,
.filter-input {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: var(--radius-sm);
    color: var(--light);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.form-control:focus,
.filter-select:focus,
.filter-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,179,204,0.2);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
}
.form-control:focus { background: rgba(255,255,255,0.1); }
.form-control::placeholder { color: rgba(236,236,236,0.45); }

/* --- Alerts -------------------------------------------- */
.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}
.alert-danger {
    background: rgba(235,94,113,0.12);
    border: 1px solid rgba(235,94,113,0.35);
    color: #f07f8e;
}

/* --- Filter bar ---------------------------------------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-label {
    font-size: 0.7rem;
    color: rgba(236,236,236,0.70);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.filter-select,
.filter-input {
    padding: 0.45rem 0.8rem;
    font-size: 0.83rem;
    min-width: 155px;
}
.filter-select option { background: #002454; color: var(--light); }

/* --- Sortable table headers ----------------------------- */
.th-sortable {
    cursor: pointer;
    user-select: none;
}
.th-sortable:hover {
    color: var(--light);
    background: rgba(0, 18, 50, 0.80);
}
.th-sort-active {
    color: var(--accent);
}

/* --- Audit table --------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.audit-table thead th {
    padding: 0.75rem 1rem;
    background: rgba(0,18,50,0.55);
    color: rgba(236,236,236,0.72);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0,179,204,0.18);
    position: sticky;
    top: 0;
}

.audit-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background .12s;
}
.audit-table tbody tr:hover { background: rgba(255,255,255,0.04); }

.audit-table tbody td {
    padding: 0.6rem 1rem;
    color: rgba(236,236,236,0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.audit-table .empty-row td {
    text-align: center;
    color: rgba(236,236,236,0.45);
    padding: 2.5rem;
    font-size: 0.88rem;
}

/* --- Badges -------------------------------------------- */
.badge {
    display: inline-block;
    padding: 0.22em 0.6em;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge-success {
    background: rgba(92,183,121,0.18);
    border: 1px solid rgba(92,183,121,0.38);
    color: #6ed68a;
}
.badge-danger {
    background: rgba(235,94,113,0.18);
    border: 1px solid rgba(235,94,113,0.38);
    color: #f07f8e;
}

/* --- Pagination ---------------------------------------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 0.82rem;
    color: rgba(236,236,236,0.65);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.status-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-meta {
    font-size: 0.78rem;
    color: rgba(236,236,236,0.50);
}

.status-overall {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.status-overall-label {
    font-weight: 700;
    font-size: 1rem;
    margin-right: 0.75rem;
}

.status-overall-healthy   { border-color: rgba(92,183,121,0.40); }
.status-overall-degraded  { border-color: rgba(244,161,106,0.40); }
.status-overall-unhealthy { border-color: rgba(235,94,113,0.40); }

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

/* Card: no padding on the wrapper — head and body each own their spacing */
.status-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.status-card-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    min-width: 0;
}

.status-card-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.status-card-desc {
    font-size: 0.82rem;
    color: rgba(236,236,236,0.65);
    line-height: 1.5;
    overflow-wrap: break-word;
}

.status-data-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-data-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.status-data-key {
    font-size: 0.8rem;
    color: rgba(236,236,236,0.65);
    font-family: 'Consolas', 'Cascadia Code', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-error {
    font-size: 0.78rem;
    color: #f07f8e;
    background: rgba(235,94,113,0.08);
    border: 1px solid rgba(235,94,113,0.20);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

/* Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-lg {
    width: 14px;
    height: 14px;
}

.status-dot-healthy   { background: var(--success); box-shadow: 0 0 7px rgba(92,183,121,0.65); }
.status-dot-degraded  { background: var(--warning); box-shadow: 0 0 7px rgba(244,161,106,0.65); }
.status-dot-unhealthy { background: var(--danger);  box-shadow: 0 0 7px rgba(235,94,113,0.65); }

.badge-warning {
    background: rgba(244,161,106,0.18);
    border: 1px solid rgba(244,161,106,0.38);
    color: #f7c08a;
}

/* --- Home page ------------------------------------------ */
.nav-login-link {
    font-size: 0.78rem;
    color: rgba(236,236,236,0.38);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color .18s;
}
.nav-login-link:hover { color: var(--accent); }

.home-hero {
    text-align: center;
    padding-top: 3rem;
    margin-bottom: 3.5rem;
}

.home-title {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-bottom: 1.1rem;
}
.home-title em {
    font-style: normal;
    color: var(--accent);
}

.home-sub {
    font-size: 1rem;
    color: rgba(236,236,236,0.68);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.65;
}

/* --- Demo mode card (landing page) --------------------- */
.demo-card {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    width: 100%;
    max-width: 760px;
    margin: 0 auto 2.5rem;
    border-color: rgba(244, 161, 106, 0.35);
    background: rgba(244, 161, 106, 0.07);
}

.demo-card-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--warning);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.demo-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.demo-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f7c08a;
    margin-bottom: 0.25rem;
}

.demo-card-desc {
    font-size: 0.85rem;
    color: rgba(236,236,236,0.72);
    line-height: 1.6;
    margin: 0;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.home-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.75rem;
    text-decoration: none;
    color: var(--light);
    transition: background .18s, transform .18s, box-shadow .18s;
}
.home-card:hover {
    background: rgba(255,255,255,0.11);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.home-card-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0,179,204,0.12);
    border: 1px solid rgba(0,179,204,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.home-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.home-card-desc {
    font-size: 0.82rem;
    color: rgba(236,236,236,0.62);
    line-height: 1.55;
}

/* --- Page header --------------------------------------- */
.page-header { margin-bottom: 1.75rem; }
.page-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--light);
}
.page-header p {
    font-size: 0.82rem;
    color: rgba(236,236,236,0.70);
    margin-top: 0.2rem;
}
