@use './snackbar.scss';

// Variables
:root {
    --ask-primary: #6366f1; // A more vibrant Indigo
    --ask-primary-hover: #4f46e5;
    --ask-bg: #f3f4f6;
    --ask-surface: #ffffff;
    --ask-sidebar-bg: #f9fafb;
    --ask-text-main: #111827;
    --ask-text-secondary: #6b7280;
    --ask-border: #e5e7eb;
    --ask-radius-lg: 24px; // Larger radius for a softer look
    --ask-radius-md: 12px;
    --ask-shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

// Reset
.ask-admin-app {
    margin-top: -20px;
    margin-left: -20px;
    margin-right: 0;
    /* Prevent horizontal scroll */
    width: calc(100% + 20px);
    /* Compensate for left margin only */

    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--ask-bg);
    min-height: calc(100vh - 32px);
    color: var(--ask-text-main);
    overflow-x: hidden;
    box-sizing: border-box;

    * {
        box-sizing: border-box;
    }
}

// Layout Wrapper
.ask-dashboard-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 95vh;
    padding: 40px;
    box-sizing: border-box;
}

// Main Card Container
.ask-dashboard-card {
    background: var(--ask-surface);
    border-radius: var(--ask-radius-lg);
    box-shadow: var(--ask-shadow-card);
    width: 100%;
    max-width: 1400px; // Significantly wider
    min-height: 800px; // Taller
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.5); // Subtle border
}

// Header
.ask-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #fff;
    padding: 30px 50px; // More padding
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;

    // Modern Curve
    // We'll use a pseudo-element for a more complex curve if needed, 
    // but a simple large radius works well for this style.
    border-bottom-right-radius: 80px;

    .ask-header-content {
        .ask-header-title {
            display: flex;
            align-items: center;
            gap: 16px;

            h1 {
                color: #fff;
                font-size: 26px;
                font-weight: 800;
                margin: 0;
                letter-spacing: -0.025em;
            }

            .ask-version {
                background: rgba(255, 255, 255, 0.15);
                backdrop-filter: blur(4px);
                font-size: 11px;
                font-weight: 700;
                padding: 4px 12px;
                border-radius: 9999px;
                color: #fff;
                border: 1px solid rgba(255, 255, 255, 0.1);
            }
        }

        .ask-header-desc {
            margin: 8px 0 0;
            color: rgba(255, 255, 255, 0.8);
            font-size: 15px;
            max-width: 600px;
            font-weight: 400;
        }
    }

    .ask-header-actions {
        button {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #fff;
            padding: 12px 24px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;

            &:hover {
                background: rgba(255, 255, 255, 0.2);
                transform: translateY(-1px);
            }
        }
    }
}

// Body (Sidebar + Content)
.ask-dashboard-body {
    display: flex;
    flex-grow: 1; // Take up remaining height
}

// Sidebar
.ask-sidebar {
    width: 280px; // Wider sidebar
    flex-shrink: 0;
    background: var(--ask-sidebar-bg);
    padding: 40px 30px;
    border-right: 1px solid var(--ask-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .ask-sidebar-menu {
        display: flex;
        flex-direction: column;
        gap: 12px;

        .ask-sidebar-group-title {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #9ca3af;
            font-weight: 700;
            margin: 24px 0 12px 16px; // Spacing

            &:first-child {
                margin-top: 0;
            }
        }

        .ask-sidebar-item {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 14px 20px;
            border: 1px solid transparent; // prevent layout shift
            background: transparent;
            color: var(--ask-text-secondary);
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            border-radius: var(--ask-radius-md);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            text-align: left;
            width: 100%;

            svg {
                width: 20px;
                height: 20px;
                opacity: 0.5;
                transition: opacity 0.2s;
            }

            &:hover {
                background: #fff;
                color: var(--ask-text-main);
                box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);

                svg {
                    opacity: 0.8;
                }
            }

            &.active {
                background: #fff;
                color: var(--ask-primary);
                border-color: rgba(99, 102, 241, 0.1);
                box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.1);
                font-weight: 600;

                svg {
                    opacity: 1;
                    fill: var(--ask-primary);
                }
            }
        }
    }

    .ask-sidebar-promo {
        margin-top: 40px;

        .ask-promo-card {
            background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
            border-radius: 20px;
            padding: 24px;
            color: #fff;
            position: relative;
            overflow: hidden;
            box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.4);

            &::after {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
                pointer-events: none;
            }

            h3 {
                color: #fff;
                font-size: 18px;
                margin: 0 0 12px 0;
                font-weight: 700;
                letter-spacing: -0.01em;
            }

            ul {
                margin: 0 0 20px 0;
                padding: 0;
                list-style: none;

                li {
                    font-size: 13px;
                    margin-bottom: 8px;
                    display: flex;
                    align-items: center;
                    opacity: 0.95;
                    font-weight: 500;

                    &::before {
                        content: '✓';
                        margin-right: 8px;
                        font-weight: 800;
                        background: rgba(255, 255, 255, 0.2);
                        width: 16px;
                        height: 16px;
                        border-radius: 50%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 10px;
                    }
                }
            }

            .ask-btn-pro {
                background: #fff;
                color: #7c3aed;
                border: none;
                width: 100%;
                padding: 12px;
                border-radius: 12px;
                font-weight: 700;
                font-size: 14px;
                cursor: pointer;
                transition: all 0.2s;
                box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

                &:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
                }
            }
        }
    }
}

