@import "../bootstrap/variables";

html {
    overflow: hidden;

    @media (max-width: $screen-sm-max) {
        overflow-y: auto;
        overflow-x: hidden;
    }
}

body {
    height: 100vh;

    @media (max-width: $screen-sm-max) {
        overflow-y: auto;
        overflow-x: hidden;
    }
}


.agora-page {
    width: 100%;
    height: 100vh;

    &__sidebar {
        width: 394px;
        height: 100vh;
        background-color: var(--white);

        .sidebar-teacher-icon {
            transform: rotate(20deg);
            opacity: 0.1;
        }


        .sidebar-tabs {
            height: 45px;

            .navbar-item {
                color: var(--gray-500);

                &:before {
                    display: none;
                }

                &.active {
                    color: var(--black);
                    background-color: var(--white);
                }

                &:hover {
                    background-color: var(--white);
                }
            }
        }

        .sidebar-chats-cards {
            width: 100%;
            height: calc(100vh - 296px);
            transition: all .3s ease;
            overflow-x: hidden;
            overflow-y: auto;

            @media (max-width: $screen-sm-max) {
                height: calc(100vh - 320px);
            }
        }

        @media (max-width: $screen-sm-max) {
            position: fixed;
            top: 110%;
            width: 100vw;
            height: 100vh;
            z-index: 570;
            transition: top 0.4s cubic-bezier(0.43, 0.83, 0.54, 1.02), opacity .4s linear;

            &.show-sidebar {
                top: 0;
            }
        }
    }

    &__main {
        width: calc(100% - 394px);
        height: 100vh;

        &-content {
            width: 100%;
            height: calc(100% - 71px);
            padding: 16px;
            background-color: var(--gray);
            transition: all .3s ease;
            overflow-x: hidden;
            overflow-y: auto;
        }

        @media (max-width: $screen-sm-max) {
            width: 100%;
        }
    }

    &__player-card {
        position: relative;
        width: 100%;
        height: 880px;

        *, * > div, * video {
            border-radius: 12px;
        }

        video {
            width: 100% !important;
            height: 100% !important;
            object-fit: cover;
        }

        @media (max-width: $screen-sm-max) {
            height: 400px;
            min-height: 300px;

            video {
                width: 100% !important;
                height: 100% !important;
                object-fit: cover;
                background-color: #000;
            }
        }
    }

    &__top-header {
        height: 71px;
    }

    .remote-stream {
        width: 260px;
        height: 170px;

        *, * > div, * video {
            border-radius: 12px;
        }
    }

    .stream-bottom-actions {

        &__card-mask {
            position: absolute;
            inset: -8px;
            background: var(--gray-100);
            border-radius: 12px;
        }

        &__timer {
            min-width: 132px;
        }

        &__toggle-button {
            .active-icon {
                display: none;
            }

            .disable-icon {
                display: block;
            }

            &.active {
                .active-icon {
                    display: block;
                }

                .disable-icon {
                    display: none;
                }
            }
        }
    }

    .sidebar-user-card {
        &__mask {
            position: absolute;
            inset: 8px;
            bottom: -8px;
            border-radius: 16px;
            border: 1px solid var(--primary);
            opacity: 0.5;
            background-color: var(--white);
            z-index: 1;
        }
    }

    .chat-card {
        display: flex;
        flex-direction: column;

        .chat-user-info {
            .dot {
                width: 4px;
                height: 4px;
                background-color: var(--gray-300);
                border-radius: 50%;
            }
        }

        .chat-message {
            width: calc(100% - 100px);
        }

        &.own-chat {
            align-items: flex-end;

            .chat-user-info {
                flex-direction: row-reverse;
            }

            .chat-message {
                border-radius: 12px 0 12px 12px;
                background: var(--primary);
                color: var(--white);
            }
        }

        &.others-chat {
            align-items: flex-start;

            .chat-user-info {
                flex-direction: row;
            }

            .chat-message {
                border-radius: 0 12px 12px 12px;
                background: var(--gray-200);
                color: var(--gray-500);
            }
        }
    }
}

.learning-page-notify-counter {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    z-index: 2;

    .rtl {
        right: auto;
        left: 4px;
    }
}

