/* 
 * 2026 AI Landing Page Builder CSS
 * Modern Glassmorphism, Premium Dashboards & Device Simulator Frames
 */

/* --- Launcher & Menu Styles --- */
.ai-builder-badge {
    position: fixed;
    right: 20px;
    bottom: 165px; /* Aligned above other buttons */
    z-index: 2147483647 !important;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ff007f, #7928ca);
    border-radius: 50px;
    padding: 8px 20px 8px 8px;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 10px 30px rgba(255, 0, 127, 0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    animation: aiPulse 2.5s infinite;
    cursor: pointer;
    border: none;
    outline: none;
}
.ai-builder-badge:hover {
    transform: scale(1.05) translateY(-5px);
    animation: none;
    box-shadow: 0 15px 40px rgba(255, 0, 127, 0.6);
}
.ai-builder-badge .ai-icon {
    background: white;
    color: #ff007f;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    margin-right: 12px;
}
.ai-builder-badge .ai-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

@keyframes aiPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 127, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 0, 127, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 127, 0); }
}

@media (max-width: 768px) {
    .ai-builder-badge {
        bottom: 200px;
        left: 15px;
        right: auto;
        padding: 6px 15px 6px 6px;
    }
    .ai-builder-badge .ai-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin-right: 8px;
    }
    .ai-builder-badge .ai-text {
        font-size: 0.8rem;
    }
}

/* --- Input Modal Container --- */
.ai-builder-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2147483647 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.ai-builder-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ai-builder-modal-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
    width: 550px;
    max-width: 92%;
    border-radius: 24px;
    overflow: hidden;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    font-family: 'Montserrat', sans-serif;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    max-height: 82vh !important;
}

.ai-builder-modal-overlay.active .ai-builder-modal-card {
    transform: scale(1) translateY(0);
}

.ai-builder-modal-header {
    background: linear-gradient(135deg, #1f2937, #111827);
    color: white;
    padding: 24px 30px;
    position: relative;
}

.ai-builder-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-builder-modal-header p {
    margin: 6px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.ai-builder-modal-close {
    position: absolute !important;
    right: 25px !important;
    top: 25px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    font-size: 1.1rem !important;
    transition: background 0.2s, transform 0.2s;
}

.ai-builder-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    transform: rotate(90deg) !important;
}

.ai-builder-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.ai-form-group {
    margin-bottom: 22px;
}

.ai-form-group label {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 8px;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-form-input, .ai-form-select, .ai-form-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.95rem;
    color: #0f172a;
    transition: all 0.3s ease;
    outline: none;
}

.ai-form-input:focus, .ai-form-select:focus, .ai-form-textarea:focus {
    border-color: #ff007f;
    background: #ffffff;
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.15);
}

.ai-form-textarea {
    height: 100px;
    resize: none;
}

.ai-submit-btn {
    width: 100%;
    padding: 14px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ff007f, #7928ca);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 0, 127, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.ai-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 0, 127, 0.45);
}

.ai-submit-btn:active {
    transform: translateY(0);
}

/* --- Loader Animation --- */
.ai-loader-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    text-align: center;
}

.ai-loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 0, 127, 0.15);
    border-radius: 50%;
    border-top-color: #ff007f;
    animation: aiSpin 1s linear infinite;
    margin-bottom: 20px;
}

.ai-loader-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.ai-loader-subtext {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 6px;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

/* --- Fullscreen Preview Overlay --- */
.ai-preview-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 99999999 !important;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.ai-preview-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Preview Toolbar Dashboard --- */
.ai-preview-toolbar {
    height: 70px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    color: white;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Montserrat', sans-serif;
}

.ai-toolbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-toolbar-logo-badge {
    background: linear-gradient(135deg, #ff007f, #7928ca);
    color: white;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.ai-toolbar-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.ai-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Device Simulator Segment */
.ai-device-toggle {
    display: flex;
    background: #0f172a;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #334155;
}

.ai-device-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 38px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
}

.ai-device-btn:hover {
    color: #e2e8f0;
}

.ai-device-btn.active {
    background: #1e293b;
    color: #ff007f;
}

/* Theme Controller Styles */
.ai-theme-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-theme-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-theme-dropdown {
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border 0.3s;
}

.ai-theme-dropdown:focus {
    border-color: #ff007f;
}

/* Color Picker Module */
.ai-color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 1px solid #334155;
    padding-left: 15px;
}

.ai-color-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-color-item label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

.ai-color-picker-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #475569;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-color-picker-wrapper:hover {
    transform: scale(1.1);
}

.ai-color-input {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 34px;
    height: 34px;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: none;
}

/* Actions Section */
.ai-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-close-preview-btn {
    background: #e11d48 !important;
    color: #ffffff !important;
    border: 1px solid #be123c !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.2s;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.3) !important;
}

.ai-close-preview-btn:hover {
    background: #be123c !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 15px rgba(225, 29, 72, 0.5) !important;
}

/* --- Sandbox Iframe Preview Frame --- */
.ai-preview-frame-container {
    flex: 1;
    background: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    overflow: hidden;
    position: relative;
}

.ai-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    background: white;
    transition: width 0.4s ease, height 0.4s ease, border-radius 0.4s ease;
}

/* Simulated Devices Frames sizes */
.ai-preview-overlay.tablet-view .ai-preview-iframe {
    width: 768px;
    height: 1024px;
    max-height: 100%;
    border-radius: 24px;
    border: 12px solid #1e293b;
}

.ai-preview-overlay.mobile-view .ai-preview-iframe {
    width: 375px;
    height: 812px;
    max-height: 100%;
    border-radius: 36px;
    border: 12px solid #1e293b;
}

/* Hide theme dropdown & specific picker styling in dark mode */
body.dark-theme .ai-builder-modal-card {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
body.dark-theme .ai-builder-modal-header {
    background: #0f172a;
    border-bottom: 1px solid #334155;
}
body.dark-theme .ai-form-group label {
    color: #94a3b8;
}
body.dark-theme .ai-form-input, 
body.dark-theme .ai-form-select, 
body.dark-theme .ai-form-textarea {
    background: #0f172a;
    border-color: #334155;
    color: white;
}
body.dark-theme .ai-form-input:focus, 
body.dark-theme .ai-form-select:focus, 
body.dark-theme .ai-form-textarea:focus {
    border-color: #ff007f;
    background: #151e2e;
}
body.dark-theme .ai-loader-text {
    color: white;
}

/* Hide on printing */
@media print {
    .ai-builder-badge, .ai-builder-modal-overlay, .ai-preview-overlay {
        display: none !important;
    }
}

/* Mobile responsive fixes for preview toolbar */
@media (max-width: 768px) {
    .ai-preview-toolbar {
        padding: 0 12px !important;
        gap: 8px !important;
    }
    .ai-toolbar-logo-badge, 
    .ai-device-toggle, 
    .ai-color-picker-container,
    .ai-theme-label {
        display: none !important;
    }
    .ai-toolbar-title {
        font-size: 0.85rem !important;
        max-width: 100px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .ai-theme-dropdown {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    .ai-close-preview-btn {
        background: #dc2626 !important; /* High contrast solid bright red */
        color: #ffffff !important;
        border: 1px solid #b91c1c !important;
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
        font-weight: 800 !important;
    }
    .ai-close-preview-btn:hover {
        background: #991b1b !important;
        color: #ffffff !important;
    }
    .ai-builder-modal-body {
        padding: 20px 20px 90px 20px !important;
    }
    .ai-submit-btn {
        margin-bottom: 60px !important;
    }
}
