/**
 * Babel4Call - Custom Styles
 */

/* ============================================
   Pink & White palette
   Brand color (buttons, navbar, links, headers, focus states) is pink;
   surfaces are white/near-white. Functional status colors (online=green,
   busy=amber, offline/end call=red) are left untouched on purpose: those
   carry meaning (call state, contact presence) and stay recognizable.
   ============================================ */
:root {
    --pink-50:  #fdf2f8;
    --pink-100: #fce7f3;
    --pink-200: #fbcfe8;
    --pink-300: #f9a8d4;
    --pink-400: #f472b6;
    --pink-500: #ec4899;
    --pink-600: #db2777;
    --pink-700: #be185d;
    --pink-800: #9d174d;
    --pink-900: #831843;

    --primary-color: var(--pink-600);
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;

    /* Bootstrap theme variables: swap the brand blue for pink everywhere
       Bootstrap derives colors from CSS variables (bg-primary, text-primary,
       badges, form focus glow, nav/pagination active states, ...). */
    --bs-primary: var(--pink-600);
    --bs-primary-rgb: 219, 39, 119;
    --bs-link-color: var(--pink-700);
    --bs-link-color-rgb: 190, 24, 93;
    --bs-link-hover-color: var(--pink-800);
    --bs-link-hover-color-rgb: 157, 23, 77;
    --bs-focus-ring-color: rgba(219, 39, 119, .25);
    --bs-light: var(--pink-50);
    --bs-light-rgb: 253, 242, 248;
}

body {
    background-color: var(--pink-50);
}

/* Bootstrap 5.3 bakes .btn-primary/.btn-outline-primary colors as local
   custom properties (not derived from --bs-primary), so they need an
   explicit override to follow the pink palette. */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--pink-600);
    --bs-btn-border-color: var(--pink-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--pink-700);
    --bs-btn-hover-border-color: var(--pink-700);
    --bs-btn-focus-shadow-rgb: 219, 39, 119;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--pink-800);
    --bs-btn-active-border-color: var(--pink-800);
    --bs-btn-disabled-bg: var(--pink-300);
    --bs-btn-disabled-border-color: var(--pink-300);
}

.btn-outline-primary {
    --bs-btn-color: var(--pink-600);
    --bs-btn-border-color: var(--pink-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--pink-600);
    --bs-btn-hover-border-color: var(--pink-600);
    --bs-btn-focus-shadow-rgb: 219, 39, 119;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--pink-600);
    --bs-btn-active-border-color: var(--pink-600);
    --bs-btn-disabled-color: var(--pink-600);
    --bs-btn-disabled-border-color: var(--pink-600);
}

/* Bootstrap's default focus border on inputs is a fixed light blue,
   independent of --bs-primary; override it to match the palette. */
.form-control:focus,
.form-select:focus {
    border-color: var(--pink-300);
}

/* User List */
.user-list {
    max-height: 300px;
    overflow-y: auto;
}

.user-item {
    transition: background-color 0.2s ease;
}

.user-item:hover {
    background-color: var(--pink-50);
}

.user-item:last-child {
    border-bottom: none !important;
}

.user-actions .btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.user-item:hover .user-actions .btn {
    opacity: 1;
}

/* Video Container */
.video-container {
    position: relative;
    background-color: #2b0e1e;
    min-height: 400px;
    border-radius: 0.375rem;
    overflow: hidden;
}

#remote-video {
    width: 100%;
    height: 100%;
    min-height: 400px;
    max-height: 70vh;
    object-fit: cover;
}

.local-video-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 126px;
    height: 95px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* Call Overlay */
.call-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

/* Video Subtitle Overlay (traduzione in sovraimpressione durante il Doppiaggio) */
.video-subtitle-overlay {
    position: absolute;
    bottom: 106px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    z-index: 10;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.3;
    pointer-events: none;
}

/* Call Controls */
.call-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 50px;
}

.btn-control {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    transform: scale(1.05);
}

.btn-control.active {
    background: rgba(255, 193, 7, 0.8);
    color: #000;
}

.btn-control.btn-danger {
    background: #dc3545;
}

.btn-control.btn-danger:hover {
    background: #bb2d3b;
}

.btn-control.btn-fullscreen {
    background: rgba(255, 255, 255, 0.1);
}

.btn-control.btn-muted {
    background: rgba(220, 53, 69, 0.6);
}

.btn-control.btn-muted:hover {
    background: rgba(220, 53, 69, 0.8);
}

