/* Base styles for Bari Meeting - Common to all viewports */

:root {
    --bari-dark-blue: #0070cc;
    --bari-medium-blue: #0090ff;
    --bari-grey: #455A64;
    --bari-black: #000000;
    --bari-white: #FFFFFF;
    --background-color: #001f3f;
    --text-color: #FFFFFF;
    --card-background: var(--bari-white);
    --vh: 1vh;
    --card-border: #E0E0E0;
    --button-primary-bg: #0090ff;
    --button-primary-hover-bg: #0070cc;
    --control-bg: rgba(69, 90, 100, 0.9);
    --control-icon-color: var(--bari-white);
    --danger-color: #DC3545;
    --gradient-start: #0070cc;
    --gradient-end: #0090ff;
    --glass-bg: rgba(255,255,255,0.06);
    --glass-border: rgba(255,255,255,0.12);
    --chat-width: 330px;
    --transition: 0.28s cubic-bezier(.4,.0,.2,1);
    --recording-color: #DC3545;
}

/* Recording pulse animation */
@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

body {
    font-family: 'Nunito', sans-serif;
    background: #001f3f;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #FFFFFF;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.meeting-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#join-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 20px;
}

.join-card {
    max-width: 450px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 12px 48px 0 rgba(31, 38, 135, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.join-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 56px 0 rgba(31, 38, 135, 0.3);
}

.join-card .card-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: var(--bari-medium-blue);
    text-align: center;
    padding: 25px 20px 20px 20px;
    border-bottom: 1px solid rgba(0, 144, 255, 0.1);
    border-radius: 20px 20px 0 0;
}

.join-card .card-body {
    padding: 30px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0 0 20px 20px;
}

.form-control {
    border-radius: 14px;
    padding: 14px 18px;
    border: 2px solid #e8eaed;
    background: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #1a1a1a; /* WCAG AAA compliant for input text */
}

.form-control::placeholder {
    color: #6b7280; /* WCAG AA compliant gray for placeholders */
    opacity: 1; /* Override browser defaults */
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f5f5f5;
    color: #4b5563; /* Slightly lighter for read-only state */
    cursor: not-allowed;
}

.form-control:focus {
    border-color: var(--bari-medium-blue);
    box-shadow: 0 0 0 4px rgba(0, 144, 255, 0.12);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

/* Remove focus borders on read-only meeting ID input */
#meeting-title[readonly]:focus {
    border-color: #e8eaed;
    box-shadow: none;
    transform: none;
    outline: none;
}

.btn-primary {
    background: #0090ff;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 144, 255, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 144, 255, 0.4);
    background: #0070cc;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.form-label {
    font-weight: 600;
    color: #1a1a1a; /* WCAG AAA compliant black for maximum readability */
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.2px; /* Improved readability */
}

/* Meeting Interface Base */
#meeting-interface {
    display: none;
    width: calc(100% - 40px);
    height: calc(100% - 20px);
    margin: 10px 20px;
    backdrop-filter: blur(28px) saturate(140%);
    background: rgba(255,255,255,0.55);
    box-shadow: 0 14px 42px -12px rgba(0,144,255,0.25), 0 4px 8px -2px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,144,255,0.10);
    overflow: hidden;
    border-radius: 22px;
}

#meeting-interface.active {
    display: flex;
    flex-direction: column;
}

/* Meeting Header */
.meeting-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(90deg, rgba(255,255,255,0.65), rgba(255,255,255,0.35));
    border-bottom: 1px solid rgba(0,144,255,0.18);
    backdrop-filter: blur(18px) brightness(1.05);
    color: #0090ff;
    z-index: 400;
}

.meeting-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.meeting-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg,#0090ff,#0070cc);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px -2px rgba(0,0,0,0.25);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.6);
}

.meeting-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meeting-title-text {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}

.meeting-participant {
    font-size: 13px;
    opacity: .85;
}

/* Meeting Body */
.meeting-body {
    flex: 1;
    display: flex;
    width: 100%;
    position: relative;
    overflow: hidden;
    height: 100%;
}

/* Chat Container Base */
.chat-container {
    width: var(--chat-width);
    max-width: var(--chat-width);
    background: linear-gradient(160deg, rgba(255,255,255,0.8), rgba(255,255,255,0.55));
    border-right: 1px solid rgba(0,144,255,0.18);
    color: #103a52;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(18px) saturate(170%);
    position: relative;
    transition: var(--transition);
}

.chat-header {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .5px;
    background: linear-gradient(90deg,rgba(255,255,255,0.8), rgba(255,255,255,0.55));
    border-bottom: 1px solid rgba(0,144,255,0.18);
    color: #0090ff;
}

.chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px 14px 10px 18px;
    scrollbar-width: thin;
    background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.3));
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-log::-webkit-scrollbar {
    width: 8px;
}

.chat-log::-webkit-scrollbar-track {
    background: transparent;
}

.chat-log::-webkit-scrollbar-thumb {
    background: rgba(0,144,255,0.35);
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.6);
}

.chat-log::-webkit-scrollbar-thumb:hover {
    background: rgba(0,144,255,0.5);
}

/* Chat Messages */
.chat-message {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    line-height: 1.4;
    animation: bubble-pop .28s ease-out forwards;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
}

.chat-message.mine {
    align-items: flex-end;
}

.chat-message.them {
    align-items: flex-start;
}

.chat-message.system {
    align-items: center;
    font-style: italic;
    color: #607080;
}

.chat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 6px 18px -12px rgba(0,0,0,0.45);
    word-break: break-word;
    background: #f2f5f8;
    color: #1f2a32;
}

