/* css/frontend.css */

/* ===== LOGIN ===== */
#view-login {
    background: transparent;
}

.login-card {
    max-width: 400px;
    width: 100%;
    background: rgba(15, 20, 40, 0.92);
    color: #f8f9fa;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== HEADER FRONTEND ===== */
.frontend-header {
    /* sfondo base scuro */
    background-color: #050816;

    /* pattern ripetuto (sostituisci il path con la tua immagine) */
    background-image: url('../img/header_pattern.jpg');
    background-repeat: repeat;

    color: #f8f9fa;

    /* altezza “doppia” rispetto a una navbar standard (~56px) */
    min-height: 112px;

    /* allineamento verticale contenuto */
    display: flex;
    align-items: center;
}

/* per sicurezza, aumentiamo anche il padding interno del container */
.frontend-header .container,
.frontend-header .container-fluid {
    padding-top: 1rem;
    padding-bottom: 1rem;
    padding-right: 40px;
    padding-left: 40px;
}

@media (max-width: 480px) {
    .frontend-header .container,
    .frontend-header .container-fluid {
    padding-right: 10px;
    padding-left: 10px;
    }
}

/* Logo frontend in header */
.frontend-logo {
    height: 64px;          /* logo bello visibile, proporzionato all’header */
    width: auto;
    object-fit: contain;
    display: block;
    margin-right: 1rem;
}

.frontend-title {
    font-family: "Gill Sans", serif; /* o quello che preferisci */
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#btnBackToCampaigns {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

#btnBackToCharacters {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

/* Sfondo generale frontend */
.frontend-body {
    min-height: 100vh;
    background-color: #000;
    background-image: url('/img/bg_pattern.jpg'); /* pattern 800x448 */
    background-repeat: repeat;
    background-size: 800px 448px;
    color: #f8f9fa;
    position: relative;
    z-index: 0;
    font-family: "Gill Sans", serif; /* o quello che preferisci */
}

/* Overlay nero sopra il pattern di sfondo */
.frontend-body::before {
    content: "";
    position: fixed;       /* copre tutta la viewport anche con scroll */
    inset: 0;
    background: rgba(0, 0, 0, 0.80); /* <-- regola qui la trasparenza (0 = trasparente, 1 = nero pieno) */
    pointer-events: none;  /* non blocca click/scroll */
    z-index: 0;
}

/* Fa sì che tutto il contenuto sia sopra l'overlay */
.frontend-body > * {
    position: relative;
    z-index: 1;
}

/* ===== CAMPAGNE ===== */
/* CARD CAMPAGNA – mantiene sempre rapporto 5:1 (1280x256) */
.campaign-card {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 1;          /* <--- qui la magia */
    border-radius: 1rem;
    overflow: hidden;
    background-color: #050509;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    display: flex;
    
}

@media (max-width: 428.98px) {
    .campaign-card {
        aspect-ratio: auto;
        min-height: 80px;
    }
}

/* versione disabilitata (campagne senza personaggi) */
.campaign-card.disabled {
    cursor: default;
    filter: grayscale(0.8) opacity(0.4);
}

/* sfondo immagine */
.campaign-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* overlay contenuto (titolo, date, icone) */
.campaign-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #f5f5f5;
}

.campaign-title {
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.campaign-meta {
    font-size: 0.8rem;
}

.campaign-status-icon {
    font-size: 1rem;
}

/* stato per icona */
.campaign-status-upcoming {
    color: #ffc107;
}

.campaign-status-running {
    color: #ffffff;
}

.campaign-status-ended {
    color: #dc3545;
}

/* hover solo se non disabled */
.campaign-card:not(.disabled):hover .campaign-bg {
    transform: scale(1.05);
    filter: brightness(1.05);
}

.campaign-card:not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45);
}

/* Layout a griglia per i badge campagna */
#campaignsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem; /* spazio tra i badge */
}

/* opzionale: su schermi molto piccoli permetti carte un po' più strette */
@media (max-width: 575.98px) {
    #campaignsGrid {
        grid-template-columns: 1fr; /* forza una sola colonna */
    }
}

/* ===== PERSONAGGI ===== */
.character-card {
    border-radius: 1rem;
    overflow: hidden;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.character-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 140%; /* rapporto ritratto */
    overflow: hidden;
}

.character-img-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.character-body {
    padding: 0.75rem 1rem;
    color: #f8f9fa;
}

.character-name {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.character-meta {
    font-size: 0.85rem;
    color: #cbd5f5;
}

.character-card:hover .character-img-wrapper img {
    transform: scale(1.05);
    filter: brightness(1.05);
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45);
}

/* Personaggio con messaggi non letti */
.character-card-unread {
    border-color: #ff9800;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.7);
}

/* Personaggi: sotto i 480px -> una colonna sola */
@media (max-width: 480px) {
    #charactersGrid .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ===== CHAT ===== */
.chat-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: #050816;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8f9fa;
}

.chat-wrapper .card-header {
    background: #111827;
    border-bottom-color: rgba(148, 163, 184, 0.3);
}

.chat-wrapper .card-footer {
    background: #020617;
    border-top-color: rgba(148, 163, 184, 0.3);
}

.chat-messages {
    max-height: 60vh;
    min-height: 60vh;
    overflow-y: auto;
    background: radial-gradient(circle at top, #5b5b5b 0, #000000 50%, #000 100%);
}

/* Messaggi */
.chat-message-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.chat-message-inner {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    position: relative;
    word-wrap: break-word;
}

/* Master: sinistra */
.chat-message-master {
    justify-content: flex-start;
}

.chat-message-master .chat-message-inner {
    background: rgba(55, 65, 81, 0.95);
    border-bottom-left-radius: 0.2rem;
}

/* Giocatore/Personaggio: destra */
.chat-message-player {
    justify-content: flex-end;
}

.chat-message-player .chat-message-inner {
    background: rgba(59, 130, 246, 0.95);
    border-bottom-right-radius: 0.2rem;
}

/* Messaggi di sistema (ispirazione, ecc.) */
.chat-message-system {
    justify-content: center;
}

.chat-message-system .chat-message-inner {
    background: rgba(249, 115, 22, 0.95); /* arancione */
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.chat-message-system .chat-message-meta,
.chat-message-system .chat-message-time {
    text-align: center;
}

/* Nome + orario */
.chat-message-meta {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-bottom: 0.1rem;
}

.chat-message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.15rem;
    text-align: right;
}

/* Ispirazione */
.inspiration-badge {
    border-radius: 999px;
    padding: 0.15rem 0.85rem;
    font-size: 0.8rem;
    border-width: 1px;
    background-color: #0f172a;
    color: #f8f9fa;
}

.inspiration-badge[data-active="1"] {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    color: #111827;
}

/* Adattamenti */
@media (max-width: 575.98px) {
    .chat-messages {
        max-height: 50vh;
        min-height: 50vh;
    }
}

/* Modal profilo: scroll interno quando il contenuto è troppo alto */

#profileModal .modal-content {
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

#profileModal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* fix iOS */
}
