:root {
    --loom-gold: #d8a45c;
    --loom-gold-strong: #c99149;
    --loom-gold-soft: rgba(216, 164, 92, 0.18);
    --loom-bg: #0b0b0d;
    --loom-bg-2: #121318;
    --loom-panel: rgba(20, 20, 24, 0.94);
    --loom-panel-soft: rgba(20, 20, 24, 0.88);
    --loom-border: rgba(216, 164, 92, 0.20);
    --loom-border-strong: rgba(216, 164, 92, 0.35);
    --loom-border-soft: rgba(255,255,255,0.06);
    --loom-text: #f3efe8;
    --loom-muted: #b9b2a8;
    --loom-input: rgba(255,255,255,0.06);
    --loom-input-border: rgba(216,164,92,0.28);
    --loom-danger-bg: rgba(220, 53, 69, 0.12);
    --loom-danger-border: rgba(220, 53, 69, 0.25);
    --loom-danger-text: #ffb8bf;
    --loom-success-bg: rgba(34, 197, 94, 0.14);
    --loom-success-border: rgba(34, 197, 94, 0.22);
    --loom-success-text: #86efac;
    --loom-fail-bg: rgba(239, 68, 68, 0.14);
    --loom-fail-border: rgba(239, 68, 68, 0.22);
    --loom-fail-text: #fca5a5;
    --loom-shadow-xl: 0 24px 64px rgba(0,0,0,0.55);
    --loom-shadow-lg: 0 20px 50px rgba(0,0,0,0.35);
    --loom-shadow-md: 0 10px 24px rgba(0,0,0,0.25);
    --loom-radius-xl: 24px;
    --loom-radius-lg: 20px;
    --loom-radius-md: 18px;
    --loom-radius-sm: 14px;
}

/* BASE */
html,
body {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, rgba(216,164,92,0.08), transparent 24%),
        radial-gradient(circle at bottom right, rgba(216,164,92,0.06), transparent 20%),
        linear-gradient(135deg, #060607 0%, #0f1013 100%) !important;
    color: var(--loom-text);
}

.loom-theme {
    color: var(--loom-text);
}

.loom-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--loom-border);
    border-radius: 999px;
    color: var(--loom-gold);
    font-size: 0.80rem;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
    background: rgba(216, 164, 92, 0.05);
}

.loom-card {
    background: var(--loom-panel);
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-xl);
    box-shadow:
        var(--loom-shadow-xl),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    backdrop-filter: blur(10px);
}

.loom-card-soft {
    background: var(--loom-panel-soft);
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-lg);
    box-shadow:
        var(--loom-shadow-md),
        0 0 0 1px rgba(255,255,255,0.02) inset;
}

.loom-title-gold {
    color: var(--loom-gold);
}

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

.loom-alert {
    border-radius: var(--loom-radius-sm);
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.93rem;
    line-height: 1.45;
}

.loom-alert-danger {
    background: var(--loom-danger-bg);
    border: 1px solid var(--loom-danger-border);
    color: var(--loom-danger-text);
}

.loom-form-group {
    margin-bottom: 1rem;
}

.loom-label {
    display: block;
    margin-bottom: 0.45rem;
    color: #ddd6cc;
    font-size: 0.9rem;
    font-weight: 600;
}

.loom-input,
input.loom-input,
input[type="email"].loom-input,
input[type="password"].loom-input,
.form-control.loom-input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: var(--loom-radius-sm);
    border: 1px solid var(--loom-input-border) !important;
    background: var(--loom-input) !important;
    color: var(--loom-text) !important;
    -webkit-text-fill-color: var(--loom-text) !important;
    font-size: 0.98rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.loom-input::placeholder,
input.loom-input::placeholder {
    color: #8d877f !important;
    opacity: 1;
}

