// Import Google Fonts
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

// Variables
$font-stack: 'Roboto', sans-serif;
$primary-color: #333;
$secondary-color: #007bff;
$background-color: #f4f4f9;
$dark-background-color: #333;
$dark-primary-color: #f4f4f9;
$dark-secondary-color: #4a90e2;
$border-radius: 8px;
$box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
$transition-time: 0.3s;
$icon-size: 20px;
$header-font-size: 1.2rem;
$button-font-size: 0.9rem;
$input-font-size: 0.9rem;

// Reset and base styles
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: $font-stack;
    background-color: $background-color;
    color: $primary-color;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    transition: background-color $transition-time, color $transition-time;
}

body.dark-mode {
    background-color: $dark-background-color;
    color: $dark-primary-color;
}

// Chat wrapper
.chat-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: #fff;
    box-shadow: $box-shadow;
    border-radius: $border-radius;
    overflow: hidden;
    transition: all $transition-time ease;

    &.collapsed .side-panel {
        width: 60px;

        .collapse-button {
            transform: rotate(180deg);
        }
    }

    &.dark-mode {
        background: $dark-background-color;
        .side-panel {
            background: #444;
            color: $dark-primary-color;

            .collapse-button {
                background: $dark-secondary-color;
            }
        }

        .main-chat {
            .chat-header {
                background: $dark-background-color;
                border-bottom: 1px solid #555;

                .icons .icon-settings,
                .icons .icon-notifications {
                    color: $dark-primary-color;
                }
            }

            .chat-container {
                background: $dark-background-color;

                .chat-box {
                    background: #555;
                    box-shadow: none;

                    .chat-response {
                        background: #444;
                    }

                    .chat-form {
                        textarea {
                            background: #666;
                            border: 1px solid #777;
                            color: $dark-primary-color;
                        }

                        button {
                            background-color: $dark-secondary-color;
                        }
                    }
                }
            }
        }
    }
}

// Side panel
.side-panel {
    width: 250px;
    background: #eaeaea;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid #ddd;
    transition: width $transition-time ease, background-color $transition-time, color $transition-time;

    .side-panel-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;

        h2 {
            font-size: $header-font-size;
            margin-bottom: 20px;
        }

        .collapse-button,
        .dark-mode-toggle {
            background: $secondary-color;
            color: #fff;
            border: none;
            padding: 10px;
            border-radius: $border-radius;
            cursor: pointer;
            transition: transform $transition-time ease, background-color $transition-time;
            margin-top: 10px;

            &:hover {
                background-color: darken($secondary-color, 10%);
            }
        }

        .dark-mode-toggle {
            background: $secondary-color;
        }
    }
}

// Main chat area
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;

    .chat-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        background: #fff;
        border-bottom: 1px solid #ddd;
        transition: background-color $transition-time, border-bottom $transition-time;

        h1 {
            font-size: $header-font-size;
            display: flex;
            align-items: center;

            img {
                width: 32px;
                height: 32px;
                margin-right: 10px;
            }
        }

        .icons {
            display: flex;
            align-items: center;

            .icon-settings,
            .icon-notifications {
                font-size: $icon-size;
                margin-left: 10px;
                cursor: pointer;
                transition: color $transition-time;

                &:hover {
                    color: $secondary-color;
                }
            }
        }
    }

    .chat-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 15px;
        background: $background-color;
        transition: background-color $transition-time;

        .chat-box {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            border-radius: $border-radius;
            box-shadow: $box-shadow;
            background: #fff;
            padding: 15px;
            overflow: hidden;
            transition: background-color $transition-time, box-shadow $transition-time;

            .chat-response {
                flex: 1;
                overflow-y: auto;
                padding: 10px;
                background: $background-color;
                border-radius: $border-radius;
                transition: background-color $transition-time;

                .chat-message {
                    padding: 10px;
                    margin-bottom: 10px;
                    border-radius: $border-radius;
                    background-color: #fff;
                    box-shadow: $box-shadow;
                }

                p {
                    margin-bottom: 8px;
                    font-size: $input-font-size;
                }
            }

            .chat-form {
                display: flex;
                align-items: center;
                margin-top: 10px;

                textarea {
                    flex: 1;
                    padding: 8px;
                    border-radius: $border-radius;
                    border: 1px solid #ccc;
                    font-family: $font-stack;
                    font-size: $input-font-size;
                    resize: none;
                    margin-right: 10px;
                    transition: background-color $transition-time, border $transition-time, color $transition-time;
                }

                button {
                    padding: 8px 15px;
                    border: none;
                    border-radius: $border-radius;
                    background-color: $secondary-color;
                    color: white;
                    cursor: pointer;
                    font-family: $font-stack;
                    font-size: $button-font-size;
                    transition: background-color $transition-time;

                    &:hover {
                        background-color: darken($secondary-color, 10%);
                    }
                }
            }
        }
    }
}

// Responsive Design
@media (max-width: 768px) {
    .chat-wrapper {
        flex-direction: column;
        height: 100vh;
    }

    .side-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .main-chat {
        .chat-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .chat-container {
            padding: 10px;
        }
    }
}