.btn-control.btn-mode-pill {
    width: auto;
    min-width: 50px;
    height: 50px;
    padding: 0 18px;
    border-radius: 25px;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.call-controls .dropdown-menu {
    max-width: min(90vw, 320px);
}

.call-controls .dropdown-item {
    white-space: normal;
}

/* Audio-only calls: no video to show, so use the interlocutor's profile
   photo as background (set dynamically via UI.setCallBackground(), a dark
   gradient is baked into that inline value for legibility of the badge/
   controls on top) instead of an empty black canvas. Kept tall enough
   (like a video call, or taller) so the "modalità chiamata" dropup menu
   has room to open above the pill button - overflow:visible is the actual
   fix for that (a photo respects border-radius on its own, it doesn't
   need overflow:hidden the way the video/local-video-wrapper elements
   did; bug segnalato 2026-08-26, .call-controls è position:static qui e
   in un .video-container overflow:hidden troppo basso il menu veniva
   tagliato). background-size:contain (non cover) mostra la foto per
   intero senza ritagliarla - richiesta esplicita 2026-08-26, lo spazio
   attorno resta il gradiente scuro/colore di sfondo del container.
   justify-content:space-between ancora badge/durata in alto e i controlli
   in basso invece di ammassarli al centro (stessa richiesta). */
.video-container.audio-only {
    min-height: 460px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    overflow: visible;
}

.video-container.audio-only #remote-video,
.video-container.audio-only .local-video-wrapper,
.video-container.audio-only .video-subtitle-overlay {
    display: none;
}

.video-container.audio-only .call-overlay {
    position: static;
}

.video-container.audio-only .call-controls {
    position: static;
    transform: none;
}

@media (max-width: 575.98px) {
    .video-container.audio-only {
        min-height: 380px;
    }
}

/* Transcription Panel */
.transcript-container {
    max-height: 250px;
    overflow-y: auto;
    background: var(--pink-50);
}

.transcript-entry {
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.transcript-entry.local {
    background: var(--pink-50);
    margin-left: 20px;
}

.transcript-entry.remote {
    background: #fff;
    margin-right: 20px;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.transcript-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--pink-700);
}

.transcript-entry.local .transcript-username {
    color: var(--pink-800);
}

.transcript-time {
    font-size: 0.75rem;
    color: #6c757d;
}

.transcript-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
}

.transcript-text.original {
    color: #666;
    font-style: italic;
}

.transcript-translation {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #ddd;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--pink-700);
}

.transcript-translation.loading {
    color: #6c757d;
    font-style: italic;
}

.transcript-translation i {
    opacity: 0.7;
}

/* Chat Messages (distinct from voice transcription) */
.transcript-entry.chat-message {
    border-left: 3px solid #198754;
    background: #f8fff8;
}

.transcript-entry.chat-message.local {
    background: #e8f5e9;
    border-left-color: #198754;
}

.transcript-entry.chat-message.remote {
    background: #fff8e1;
    border-left-color: #ffc107;
}

.transcript-entry.chat-message .transcript-username {
    color: #198754;
}

.transcript-entry.chat-message.remote .transcript-username {
    color: #f57c00;
}

.chat-text {
    font-weight: 500;
}

.transcript-lang {
    font-size: 0.65rem;
    padding: 2px 5px;
    vertical-align: middle;
}

.transcript-engine {
    font-size: 0.65rem;
    padding: 2px 5px;
    vertical-align: middle;
}

.transcript-usage {
    font-size: 0.65rem;
    padding: 2px 5px;
    vertical-align: middle;
    font-weight: 400;
}

.transcript-entry.has-translation {
    border-left: 3px solid var(--pink-600);
}

/* Incoming Call Animation */
.pulse-ring {
    position: relative;
    display: inline-block;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(25, 135, 84, 0.3);
    animation: pulse 1.5s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Toast Container */
#toast-container {
    z-index: 9999;
}

/* Fullscreen styles */
.video-container:fullscreen {
    background: #000;
}

.video-container:fullscreen #remote-video {
    max-height: 100vh;
    min-height: 100vh;
}

.video-container:fullscreen .local-video-wrapper {
    width: 168px;
    height: 126px;
    top: 30px;
    right: 30px;
}

.video-container:fullscreen .call-controls {
    bottom: 30px;
}

.video-container:fullscreen .video-subtitle-overlay {
    bottom: 116px;
    font-size: 1.1rem;
}

/* Scrollbar styling */
.user-list::-webkit-scrollbar,
.transcript-container::-webkit-scrollbar {
    width: 6px;
}

.user-list::-webkit-scrollbar-track,
.transcript-container::-webkit-scrollbar-track {
    background: var(--pink-50);
}

.user-list::-webkit-scrollbar-thumb,
.transcript-container::-webkit-scrollbar-thumb {
    background: var(--pink-200);
    border-radius: 3px;
}

.user-list::-webkit-scrollbar-thumb:hover,
.transcript-container::-webkit-scrollbar-thumb:hover {
    background: var(--pink-400);
}

/* Responsive */
@media (max-width: 991.98px) {
    .local-video-wrapper {
        width: 84px;
        height: 63px;
        top: 10px;
        right: 10px;
    }

    .call-controls {
        gap: 8px;
        padding: 10px 15px;
    }

    .btn-control {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .video-subtitle-overlay {
        bottom: 90px;
        font-size: 0.85rem;
        max-width: 95%;
    }
}

@media (max-width: 575.98px) {
    .local-video-wrapper {
        width: 70px;
        height: 53px;
    }

    .btn-control {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .call-controls {
        gap: 6px;
        padding: 8px 12px;
    }
}

@media (max-width: 991.98px) {
    .btn-control.btn-mode-pill {
        height: 44px;
    }
}

@media (max-width: 575.98px) {
    .btn-control.btn-mode-pill {
        height: 40px;
        font-size: 0.75rem;
        padding: 0 12px;
    }
}

/* Profile Modal */
#profile-modal .form-control[readonly] {
    background-color: var(--pink-50);
}

#profile-modal .modal-header {
    background: linear-gradient(135deg, var(--pink-600) 0%, var(--pink-800) 100%);
    color: white;
}