.loom-input:focus,
input.loom-input:focus,
.form-control.loom-input:focus {
    outline: none;
    border-color: var(--loom-gold) !important;
    box-shadow: 0 0 0 4px var(--loom-gold-soft) !important;
    background: rgba(255,255,255,0.08) !important;
    color: var(--loom-text) !important;
    -webkit-text-fill-color: var(--loom-text) !important;
}

input.loom-input:-webkit-autofill,
input.loom-input:-webkit-autofill:hover,
input.loom-input:-webkit-autofill:focus,
input.loom-input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--loom-text) !important;
    box-shadow: 0 0 0 1000px rgba(255,255,255,0.06) inset !important;
    transition: background-color 9999s ease-in-out 0s;
    border: 1px solid var(--loom-input-border) !important;
}

.loom-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.loom-check input {
    accent-color: var(--loom-gold);
}

.loom-btn {
    width: 100%;
    border: 0;
    border-radius: var(--loom-radius-sm);
    padding: 1rem 1.1rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02rem;
    color: #111;
    cursor: pointer;
    background: linear-gradient(135deg, #f0c27b 0%, #d8a45c 45%, #b9833c 100%);
    box-shadow: 0 14px 28px rgba(216,164,92,0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.loom-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(216,164,92,0.28);
}

.loom-status,
.dashboard-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03rem;
}

.loom-status.is-success,
.dashboard-status.is-success {
    background: var(--loom-success-bg);
    color: var(--loom-success-text);
    border: 1px solid var(--loom-success-border);
}

.loom-status.is-fail,
.dashboard-status.is-fail {
    background: var(--loom-fail-bg);
    color: var(--loom-fail-text);
    border: 1px solid var(--loom-fail-border);
}

.loom-watermark {
    position: relative;
    overflow: hidden;
}

.loom-watermark::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--loom-watermark-image);
    background-repeat: no-repeat;
    background-position: right 30px center;
    background-size: var(--loom-watermark-size, 220px);
    opacity: 0.05;
    pointer-events: none;
}

.loom-watermark > * {
    position: relative;
    z-index: 1;
}

/* LOGIN */
.loom-login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
}

.loom-brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.loom-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--loom-watermark-image);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: min(40vw, 560px);
    opacity: 0.07;
    filter: drop-shadow(0 0 40px rgba(216,164,92,0.12));
    pointer-events: none;
}

.loom-brand-content {
    position: relative;
    z-index: 1;
    max-width: 620px;
}

.loom-brand-title {
    margin: 0 0 1rem 0;
    font-size: clamp(2.5rem, 5vw, 4.8rem);
    line-height: 0.95;
    letter-spacing: 0.05rem;
    color: var(--loom-text);
    font-weight: 700;
}

.loom-brand-title strong {
    color: var(--loom-gold);
}

.loom-brand-subtitle {
    margin: 0 0 2rem 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--loom-muted);
    max-width: 560px;
}

.loom-feature-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.loom-feature {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--loom-radius-md);
    padding: 1rem 1.1rem;
    backdrop-filter: blur(4px);
}

.loom-feature-title {
    color: var(--loom-gold);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.loom-feature-text {
    color: var(--loom-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.loom-login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loom-login-card {
    width: 100%;
    max-width: 430px;
    padding: 2.2rem;
    background: var(--loom-panel);
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-xl);
    box-shadow:
        var(--loom-shadow-xl),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    backdrop-filter: blur(10px);
}

.loom-login-header {
    margin-bottom: 1.8rem;
    text-align: left;
}

.loom-login-logo {
    width: 72px;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 0 18px rgba(216,164,92,0.20));
}

.loom-login-title {
    margin: 0;
    font-size: 1.9rem;
    color: var(--loom-text);
    font-weight: 700;
}

.loom-login-title span {
    color: var(--loom-gold);
}

.loom-login-desc {
    margin: 0.6rem 0 0;
    color: var(--loom-muted);
    font-size: 0.96rem;
    line-height: 1.55;
}

.loom-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0 1.5rem;
    gap: 1rem;
    color: var(--loom-muted);
    font-size: 0.92rem;
}

