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

html, body {
  height: 100%;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #0f0f0f;
    color: #e0e0e0;
    height: 100vh;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Add animations */
@keyframes expandBox {
    from {
        opacity: 0.7;
        transform: scale(0.85) translateX(-40px) translateY(-40px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0) translateY(0);
    }
}

@keyframes scaleDown {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0.9;
        transform: scale(0.98);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shiftRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(10px);
    }
}

/* Main Container */
.meet-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #0f0f0f;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: hidden;
}

/* Main Video Section */
.main-video-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #0f0f0f;
    position: relative;
    overflow-y: auto;
}

/* Participants Grid */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    height: fit-content;
    transition: all 0.3s ease;
}

/* When a box is expanded */
.participants-grid.has-expanded {
    grid-template-columns: 2fr 1fr 1fr;
    grid-auto-rows: auto;
    width: 100%;
    align-items: start;
}

.participants-grid.has-expanded .participant-box:not(.expanded) {
    max-height: none;
    height: auto;
    min-height: 180px;
}

/* Participant Box */
.participant-box {
    background: linear-gradient(135deg, #1a1a1a 0%, #242424 100%);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.participant-box:hover:not(.expanded) {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
}

/* Expanded Participant Box */
.participant-box.expanded {
    grid-column: 1 / 2;
    grid-row: 1 / span 3;
    height: calc(100vh - 240px);
    width: 100%;
    transform: none;
    z-index: 10;
    animation: expandBox 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.participant-box.expanded .video-box {
    flex: 1;
    animation: slideIn 0.8s ease-out 0.15s forwards;
}

.participant-box.expanded .box-info {
    padding: 16px;
    font-size: 16px;
    animation: slideIn 0.8s ease-out 0.25s forwards;
}

.participant-box.expanded .box-name {
    font-size: 16px;
}

/* Small boxes animation when grid changes */
.participants-grid.has-expanded .participant-box:not(.expanded) {
    animation: scaleDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Video Box */
.video-box , .localVideo {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #333333;
     width: 100%;
    height: 100%;
    overflow: hidden;   /* clip any overflow from video */
}
.participant-box video {
    width: 100%;       /* fill the container's width */
    height: 100%;      /* fill the container's height */
    object-fit: cover; /* crop/fit nicely */
    transition: all 0.3s ease; /* smooth scaling */
    border-radius: 8px; /* optional: rounded corners */
}

.participants-panel .participants-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 4px; /* optional for spacing */
}
.participants-panel {
    transition: bottom 0.3s ease, opacity 0.3s ease;
}


.video-box i {
    font-size: 48px;
    color: #5a5a5a;
    opacity: 0.6;   
}

/* Box Info */
.box-info {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.3);
    min-height: 50px;
}

.box-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.box-status {
    font-size: 14px;
    color: #5a5a5a;
    margin-left: 8px;
    flex-shrink: 0;
}

.box-status i {
    font-size: 14px;
}

.box-status i:not(.fa-microphone-slash) {
    color: #31a24c;
}

.box-status .fa-microphone-slash {
    color: #f28482;
}

/* Right Side Participants Panel */
.participants-panel {
    width: 320px;
    background-color: #1a1a1a;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.5);
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header .badge {
    font-size: 12px;
    padding: 4px 8px;
}

/* Participants List */
.participants-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.participants-list::-webkit-scrollbar {
    width: 6px;
}

.participants-list::-webkit-scrollbar-track {
    background: transparent;
}

.participants-list::-webkit-scrollbar-thumb {
    background-color: #5a5a5a;
    border-radius: 3px;
}

.participants-list::-webkit-scrollbar-thumb:hover {
    background-color: #707070;
}

/* Participant Item */
.participant-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.participant-item:hover {
    background-color: #252525;
}

.participant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f73e7 0%, #ea4335 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.participant-details {
    flex: 1;
    margin-left: 12px;
    overflow: hidden;
}

.participant-title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: text-overflow;
    text-overflow: ellipsis;
}

.participant-details small {
    font-size: 12px;
    color: #9aa0a6;
}

.participant-status {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #5a5a5a;
}

.participant-status i {
    font-size: 14px;
}

.participant-status i.active {
    color: #31a24c;
}

.participant-status i.muted {
    color: #f28482;
}

/* Control Bar */
.control-bar {
    height: 100px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
    border-top: 2px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;  
    
    position: fixed !important;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0); /* iOS safe area */
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 10px);
  width: 100%;
  z-index: 10002 !important; /* ensure above participants panel */
  box-shadow: 0 -8px 40px rgba(0,0,0,0.75);
}

.control-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #505050, transparent);
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 24px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 32px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

/* Control Buttons */
.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #3a3a3a 0%, #2d2d2d 100%);
    border: 2px solid #454545;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    font-size: 20px;
    position: relative;
    overflow: hidden;
}

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

