@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700&display=swap');

:root {
    --jt-red: #dd2a2b;
    --jt-red-hover: #c02425;
    --jt-red-soft: #fde8e8;
    --jt-slate: #24303f;
    --jt-muted: #6e7a87;
    --jt-border: #e8e2dc;
    --jt-bg: #f7f5f2;
    --jt-surface: #ffffff;
    --jt-sidebar: #faf8f6;
    --jt-radius: 12px;
    --jt-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
}

body {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    color: var(--jt-slate);
}

.admin-body { background: var(--jt-bg); min-height: 100vh; }

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--jt-sidebar);
    border-right: 1px solid var(--jt-border);
}

.sidebar-logo-img {
    height: 36px;
    width: auto;
    max-width: 100%;
    display: block;
}

.sidebar .nav-link {
    color: var(--jt-muted);
    border-radius: 8px;
    margin-bottom: 2px;
    padding: 0.6rem 0.85rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    background: var(--jt-bg);
    color: var(--jt-slate);
}

.sidebar .nav-link.active {
    background: var(--jt-red-soft);
    color: var(--jt-red-hover);
    box-shadow: inset 3px 0 0 var(--jt-red);
}

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--jt-muted);
    padding: 1rem 0.85rem 0.35rem;
    font-weight: 600;
}

.topbar {
    background: var(--jt-surface);
    border-bottom: 1px solid var(--jt-border);
}

.topbar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--jt-slate);
    line-height: 1.2;
}

.topbar-user-client {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--jt-red-hover);
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.topbar-user-meta {
    font-size: 0.75rem;
    color: var(--jt-muted);
    line-height: 1.2;
    margin-top: 0.15rem;
}

.topbar-user-role {
    color: var(--jt-muted);
}

.panel-card, .stat-card {
    background: var(--jt-surface);
    border: 1px solid var(--jt-border);
    border-radius: var(--jt-radius);
    box-shadow: var(--jt-shadow);
}

.stat-card { padding: 1.25rem; }
.stat-label { font-size: 0.8rem; color: var(--jt-muted); margin-bottom: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--jt-red); }

.message-bubble {
    background: var(--jt-bg);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.ticket-detail-header .ticket-badge {
    font-weight: 500;
    padding: 0.45em 0.75em;
}

.ticket-meta dt {
    color: var(--jt-muted);
    font-weight: 500;
}

.ticket-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 520px;
    max-height: calc(100vh - 140px);
    position: sticky;
    top: 1rem;
}

.ticket-chat-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem;
    background: var(--jt-bg);
}

.ticket-chat-compose {
    padding: 1rem;
    background: var(--jt-surface);
}

.message-bubble-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.message-bubble-time {
    font-size: 0.75rem;
    color: var(--jt-muted);
    margin-bottom: 0.5rem;
}

.message-bubble-body {
    font-size: 0.925rem;
    line-height: 1.5;
}

.message-bubble-client {
    background: #fff;
    border: 1px solid var(--jt-border);
    border-left: 3px solid var(--jt-muted);
}

.message-bubble-staff {
    background: var(--jt-red-soft);
    border: 1px solid rgba(221, 42, 43, 0.15);
    border-left: 3px solid var(--jt-red);
}

.message-role {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 991.98px) {
    .ticket-chat-panel {
        position: static;
        max-height: none;
        min-height: 360px;
    }
}

.attachment-list li + li {
    margin-top: 0.35rem;
}

.attachment-link {
    color: var(--jt-red);
    text-decoration: none;
    font-size: 0.875rem;
}

.attachment-link:hover {
    color: var(--jt-red-hover);
    text-decoration: underline;
}

.btn-primary {
    --bs-btn-bg: var(--jt-red);
    --bs-btn-border-color: var(--jt-red);
    --bs-btn-hover-bg: var(--jt-red-hover);
    --bs-btn-hover-border-color: var(--jt-red-hover);
}

.guest-body {
    background: var(--jt-bg);
    min-height: 100vh;
}

/* ── Login page ── */