.chat-message.mine .chat-bubble {
    background: #0090ff;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.chat-message.them .chat-bubble {
    background: #e5e5ea;
    color: #1f2a32;
    border-bottom-left-radius: 6px;
}

.chat-message.system .chat-bubble {
    background: rgba(255,255,255,0.65);
    color: #607080;
    border-radius: 14px;
    box-shadow: none;
}

.chat-meta {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    color: inherit;
}

.chat-meta span + span {
    margin-left: 6px;
}

@keyframes bubble-pop {
    0% { opacity: 0; transform: translateY(8px) scale(0.94); }
    60% { opacity: 1; transform: translateY(-2px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Input */

.chat-input {
    display: flex;
    align-items: center;
    margin-top: 0;
    padding: 10px;
    gap: 8px;
    background: linear-gradient(180deg,rgba(255,255,255,0.65), rgba(255,255,255,0.3));
    border-top: 1px solid rgba(0,144,255,0.18);
}

.chat-input input {
    flex: 1;
    border: 1px solid rgba(0,144,255,0.25);
    background: rgba(255,255,255,0.85);
    color: #0D2C3F;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    min-height: 40px;
}

.chat-input input:focus {
    border-color: #0090ff;
    box-shadow: 0 0 0 3px rgba(0,144,255,0.25);
}

.chat-input button {
    border: 1px solid #0090ff;
    background: linear-gradient(130deg,#0090ff,#0070cc);
    box-shadow: 0 6px 14px -6px rgba(0,144,255,0.5);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: .4px;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 40px;
}

.chat-input button:hover {
    filter: brightness(1.07);
    transform: translateY(-2px);
}

.chat-input button:active {
    transform: translateY(0);
}

/* Video Container */
.video-main-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.video-surface {
    flex: 1;
    position: relative;
}

/* Video Grid Base - No bezels */
.video-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    /* No padding for maximum video space */
    padding: 0;
    align-items: center;
    justify-content: center;
}

/* Video Tiles - No bezels */
.video-tile {
    position: relative;
    background: #1c2630;
    border: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    /* Fill available space with no bezels */
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    flex: 1 1 360px;
}

.video-tile video {
    width: 100%;
    height: 100%;
    /* Contain to maintain aspect ratio without cropping */
    object-fit: contain;
    background: #1c2630;
    display: block;
}

/* Single remote video - full screen, no bezels */
.video-grid.single-remote {
    gap: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
}
.video-grid.single-remote .video-tile {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
}
.video-grid.single-remote .video-tile video {
    object-fit: cover !important;
}

.video-tile .nameplate {
    position: absolute;
    bottom: 90px;
    left: 10px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    color: var(--bari-white);
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px -4px rgba(0,0,0,0.6);
}

/* Video Title Container aligned with local video */
.video-title-container {
    position: absolute;
    bottom: 60px;
    left: 20px;
    width: 180px;
    z-index: 10;
    display: none;
}

.video-title-text {
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.6);
}

/* Local Video */
.local-video-container {
    position: absolute;
    bottom: 90px;
    right: 24px;
    width: 180px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #1c2630;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 6px 24px -8px rgba(0,0,0,0.6);
    z-index: 10;
    display: block;
}

.local-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #1c2630;
}

.local-video-nameplate {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    text-align: center;
    font-weight: 500;
}

#local-video {
    display: block !important;
    visibility: visible !important;
}

/* Waiting Tile */
#waiting-tile {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    background: rgba(0,0,0,0.3);
    padding: 40px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Meeting Controls Base */
.meeting-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 1000;
}

.control-btn {
    background: linear-gradient(145deg, #2a3a44, #1a262f);
    border: 1px solid rgba(255,255,255,0.12);
    width: 60px;
    height: 60px;
    border-radius: 26px;
    color: var(--control-icon-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.control-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08), transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.control-btn:hover::after {
    opacity: 1;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.control-btn.active {
    background: var(--bari-white);
    color: var(--bari-dark-blue);
}

.control-btn.danger {
    background: #dc3545 !important;
    border: none !important;
    box-shadow: 0 8px 20px -6px rgba(220,53,69,0.7) !important;
    width: 70px !important;
    height: 70px !important;
    border-radius: 50% !important;
}

.control-btn.danger:hover {
    background: #c82333 !important;
    filter: brightness(1.05);
}

.control-btn.danger:active {
    filter: brightness(.9);
}

.control-btn img {
    width: 30px;
    height: 30px;
    filter: invert(1);
}

.control-btn.danger img {
    width: 32px !important;
    height: 32px !important;
    filter: invert(1) !important;
}

.control-btn.active img {
    filter: none;
}

/* Force hide video title container globally */
.video-title-container,
#video-title-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Mute Indicator on Local Video */
.mute-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
    z-index: 20;
}

.mute-indicator img {
    width: 18px;
    height: 18px;
    filter: invert(1);
}

/* Microphone Button - Active (Unmuted) State */
#toggle-mute {
    background: linear-gradient(145deg, #10B981, #059669) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.4) !important;
}

#toggle-mute:hover {
    background: linear-gradient(145deg, #059669, #047857) !important;
    box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.6) !important;
}

/* Microphone Button - Muted State */
#toggle-mute.muted {
    background: linear-gradient(145deg, #86EFAC, #6EE7B7) !important;
    border: 1px solid rgba(134, 239, 172, 0.4) !important;
    box-shadow: 0 4px 12px -4px rgba(134, 239, 172, 0.3) !important;
}

#toggle-mute.muted:hover {
    background: linear-gradient(145deg, #6EE7B7, #5EEAD4) !important;
    box-shadow: 0 6px 16px -4px rgba(134, 239, 172, 0.5) !important;
}
