/* Sfondo scuro per visualizzare le particelle */
body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Animazione gradiente del loader */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#pageLoader {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

/* Effetto glow sulle card */
.card {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 300% 300%;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
    animation: gradientShift 3s ease infinite;
}

.card:hover::before {
    opacity: 0.7;
    filter: blur(10px);
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3), 0 0 20px rgba(118, 75, 162, 0.2);
}

/* Effetto 3D sui bottoni */
button, .btn {
    transform-style: preserve-3d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover, .btn:hover {
    transform: perspective(500px) rotateX(5deg) translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

button:active, .btn:active {
    transform: perspective(500px) rotateX(0deg) translateY(0px) scale(0.98);
}

/* Effetto ripple al click */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
}

.ripple-effect:active::after {
    animation: ripple 0.6s ease-out;
}

/* Entrata card dal basso */
@keyframes cardRiseIn {
    0% {
        opacity: 0;
        transform: translateY(42px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.cards-grid .action-card {
    opacity: 0;
    transform: translateY(42px);
    will-change: transform, opacity;
}

.cards-grid .action-card.is-visible {
    animation: cardRiseIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cards-grid .action-card:nth-child(1).is-visible { animation-delay: 0.08s; }
.cards-grid .action-card:nth-child(2).is-visible { animation-delay: 0.16s; }
.cards-grid .action-card:nth-child(3).is-visible { animation-delay: 0.24s; }
.cards-grid .action-card:nth-child(4).is-visible { animation-delay: 0.32s; }
.cards-grid .action-card:nth-child(5).is-visible { animation-delay: 0.40s; }
.cards-grid .action-card:nth-child(6).is-visible { animation-delay: 0.48s; }
.cards-grid .action-card:nth-child(7).is-visible { animation-delay: 0.56s; }
.cards-grid .action-card:nth-child(8).is-visible { animation-delay: 0.64s; }

@media (prefers-reduced-motion: reduce) {
    .cards-grid .action-card {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* Glow sul bottone installa */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0,0,0,0.2), 0 0 20px rgba(255,215,0,0.4);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0,0,0,0.2), 0 0 40px rgba(255,215,0,0.8);
    }
}

.pwa-install-card button {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Copertina stile nuova_pratica per la home */
.hero-header {
    --hero-copy-width: clamp(320px, 31vw, 430px);
    position: relative;
    width: 100vw;
    margin: 0 0 0 calc(50% - 50vw);
    padding: 14px 24px 18px 12px;
    color: #f9fafb;
    background-color: #0f172a !important;
    display: block;
    z-index: 10;
}

.hero-parallax {
    position: relative;
    width: 100vw;
    margin: 0 0 28px calc(50% - 50vw);
    background-color: #0f172a !important;
    overflow: hidden;
    min-height: 0;
    display: block;
    z-index: 9;
}

.hero-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: static;
    z-index: 10;
    padding-right: 22px;
    padding-left: 0;
}

.hero-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
    position: static;
}

.hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ffffff !important;
    text-decoration: none;
    min-width: 0;
}

.hero-brand:visited,
.hero-brand:hover,
.hero-brand:active {
    color: #ffffff !important;
    text-decoration: none;
}

.hero-brand-mark {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.18);
}

.hero-brand-mark img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.hero-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hero-brand-copy strong {
    font-size: 16px;
    line-height: 1.1;
    color: #ffffff;
}

.hero-brand-copy small {
    font-size: 11px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-title,
.hero-subtitle {
    max-width: none;
    margin-left: 0;
}

.hero-media {
    width: 100%;
    background-color: #0f172a;
    overflow: hidden;
}

.hero-image {
    display: block;
    width: 100%;
    height: auto;
    transform: translate3d(0, 0, 0);
    transform-origin: center center;
    will-change: transform;
}

.hero-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    justify-content: flex-end;
    position: absolute;
    top: 18px;
    right: 8px;
    z-index: 15;
}

.hero-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    min-width: 132px;
    padding: 0 22px;
    border-radius: 999px;
    background: transparent;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: none;
}

.hero-top-btn:visited,
.hero-top-btn:hover,
.hero-top-btn:active {
    color: #ffffff !important;
    text-decoration: none;
}

.hero-top-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

.hero-top-btn-secondary {
    background: rgba(255,255,255,0.14);
    color: #ffffff;
    border: 2px solid rgba(255,255,255,0.24);
    box-shadow: none;
}

.hero-top-btn-ghost {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255,255,255,0.24);
    box-shadow: none;
}

.hero-title {
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: currentColor;
    text-shadow: 0 3px 12px rgba(0,0,0,0.6);
    white-space: nowrap;
}

.hero-subtitle {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #e2e8f0;
    text-shadow: 0 3px 12px rgba(0,0,0,0.55);
}

.hero-scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    font-size: 11px;
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.9;
    z-index: 1;
}

.hero-scroll-hint span {
    font-size: 14px;
}