.login-page {
    overflow: hidden;
    background: #0f0f10;
}

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

.login-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    pointer-events: none;
}

.login-bg-shape-1 {
    width: 420px;
    height: 420px;
    background: var(--jt-red);
    top: -120px;
    left: -80px;
    animation: login-float 14s ease-in-out infinite;
}

.login-bg-shape-2 {
    width: 320px;
    height: 320px;
    background: #ff6b6b;
    bottom: -60px;
    right: 10%;
    animation: login-float 18s ease-in-out infinite reverse;
}

.login-bg-shape-3 {
    width: 260px;
    height: 260px;
    background: rgba(255, 255, 255, 0.08);
    top: 40%;
    right: -40px;
    animation: login-float 20s ease-in-out infinite;
}

@keyframes login-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(24px, -18px) scale(1.05); }
}

.login-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 980px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.45);
}

@media (min-width: 992px) {
    .login-panel {
        grid-template-columns: 1.05fr 0.95fr;
        min-height: 580px;
    }
}

.login-panel-brand {
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    background: linear-gradient(160deg, rgba(221, 42, 43, 0.92) 0%, rgba(160, 20, 24, 0.95) 100%);
    color: #fff;
}

@media (min-width: 992px) {
    .login-panel-brand {
        display: flex;
    }
}

.login-brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-brand-logo {
    height: 44px;
    width: auto;
    display: block;
}

.login-brand-tagline {
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: 0.92;
    margin-bottom: 2.5rem;
    max-width: 34ch;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.login-feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.login-feature strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.login-feature span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.login-panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: #fff;
}

@media (min-width: 992px) {
    .login-panel-form {
        padding: 3rem;
    }
}

.login-form-card {
    width: 100%;
    max-width: 360px;
}

.login-form-header {
    margin-bottom: 2rem;
}

.login-form-logo {
    height: 44px;
    width: auto;
    margin-bottom: 1.25rem;
}

.login-form-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--jt-red);
    background: var(--jt-red-soft);
    padding: 0.35em 0.75em;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.login-form-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.35rem;
    color: var(--jt-slate);
}

.login-form-subtitle {
    font-size: 0.925rem;
    color: var(--jt-muted);
    margin: 0;
}

.login-alert {
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--jt-slate);
    margin-bottom: 0.45rem;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--jt-muted);
    font-size: 1rem;
    pointer-events: none;
}

.login-input {
    border: 1.5px solid var(--jt-border);
    border-radius: 12px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    border-color: var(--jt-red);
    box-shadow: 0 0 0 4px rgba(221, 42, 43, 0.12);
}

.login-submit {
    margin-top: 0.5rem;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--jt-red) 0%, #b82223 100%);
    color: #fff;
    transition: transform 0.15s, box-shadow 0.15s;
}

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(221, 42, 43, 0.35);
    color: #fff;
    background: linear-gradient(135deg, var(--jt-red-hover) 0%, #9a1c1d 100%);
}

.login-footer-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--jt-muted);
    margin: 1.5rem 0 0;
}

.login-link {
    color: var(--jt-red);
    text-decoration: none;
    font-weight: 500;
}

.login-link:hover {
    color: var(--jt-red-hover);
    text-decoration: underline;
}

.login-shell-compact .login-panel-single {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
}

.login-panel-form-center {
    padding: 2rem;
}

.login-shell-compact .login-form-logo {
    height: 40px;
    margin: 0 auto 1rem;
    display: block;
}

/* Report stampabile */
.report-table th,
.report-table td {
    font-size: 0.875rem;
}

@media print {
    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }

    body.admin-body {
        background: #fff;
    }

    #wrapper {
        display: block !important;
    }

    .content {
        padding: 0 !important;
    }

    .report-print-area {
        border: none !important;
        box-shadow: none !important;
    }

    .report-print-area .card-body {
        padding: 0 !important;
    }

    .report-table {
        font-size: 11px;
    }

    .report-table th,
    .report-table td {
        border: 1px solid #ccc !important;
        padding: 0.35rem 0.5rem !important;
    }
}