#profile-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

#profile-modal .form-label {
    font-weight: 500;
    color: #495057;
}

#profile-modal .form-select {
    cursor: pointer;
}

#profile-modal .form-text {
    font-size: 0.8rem;
}

/* Contacts Modal */
#contacts-modal .modal-header {
    background: linear-gradient(135deg, var(--pink-500) 0%, var(--pink-700) 100%);
}

.contact-item {
    transition: background-color 0.2s ease;
}

.contact-item:hover {
    background-color: var(--pink-50);
}

.contact-item:last-child {
    border-bottom: none !important;
}

.contact-actions .btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0.25rem 0.4rem;
}

.contact-item:hover .contact-actions .btn {
    opacity: 1;
}

#contacts-list::-webkit-scrollbar {
    width: 6px;
}

#contacts-list::-webkit-scrollbar-track {
    background: var(--pink-50);
}

#contacts-list::-webkit-scrollbar-thumb {
    background: var(--pink-200);
    border-radius: 3px;
}

#contacts-list::-webkit-scrollbar-thumb:hover {
    background: var(--pink-400);
}

/* History Modal */
#history-modal .modal-header {
    background: linear-gradient(135deg, var(--pink-400) 0%, var(--pink-600) 100%);
}

/* Mobile Navigation (below lg breakpoint) */
.mobile-header {
    padding: 0.5rem 1rem;
}

.mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.mobile-tabbar.mobile-tabbar-hidden {
    display: none !important;
}

.mobile-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.5rem 0 0.375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    color: #6c757d;
}

.mobile-tab i {
    font-size: 1.15rem;
}

.mobile-tab.active {
    color: var(--primary-color);
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 64px;
    }
}

@media (max-width: 991.98px) {
    #history-modal .modal-body {
        max-height: none !important;
    }
}

/* Su mobile la sidebar Online/Offline sta impilata sopra l'area chiamata
   (le colonne Bootstrap non affiancano più sotto lg) - durante una
   videochiamata va nascosta per non dover scrollare oltre le liste
   contatti per vedere lo streaming. Su desktop (>=lg) resta sempre
   visibile accanto alla chiamata, come oggi: nessuna regola lì. */
@media (max-width: 991.98px) {
    #users-sidebar-col.sidebar-hidden-in-call {
        display: none;
    }
}

/* Login page signature */
.login-signature {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pink-300);
}

/* Sidebar Offline card toggle (collapsed by default) */
.offline-toggle .bi-chevron-down {
    transition: transform 0.2s ease;
}

.offline-toggle[aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
}

.lang-flag {
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 0.375rem;
    text-decoration: none;
    filter: grayscale(70%);
    opacity: 0.65;
    transition: filter 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.lang-flag:hover {
    filter: grayscale(0%);
    opacity: 1;
}

.lang-flag.active {
    filter: grayscale(0%);
    opacity: 1;
    background-color: var(--pink-100);
}

/* ============================================
   Invita amici (Profilo -> §3.3 piano di crescita)
   Card distinta dal resto del form: e' la leva di crescita che vogliamo
   far notare, non un altro campo anagrafico. Bordo/sfondo rosa tenue per
   restare nella palette; il badge del bonus usa un accento oro/ambra
   (stessa famiglia semantica di bi-gift-fill/bi-coin gia' usati altrove
   per crediti e regali) per far risaltare l'incentivo economico senza
   introdurre un colore estraneo alla palette dell'app.
   ============================================ */
.invite-card {
    background: linear-gradient(135deg, var(--pink-50), #fff);
    border: 1px solid var(--pink-100);
    border-radius: 0.75rem;
    padding: 1rem;
}

.invite-card__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.invite-card__icon {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--pink-600);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.invite-card__title {
    font-weight: 600;
    color: var(--pink-900);
}

.invite-card__subtitle {
    font-size: 0.825rem;
    color: #6c757d;
    margin-top: 0.1rem;
}

.invite-card__link {
    margin-bottom: 0.75rem;
}

.invite-card__link .form-control {
    font-size: 0.8rem;
    background: #fff;
}

.invite-card__bonus {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.825rem;
}

.invite-card__bonus i {
    color: #d97706;
    font-size: 1rem;
    flex: 0 0 auto;
}

.user-avatar-clickable {
    cursor: pointer;
}

.social-gallery-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px dashed #ced4da;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}

.social-gallery-slot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-gallery-slot-empty {
    display: flex;
    gap: 0.35rem;
}

.social-gallery-slot-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}
