/* ===========================================
   Power Distribution - Menu Styles
   =========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* -----------------------------------------------
   Body: sfondo scuro con griglia sottile e glow
   ----------------------------------------------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0b1120;
    background-image:
        radial-gradient(circle at 25% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 75% 100%, rgba(245, 158, 11, 0.08) 0%, transparent 50%);
    min-height: 100vh;
    padding: 40px 20px;
    color: #e2e8f0;
    position: relative;
    overflow-x: hidden;
}

/* Griglia sottile di sfondo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* -----------------------------------------------
   Container
   ----------------------------------------------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* -----------------------------------------------
   Header
   ----------------------------------------------- */
header {
    text-align: center;
    margin-bottom: 56px;
    padding-top: 16px;
}

.header-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    color: #f59e0b;
    opacity: 0.9;
}

.header-icon svg {
    width: 100%;
    height: 100%;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 8px;
}

/* -----------------------------------------------
   Cards Grid
   ----------------------------------------------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* -----------------------------------------------
   Card
   ----------------------------------------------- */
.card {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(148, 163, 184, 0.1);
}

/* Striscia decorativa in alto alla card (colore variabile) */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent, #3b82f6), transparent);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.card:hover::before {
    opacity: 1;
}

/* Card disabilitata (coming soon) */
.card--disabled {
    opacity: 0.55;
    cursor: default;
}

.card--disabled:hover {
    transform: none;
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: none;
}

.card--disabled::before {
    display: none;
}

/* -----------------------------------------------
   Card Icon
   ----------------------------------------------- */
.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 28px 28px 0 28px;
    flex-shrink: 0;
}

.card-icon svg {
    width: 28px;
    height: 28px;
}

/* Varianti colore per le icone */
.card-icon--blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.card-icon--blue + .card-body + .card-footer {
    --accent: #3b82f6;
}

.card-icon--cyan {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.card-icon--cyan + .card-body + .card-footer {
    --accent: #06b6d4;
}

.card-icon--orange {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.card-icon--orange + .card-body + .card-footer {
    --accent: #f59e0b;
}

.card-icon--green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.card-icon--green + .card-body + .card-footer {
    --accent: #22c55e;
}

.card-icon--purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.card-icon--purple + .card-body + .card-footer {
    --accent: #a855f7;
}

.card-icon--amber {
    background: rgba(217, 119, 6, 0.15);
    color: #f59e0b;
}

.card-icon--amber + .card-body + .card-footer {
    --accent: #d97706;
}

.card-icon--indigo {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.card-icon--indigo + .card-body + .card-footer {
    --accent: #6366f1;
}

/* Propagazione --accent alla card tramite CSS custom property */
.card:has(.card-icon--blue) { --accent: #3b82f6; }
.card:has(.card-icon--cyan) { --accent: #06b6d4; }
.card:has(.card-icon--orange) { --accent: #f59e0b; }
.card:has(.card-icon--green) { --accent: #22c55e; }
.card:has(.card-icon--purple) { --accent: #a855f7; }
.card:has(.card-icon--amber) { --accent: #d97706; }
.card:has(.card-icon--indigo) { --accent: #6366f1; }

/* -----------------------------------------------
   Card Body (titolo + descrizione)
   ----------------------------------------------- */
.card-body {
    padding: 20px 28px 0 28px;
    flex-grow: 1;
}

.card-body h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-body p {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.55;
}

/* Badge "Coming Soon" */
.badge {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge--soon {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* -----------------------------------------------
   Card Footer
   ----------------------------------------------- */
.card-footer {
    padding: 20px 28px 24px 28px;
}

.card-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card:hover .card-action {
    color: var(--accent, #3b82f6);
}

.card-action .arrow {
    transition: transform 0.2s ease;
    display: inline-block;
}

.card:hover .card-action .arrow {
    transform: translateX(4px);
}

.card--disabled .card-action {
    color: #475569;
}

.card--disabled:hover .card-action {
    color: #475569;
}

.card--disabled:hover .card-action .arrow {
    transform: none;
}

/* -----------------------------------------------
   Modal
   ----------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 98%;
    max-width: 1800px;
    height: 97vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 1.6rem;
    color: #475569;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: rotate(90deg);
}

#modalIframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* -----------------------------------------------
   Animations
   ----------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Cards entrano con animazione sfalsata */
.card {
    animation: cardIn 0.4s ease both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

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

/* Card disabilitata: override animazione finale opacity */
.card--disabled {
    animation: cardInDisabled 0.4s ease both;
}

@keyframes cardInDisabled {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.55;
        transform: translateY(0);
    }
}

/* -----------------------------------------------
   Responsive
   ----------------------------------------------- */
@media (max-width: 768px) {
    body {
        padding: 24px 16px;
    }

    header {
        margin-bottom: 36px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modal-content {
        width: 99%;
        height: 98vh;
        border-radius: 10px;
    }
}