// Content Area
.ask-content-area {
    flex-grow: 1;
    padding: 60px 80px; // Much more breathing room
    background: #fff;
    overflow-y: auto; // Allow scrolling inside content if needed
}

// Settings Panel Styles
.ask-settings-panel {
    max-width: 800px;
    margin: 0 auto; // Center content in the large area

    .ask-panel-header {
        margin-bottom: 40px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 20px;
        border-bottom: 1px solid var(--ask-border);

        h2 {
            margin: 0;
            font-size: 28px;
            color: var(--ask-text-main);
            font-weight: 800;
            letter-spacing: -0.02em;
        }
    }

    .ask-form-section {
        margin-bottom: 50px;

        h3 {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 24px;
            color: var(--ask-text-main);
        }

        .components-base-control {
            margin-bottom: 32px;
        }

        .components-base-control__label {
            font-size: 15px;
            font-weight: 600;
            color: var(--ask-text-main);
            margin-bottom: 10px;
        }

        .components-base-control__help {
            font-size: 13px;
            color: #9ca3af;
        }

        .components-text-control__input {
            border: 2px solid #e5e7eb;
            border-radius: 12px;
            padding: 14px 16px;
            font-size: 16px;
            box-shadow: none;
            transition: all 0.2s;
            background: #f9fafb;

            &:focus {
                background: #fff;
                border-color: var(--ask-primary);
                box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
            }

            &:hover {
                border-color: #d1d5db;
            }
        }

        // Improve Toggle Control
        .components-toggle-control .components-base-control__field {
            align-items: center;
        }
    }

    .ask-form-actions {
        margin-top: 60px;
        padding-top: 30px;
        border-top: 1px solid var(--ask-border);
        display: flex;
        gap: 16px;

        button.components-button.is-primary {
            background-color: var(--ask-primary);
            padding: 14px 32px;
            border-radius: 12px;
            font-weight: 600;
            font-size: 16px;
            height: auto;

            &:hover {
                background-color: var(--ask-primary-hover);
                transform: translateY(-1px);
                box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
            }

            &:active {
                transform: translateY(0);
            }
        }
    }
}

// Footer
.ask-footer-credits {
    text-align: center;
    margin-top: 30px;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 500;
}



// Media Queries for Responsiveness
@media screen and (max-width: 1024px) {
    .ask-dashboard-layout {
        padding: 20px;
    }

    .ask-dashboard-card {
        min-height: auto;
    }

    .ask-header {
        padding: 24px 30px;

        .ask-header-content {
            .ask-header-title h1 {
                font-size: 22px;
            }
        }
    }

    .ask-content-area {
        padding: 40px;
    }
}

@media screen and (max-width: 768px) {
    .ask-dashboard-layout {
        padding: 10px;
        margin-top: 20px;
    }

    .ask-dashboard-card {
        border-radius: var(--ask-radius-md);
        margin-bottom: 20px;
    }

    .ask-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding: 24px;
        border-bottom-right-radius: 40px;

        .ask-header-actions {
            width: 100%;

            button {
                width: 100%;
                justify-content: center;
            }
        }
    }

    .ask-dashboard-body {
        flex-direction: column;
    }

    .ask-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--ask-border);
        padding: 24px;
    }

    .ask-content-area {
        padding: 24px;
    }

    .ask-settings-panel {
        .ask-panel-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 16px;

            h2 {
                font-size: 24px;
            }
        }

        .ask-form-actions {
            flex-direction: column;

            button {
                width: 100%;
                justify-content: center;
            }
        }
    }
}