.portal-intro-card {
    margin: 0 0 24px 0;
    padding: 28px 24px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 28%),
        radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.12), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 54%, #f0fdfa 100%);
    border: 1px solid rgba(125, 211, 252, 0.26);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.08);
}

.portal-intro-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(16, 185, 129, 0.16));
    color: #0f766e;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-intro-title {
    margin: 0 0 12px 0;
    font-size: 32px;
    line-height: 1.15;
    color: #0f172a;
}

.portal-intro-lead,
.portal-intro-text {
    margin: 0 0 14px 0;
    font-size: 16px;
    line-height: 1.7;
    color: #334155;
}

.portal-intro-subtitle {
    margin: 22px 0 12px 0;
    font-size: 20px;
    line-height: 1.3;
    color: #0f172a;
}

.portal-intro-highlight-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 18px 0;
}

.portal-intro-highlight {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.portal-intro-list {
    margin: 0 0 12px 0;
    padding: 0;
    list-style: none;
    color: #334155;
    display: grid;
    gap: 10px;
}

.portal-intro-list li {
    margin: 0;
    line-height: 1.6;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.portal-intro-list-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e0f2fe, #dcfce7);
    font-size: 18px;
}

.portal-intro-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0 0;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(14, 165, 233, 0.12));
    border: 1px solid rgba(20, 184, 166, 0.18);
    font-size: 17px;
    font-weight: 700;
}

.portal-intro-cta a {
    color: #0f766e;
    text-decoration: none;
}

.portal-intro-cta a:hover {
    text-decoration: underline;
}

.home-index .home-shell {
    padding-top: 20px !important;
}

.home-index .app-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px 0;
    padding: 0 0 18px 0;
    background: transparent;
    color: #0f172a;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    overflow: visible;
}

.home-index .app-header::before {
    display: none;
}

.home-index .logo-container {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.home-index .logo-icon {
    width: 58px;
    height: 58px;
    padding: 8px;
    border: 1px solid rgba(184, 134, 11, 0.5);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.home-index .logo-icon:hover {
    transform: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.home-index .logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.home-index .logo-text strong {
    font-size: 18px;
    line-height: 1.1;
    color: #0f172a;
}

.home-index .logo-text small {
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.home-index .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    margin-left: auto;
}

.home-index .login-btn,
.home-index .logout-btn,
.home-index .profile-btn {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #0f172a;
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.home-index .login-btn:hover,
.home-index .logout-btn:hover,
.home-index .profile-btn:hover {
    background: #1e293b;
    border-color: #1e293b;
    transform: translateY(-1px);
}

.home-index .user-greeting {
    color: #ffffff;
}

@media (max-width: 768px) {
    .hero-header {
        padding: 16px 16px 18px 16px;
        --hero-copy-width: 100%;
    }

    .hero-inner {
        padding-right: 0;
        padding-left: 0;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-topbar {
        gap: 12px;
        flex-wrap: wrap;
        position: relative;
    }

    .hero-media {
        overflow: hidden;
    }

    .hero-image {
        width: 100%;
        height: auto;
    }

    .hero-brand-copy strong {
        font-size: 14px;
    }

    .hero-brand-copy small {
        font-size: 10px;
    }

    .hero-brand-mark {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }

    .hero-brand-mark img {
        width: 60px;
        height: 60px;
    }

    .hero-top-actions {
        position: static;
        width: 100%;
        justify-content: flex-end;
    }

    .hero-top-btn {
        min-height: 42px;
        min-width: 118px;
        padding: 0 18px;
        font-size: 14px;
    }

    .portal-intro-card {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .portal-intro-title {
        font-size: 24px;
    }

    .portal-intro-pill {
        font-size: 12px;
        padding: 7px 12px;
    }

    .portal-intro-lead,
    .portal-intro-text,
    .portal-intro-list li {
        font-size: 15px;
    }

    .portal-intro-subtitle {
        font-size: 18px;
    }

    .portal-intro-highlight-row {
        gap: 8px;
    }

    .portal-intro-highlight {
        font-size: 13px;
        padding: 8px 11px;
    }

    .portal-intro-list li {
        grid-template-columns: 30px 1fr;
        gap: 10px;
        padding: 11px 12px;
    }

    .portal-intro-list-icon {
        width: 30px;
        height: 30px;
        border-radius: 10px;
        font-size: 16px;
    }

    .home-index .home-shell {
        padding-top: 16px !important;
    }

    .home-index .app-header {
        gap: 14px;
        margin-bottom: 18px;
        padding-bottom: 16px;
        flex-wrap: wrap;
    }

    .home-index .logo-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
    }

    .home-index .logo-text strong {
        font-size: 16px;
    }

    .home-index .logo-text small {
        font-size: 10px;
    }

    .home-index .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .home-index .login-btn,
    .home-index .logout-btn,
    .home-index .profile-btn {
        padding: 9px 14px;
    }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .pwa-install-card h3 { font-size: 18px !important; }
    .pwa-install-card p { font-size: 14px !important; }
    .pwa-install-card > div { flex-direction: column; text-align: center; }
}