.loom-footer {
    margin-top: 1.2rem;
    text-align: center;
    color: #8d877f;
    font-size: 0.82rem;
}

/* DASHBOARD */
.loom-page-title {
    color: var(--loom-gold);
    font-weight: 700;
    letter-spacing: 0.02rem;
}

.loom-dashboard-shell {
    position: relative;
}

.loom-dashboard-hero {
    position: relative;
    margin-bottom: 24px;
    padding: 28px;
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-lg);
    background:
        linear-gradient(135deg, rgba(216,164,92,0.08), rgba(255,255,255,0.02)),
        rgba(20, 20, 24, 0.88);
    box-shadow:
        var(--loom-shadow-lg),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    overflow: hidden;
    --loom-watermark-size: 220px;
}

.loom-dashboard-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--loom-watermark-image);
    background-repeat: no-repeat;
    background-position: right 30px center;
    background-size: var(--loom-watermark-size, 220px);
    opacity: 0.05;
    pointer-events: none;
}

.loom-dashboard-hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.loom-dashboard-hero h1 {
    margin: 0 0 10px 0;
    color: var(--loom-text);
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 700;
    line-height: 1.05;
}

.loom-dashboard-hero h1 span {
    color: var(--loom-gold);
}

.loom-dashboard-hero p {
    margin: 0;
    color: var(--loom-muted);
    font-size: 1rem;
    line-height: 1.65;
    max-width: 760px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--loom-panel);
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-md);
    padding: 18px;
    box-shadow:
        var(--loom-shadow-md),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    border-color: var(--loom-border-strong);
}

.dashboard-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06rem;
    color: var(--loom-muted);
    margin-bottom: 10px;
}

.dashboard-value {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 6px;
    color: var(--loom-gold);
}

.dashboard-sub {
    font-size: 12px;
    color: var(--loom-muted);
}

.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.dashboard-panel {
    background: var(--loom-panel);
    border: 1px solid var(--loom-border);
    border-radius: var(--loom-radius-lg);
    padding: 20px;
    box-shadow:
        var(--loom-shadow-md),
        0 0 0 1px rgba(255,255,255,0.02) inset;
}

.dashboard-panel h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: var(--loom-text);
}

.dashboard-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: baseline;
    color: var(--loom-muted);
}

.dashboard-row strong {
    color: var(--loom-gold);
    min-width: 84px;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    overflow: hidden;
    border-radius: 12px;
}

.dashboard-table thead th {
    color: var(--loom-gold);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: 700;
    background: rgba(216,164,92,0.05);
}

.dashboard-table th,
.dashboard-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--loom-border-soft);
    color: var(--loom-text);
}

.dashboard-table tbody tr:hover {
    background: rgba(255,255,255,0.025);
}

.text-muted {
    color: var(--loom-muted) !important;
}

/* EASYADMIN OVERRIDE */
body,
.wrapper,
.app,
.main-wrapper,
.content-wrapper,
.content,
.ea-content,
.content-panel,
.dashboard-content,
section.content,
.main-content,
.main,
#main,
#content {
    background-color: transparent !important;
}

.sidebar,
#sidebar,
.ea-sidebar {
    background:
        linear-gradient(180deg, rgba(18,19,24,0.98) 0%, rgba(11,11,13,0.98) 100%) !important;
    border-right: 1px solid rgba(216,164,92,0.14) !important;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.02);
}

.sidebar-menu .menu-header,
.ea-sidebar .menu .menu-header,
#sidebar .menu-header {
    color: #8e98ac !important;
    text-transform: uppercase;
    letter-spacing: 0.04rem;
    font-weight: 700;
}

.sidebar-menu .menu-item .menu-link,
.ea-sidebar .menu .menu-item .menu-link,
#sidebar .menu-item .menu-link {
    color: #cfd5df !important;
    border-radius: 10px;
    margin: 2px 10px;
    transition: all 0.15s ease;
}