.control-btn:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: #4a4a4a;
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

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

.control-btn:active {
    transform: scale(0.98) translateY(-2px);
}

.control-btn.active {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    box-shadow: 0 0 20px rgba(60, 60, 60, 0.5);
}

.control-btn i {
    font-size: 24px;
    color: #fff;
    transition: all 0.3s ease;
}

.btn-label {
    font-size: 11px;
    color: #999999;
    text-align: center;
    max-width: 64px;
    word-wrap: break-word;
    line-height: 1.1;
    margin-top: 2px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.control-btn:hover .btn-label {
    color: #e0e0e0;
}

/* Microphone Button States */
.mic-btn.inactive {
    background: linear-gradient(135deg, #f28482 0%, #ea4335 100%);
    border-color: #d33425;
    box-shadow: 0 0 24px rgba(242, 132, 130, 0.4);
}

.mic-btn.inactive:hover {
    background: linear-gradient(135deg, #ea4335 0%, #d33425 100%);
    box-shadow: 0 0 32px rgba(242, 132, 130, 0.6);
}

.mic-btn.inactive i {
    color: #fff;
}

/* Camera Button States */
.camera-btn.inactive {
    background: linear-gradient(135deg, #f28482 0%, #ea4335 100%);
    border-color: #d33425;
    box-shadow: 0 0 24px rgba(242, 132, 130, 0.4);
}

.camera-btn.inactive:hover {
    background: linear-gradient(135deg, #ea4335 0%, #d33425 100%);
    box-shadow: 0 0 32px rgba(242, 132, 130, 0.6);
}

.camera-btn.inactive i {
    color: #fff;
}

/* Participants Button */
.participants-btn {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
}

.participants-btn:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: #4a4a4a;
}

/* Leave Button */
.leave-btn {
    background: linear-gradient(135deg, #f28482 0%, #ea4335 100%);
    border-color: #d33425;
    margin-left: 8px;
}

.leave-btn:hover {
    background: linear-gradient(135deg, #ea4335 0%, #d33425 100%);
    transform: scale(1.12) translateY(-4px);
    box-shadow: 0 12px 36px rgba(234, 67, 53, 0.5);
}

.leave-btn i {
    color: #fff;
}

/* Responsive Design */

/* Large Desktops (1440px and above) */
@media (min-width: 1440px) {
    .main-video-section {
        padding: 24px;
    }

    .participants-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .participants-panel {
        width: 360px;
        z-index: 10001;
    }

    .control-bar {
        height: 110px;
        padding: 0 30px;
    }

    .controls-group {
        gap: 28px;
        padding: 16px 40px;
    }

    .control-btn {
        width: 70px;
        height: 70px;
    }

    .control-btn i {
        font-size: 28px;
    }

    .btn-label {
        font-size: 12px;
    }
}

/* Laptops (1024px - 1439px) */
@media (max-width: 1439px) and (min-width: 1024px) {
    .main-video-section {
        padding: 20px;
    }

    .participants-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .participants-panel {
        width: 320px;
    }

    .control-bar {
        height: 100px;
    }

    .controls-group {
        gap: 24px;
        padding: 12px 32px;
    }

    .control-btn {
        width: 64px;
        height: 64px;
    }

    .control-btn i {
        font-size: 24px;
    }

    .btn-label {
        font-size: 11px;
    }
}

/* Tablets (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .main-video-section {
        padding: 16px;
    }

    .participants-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .participants-grid.has-expanded {
        grid-template-columns: 1.5fr 1fr;
    }

   .participant-box.expanded {
    grid-column: 1 / -1;
    height: calc(100vh - 240px);
    width: 100%;
    z-index: 10;
    position: relative;
    animation: expandBox 0.7s forwards;
}

.participant-box.expanded .video-box {
    width: 100%;
    height: 100%;
}


    .participants-panel {
        width: 280px;
        border-left: 1px solid #404040;
    }

    .panel-header h6 {
        font-size: 14px;
    }

    .control-bar {
        height: 90px;
        padding: 0 16px;
    }

    .controls-group {
        gap: 16px;
        padding: 10px 24px;
    }

    .control-btn {
        width: 56px;
        height: 56px;
    }

    .control-btn i {
        font-size: 20px;
    }

    .btn-label {
        font-size: 9px;
    }

    .main-video-section.m-3 {
        margin: 12px !important;
    }
}

/* Small Tablets & Large Phones (600px - 767px) */
@media (max-width: 767px) and (min-width: 600px) {
    .main-content {
        flex-direction: column;
    }

    .main-video-section {
        padding: 12px;
        flex: 1;
    }

    .participants-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .participants-grid.has-expanded {
        grid-template-columns: 1fr;
    }

    .participant-box.expanded {
        grid-column: 1 / -1;
        grid-row: auto;
        height: calc(100vh - 130px);
        width: 100%;
        position: relative;
        border-radius: 8px;
        z-index: 10;
    }

    .participant-box.expanded .video-box {
        aspect-ratio: auto;
        flex: 1;
    }

    .participants-panel {
        width: 100%;
        height: 200px;
        border-left: none;
        border-top: 1px solid #404040;
    }

    .panel-header {
        padding: 12px;
    }

    .panel-header h6 {
        font-size: 13px;
    }

    .participants-list {
        max-height: 150px;
    }

    .control-bar {
        height: 80px;
        padding: 0 12px;
    }

    .controls-group {
        gap: 12px;
        padding: 8px 16px;
    }

    .control-btn {
        width: 52px;
        height: 52px;
    }

    .control-btn i {
        font-size: 18px;
    }

    .btn-label {
        font-size: 8px;
    }

    .leave-btn {
        margin-left: 4px;
    }
}

/* Mobile Phones (480px - 599px) */
@media (max-width: 599px) and (min-width: 480px) {
    .main-content {
        flex-direction: column;
    }

    .main-video-section {
        padding: 8px;
        flex: 1;
    }

    .participants-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .participants-grid.has-expanded {
        grid-template-columns: 1fr;
    }

    .participant-box.expanded {
        grid-column: 1 / -1;
        grid-row: auto;
        height: calc(100vh - 120px);
        width: 100%;
        position: relative;
        border-radius: 8px;
        z-index: 10;
    }

    .participant-box.expanded .video-box {
        flex: 1;
    }

    .participants-panel {
        width: 100%;
        height: 150px;
        border-left: none;
        border-top: 1px solid #404040;
        display: none;
        position: fixed;
         bottom: 100px; /* match the height of control-bar */
        left: 0;
        right: 0;
        z-index: 1001;
    }

    .participants-panel.show {
        display: flex;
    }

    .panel-header {
        padding: 10px;
    }

    .panel-header h6 {
        font-size: 12px;
    }

    .participants-list {
        max-height: 110px;
    }

    .participant-item {
        padding: 8px 10px;
    }

    .participant-avatar {
        width: 32px;
        height: 32px;
        font-size: 10px;
    }

    .participant-title {
        font-size: 12px;
    }

    .control-bar {
        bottom: calc(env(safe-area-inset-bottom, 0) + 10px) !important; /* stay above mobile UI */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 99999 !important; /* ensure it stays above everything */
    }

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

    .control-btn {
        width: 48px;
        height: 48px;
    }

    .control-btn i {
        font-size: 16px;
    }

    .btn-label {
        display: none;
    }

    .leave-btn {
        margin-left: 0;
    }

    .main-video-section.m-3 {
        margin: 8px !important;
    }
}

/* Small Mobile Phones (below 480px) */
@media (max-width: 479px) {
    .main-content {
        flex-direction: column;
    }

    .main-video-section {
        padding: 4px;
        flex: 1;
    }

    .participants-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .participants-grid.has-expanded {
        grid-template-columns: 1fr;
    }

    .participant-box.expanded {
        grid-column: 1 / -1;
        grid-row: auto;
        height: calc(100vh - 80px);
        width: 100%;
        position: relative;
        border-radius: 8px;
        z-index: 10;
    }

    .participant-box {
        border-radius: 8px;
    }

    .participants-panel {
        width: 100%;
        height: 30vh;
        border-left: none;
        border-top: 1px solid #404040;
        display: none;
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        z-index: 1001;
        background-color: #2d2d2d;
    }

    .participants-panel.show {
        display: flex;
    }

    .panel-header {
        padding: 8px;
    }

    .panel-header h6 {
        font-size: 11px;
    }

    .participants-list {
        max-height: 80px;
    }

    .participant-item {
        padding: 6px 8px;
    }

    .participant-avatar {
        width: 28px;
        height: 28px;
        font-size: 9px;
    }

    .participant-title {
        font-size: 11px;
    }

    .participant-details small {
        font-size: 9px;
    }

    .control-bar {
        bottom: calc(env(safe-area-inset-bottom, 0) + 10px) !important; /* stay above mobile UI */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 99999 !important; /* ensure it stays above everything */
    }

    .controls-group {
        gap: 4px;
        padding: 4px 8px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

    .control-btn i {
        font-size: 14px;
    }

    .btn-label {
        display: none;
    }

    .leave-btn {
        margin-left: 0;
    }

    .main-video-section.m-3 {
        margin: 0 !important;
    }

    .box-info {
        min-height: 40px;
    }

    .box-name {
        font-size: 12px;
    }

    .box-status i {
        font-size: 12px;
    }
}