//  Whiteboard Styles
.whiteboard-header {
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--gray-200);

    .whiteboard-page-info {
        border-left: 1px solid var(--gray-300);
        padding-left: 16px;
    }
}

.whiteboard-canvas-container {
    position: relative;
    width: 100%;
    height: 800px;
    overflow: hidden;

    @media (max-width: $screen-sm-max) {
        height: calc(100vh - 400px);
        min-height: 400px;
    }
}

.whiteboard-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background-color: white;
    border-radius: 0 0 12px 12px;
    transition: transform 0.2s ease;

    &:hover {
        cursor: crosshair;
    }

    // For students (view-only mode) - different cursor
    &.view-only {
        cursor: default;

        &:hover {
            cursor: default;
        }
    }
}

// Professional Toolbar Styles
.whiteboard-toolbar {
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;

    .tool-group {
        position: relative;

        &:not(:last-child)::after {
            content: '';
            position: absolute;
            bottom: -6px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 1px;
            background: var(--gray-300);
        }
    }

    .tool-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        color: var(--gray-600);
        background: transparent;
        border: 2px solid transparent;

        &:hover {
            background: var(--gray-100);
            color: var(--gray-800);
            transform: translateY(-1px);
        }

        &.active {
            background: var(--primary);
            color: white;
            box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);

            &:hover {
                background: var(--primary);
                color: white;
            }
        }

        i {
            font-size: 16px;
        }
    }

    // Color & Size Indicators in toolbar
    .current-color-indicator,
    .current-size-indicator {
        margin: auto;
        transition: all 0.2s ease;
    }

    .current-color-indicator {
        border: 2px solid rgba(255, 255, 255, 0.8) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    .current-size-indicator {
        background-color: #666 !important;
    }
}

// Color Palette Styles
.whiteboard-colors {
    top: 16px;
    left: 80px; // Position next to toolbar
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 11; // Higher than toolbar

    .color-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .color-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        cursor: pointer;
        border: 3px solid white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.2s ease;

        &:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
        }

        &.active {
            border-color: var(--primary);
            transform: scale(1.15);
            box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
        }
    }
}

// Brush Size Selector Styles
.whiteboard-brush-size {
    top: 16px;
    left: 80px; // Same position as color picker
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 11; // Higher than toolbar

    .size-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .size-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        background: transparent;
        border: 2px solid transparent;

        &:hover {
            background: var(--gray-100);
            transform: translateY(-1px);
        }

        &.active {
            background: var(--primary);
            box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);

            .size-dot {
                background: white !important;
            }
        }

        .size-dot {
            transition: all 0.2s ease;
        }
    }
}

// Page Navigation Styles
.whiteboard-pages {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

// Zoom Controls Styles
.whiteboard-zoom {
    bottom: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;

    .zoom-level {
        min-width: 40px;
        text-align: center;
        font-weight: 600;
    }
}

// Legacy toolbar for backward compatibility
.whiteboard-tools {
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;

    .js-whiteboard-tool {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;

        &:hover {
            background-color: var(--gray-100);
            transform: scale(1.05);
        }

        &.active {
            background-color: var(--primary);
            color: white !important;

            .icons {
                color: white !important;
            }
        }
    }
}

// Whiteboard tool colors
.js-whiteboard-tool[data-color="#000000"] {
    border: 2px solid #000000;

    &.active {
        background-color: #000000;
    }
}

.js-whiteboard-tool[data-color="#ff0000"] {
    border: 2px solid #ff0000;

    &.active {
        background-color: #ff0000;
    }
}

.js-whiteboard-tool[data-color="#0000ff"] {
    border: 2px solid #0000ff;

    &.active {
        background-color: #0000ff;
    }
}

.js-whiteboard-tool[data-tool="eraser"] {
    border: 2px solid var(--gray-400);

    &.active {
        background-color: var(--gray-400);
    }
}

// Responsive improvements for whiteboard
@media (max-width: $screen-sm-max) {
    .whiteboard-tools {
        flex-direction: row;
        top: auto;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        gap: 4px;
        padding: 12px 16px;

        .js-whiteboard-tool {
            width: 32px;
            height: 32px;
        }
    }
}