.sidebar-menu .menu-item .menu-link:hover,
.ea-sidebar .menu .menu-item .menu-link:hover,
#sidebar .menu-item .menu-link:hover {
    background: rgba(216,164,92,0.08) !important;
    color: var(--loom-gold) !important;
}

.sidebar-menu .menu-item.active .menu-link,
.ea-sidebar .menu .menu-item.active .menu-link,
#sidebar .menu-item.active .menu-link,
.sidebar-menu .menu-item .menu-link.active,
.ea-sidebar .menu .menu-item .menu-link.active {
    background: rgba(216,164,92,0.14) !important;
    color: var(--loom-gold) !important;
    box-shadow: inset 3px 0 0 var(--loom-gold);
}

.sidebar-menu .menu-item .menu-icon,
.ea-sidebar .menu .menu-item .menu-icon,
#sidebar .menu-item .menu-icon {
    color: #95a0b5 !important;
}

.sidebar-menu .menu-item.active .menu-icon,
.ea-sidebar .menu .menu-item.active .menu-icon,
#sidebar .menu-item.active .menu-icon,
.sidebar-menu .menu-item .menu-link:hover .menu-icon {
    color: var(--loom-gold) !important;
}

.sidebar-logo,
.ea-sidebar .sidebar-logo,
#sidebar .sidebar-logo,
.sidebar .logo-custom,
.sidebar a.logo {
    color: var(--loom-text) !important;
    border-bottom: 1px solid rgba(216,164,92,0.10);
}

.sidebar-logo a,
.ea-sidebar .sidebar-logo a,
.sidebar a.logo,
#sidebar .sidebar-logo a {
    color: var(--loom-text) !important;
}

.topbar,
.navbar,
.content-top,
header.navbar {
    background: rgba(15,16,19,0.72) !important;
    border-bottom: 1px solid rgba(216,164,92,0.10) !important;
    backdrop-filter: blur(8px);
}

.topbar *,
.navbar *,
header.navbar * {
    color: #d8dee8 !important;
}

.page-header,
.content-header,
.ea-content-header {
    background: transparent !important;
    border-bottom: 0 !important;
}

body .table,
body .table thead,
body .table tbody,
body .table tr,
body .table td,
body .table th,
body .datagrid,
body .content-panel .table {
    color: var(--loom-text);
}

/* RESPONSIVE */
@media (max-width: 980px) {
    .loom-login-page {
        grid-template-columns: 1fr;
    }

    .loom-brand-panel {
        min-height: 320px;
        padding: 2.5rem 1.5rem 2rem;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,0.04);
    }

    .loom-feature-list {
        grid-template-columns: 1fr;
    }

    .loom-login-panel {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .loom-dashboard-hero {
        padding: 22px 18px;
        --loom-watermark-size: 160px;
    }

    .dashboard-panel {
        padding: 16px;
    }

    .dashboard-table {
        font-size: 12px;
    }

    .dashboard-table th,
    .dashboard-table td {
        padding: 8px;
    }
}

@media (max-width: 576px) {
    .loom-login-card {
        padding: 1.5rem;
        border-radius: var(--loom-radius-md);
    }

    .loom-brand-title {
        font-size: 2.2rem;
    }
}

/* --- FIX JSON editor EasyAdmin --- */

.json-editor-fix .CodeMirror {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 600px;
}

/* evita che righe lunghissime allarghino la pagina */
.json-editor-fix .CodeMirror pre,
.json-editor-fix .CodeMirror-line,
.json-editor-fix .CodeMirror-line-like {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word;
}

/* impedisce al pannello della form di espandersi */
.json-editor-fix {
    max-width: 100%;
    min-width: 0;
}

/* contenitore EasyAdmin */
.ea-content .json-editor-fix {
    overflow-x: auto;
}
