/* ==========================================================================
   LAYERCAKES AI STUDIO - REORGANIZED CHAT INTERFACE STYLES
   ========================================================================== */

/* ===== TABLE OF CONTENTS ===== */
/*
1. GLOBAL LAYOUT & BACKGROUND
2. TOP NAVIGATION & SIDEBAR SYSTEM
3. CHAT INTERFACE - MESSAGES & INPUT
4. MULTI-STEP WORKFLOW SYSTEM
5. FORM & INTERACTIVE ELEMENTS
6. MODALS & OVERLAYS
7. ANIMATIONS & EFFECTS
8. RESPONSIVE DESIGN - MOBILE FIRST
*/

/* ===== 1. GLOBAL LAYOUT & BACKGROUND ===== */
.bg-gradient-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ===== 2. TOP NAVIGATION & SIDEBAR SYSTEM ===== */

/* Global Top Navigation */
.global-top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2000;
    background: transparent !important;
}

/* Sidebar Toggle with Text */
.global-sidebar-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 0 15px !important;
    width: auto;
    height: 40px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
}

.sidebar-toggle-text {
    color: rgb(220, 220, 220);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.global-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.global-sidebar-toggle .custom-icon {
    max-height: 35px;
    width: auto;
    opacity: 0.8;
    transition: all 0.3s ease;
}

/* ===== NAVIGATION RIGHT ICONS CONTAINER ===== */
.nav-right-icons {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

/* Admin Gear */
.global-admin-gear {
    font-size: 1.2rem;
    color: white;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.global-admin-gear:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* Logout Button */
.global-logout-btn {
    font-size: 1.2rem;
    color: white;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.global-logout-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Global Sidebar */
.global-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    transform: translateX(-100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 0 32px rgba(255, 255, 255, 0.1) !important;
}

.global-sidebar.open {
    transform: translateX(0);
}

.global-sidebar-toggle.sidebar-open {
    left: 320px;
    color: #6c757d;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* BULLETPROOF SIDEBAR HIDING */
.force-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Main Content Area */
.main-content-with-sidebar {
    margin-left: 0;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding-top: 70px;
}

.main-content-with-sidebar.open {
    margin-left: 300px;
}

.main-content-full {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Sidebar Content */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    text-align: left;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
}

.sidebar-full-logo {
    max-height: 35px;
    width: auto;
    margin-bottom: 5px;
}

.version-text {
    color: rgba(235, 235, 235, 0.7);
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    margin-top: 2px;
    animation: subtleGlow 4s ease-in-out infinite;
}

/* Chat History List */
.chat-history-list {
    padding: 10px;
}

.chat-history-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.05);
}

.chat-history-item:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

.chat-history-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-history-date {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ===== 3. CHAT INTERFACE - MESSAGES & INPUT ===== */

/* Chat Container Structure */
.chat-container {
    height: calc(100vh - 170px);
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: hidden;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    position: relative;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
    min-height: 300px;
    max-height: 60vh;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    opacity: 0.8;
}

.welcome-message p {
    font-size: 1.1rem;
    opacity: 0.7;
    margin: 0;
}

/* Message Bubbles */
.message {
    display: block;
    margin-bottom: 20px;
    max-width: 600px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.3s ease;
}

.user-message {
    margin-left: auto;
    margin-right: 150px;
}

.ai-message {
    margin-left: 150px;
    margin-right: auto;
}

.message-content {
    max-width: 100%;
    padding: 12px 18px;
    border-radius: 18px;
    backdrop-filter: blur(20px) saturate(180%) !important;
    word-wrap: break-word;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.user-message .message-content {
    background: rgba(0, 123, 255, 0.3) !important;
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.ai-message .message-content {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white;
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    margin: 5px auto 20px auto;
    max-width: 600px;
    margin-left: 150px;
    height: 40px;
}

.thinking-content {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: pulseThinking 1.2s infinite ease-in-out;
    flex-shrink: 0;
    display: block;
}

.thinking-text {
    font-size: 0.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0;
    margin: 0;
}

/* Floating Input System */
.floating-input-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    z-index: 100;
    transition: all 0.3s ease;
    background: transparent !important;
}

.floating-input-container.centered {
    top: 30%;
    bottom: auto;
    transform: translate(-50%, -50%);
}

.input-container {
    position: relative;
    width: 100%;
}

/* Input Container with Glow Effect */
.input-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #761cd4, #21c47b, #f3cf26, #761cd4);
    background-size: 400% 400%;
    border-radius: 22px;
    animation: fullGlow 3s ease infinite;
    z-index: 0;
    opacity: 0.8;
    filter: blur(3px);
}

.integrated-input {
    position: relative;
    z-index: 2;
    border-radius: 20px;
    padding: 15px 50px 15px 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    color: white !important;
    resize: none;
    width: 100%;
    transition: all 0.3s ease;
}

.integrated-input:focus {
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.2) !important;
    outline: none;
}

.integrated-input::placeholder {
    color: rgba(56, 56, 56, 0.6) !important;
}

.send-button-integrated {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: transparent;
    border: none;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    z-index: 10;
    visibility: visible !important;
    opacity: 1 !important;
}

.send-button-integrated:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.send-button-integrated:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-disclaimer-text {
    text-align: center;
    font-size: 0.75rem;
    color: #d2dadc;
    margin-top: 8px;
    font-style: italic;
    opacity: 0.6;
    letter-spacing: 0.2px;
}

/* Suggestion Buttons */
.suggestion-buttons-container {
    margin-bottom: 20px;
    text-align: left;
    max-width: 600px;
    width: 100%;
}

.suggestion-title {
    color: #d2dadc;
    font-size: 0.65rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.suggestion-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn-suggestion {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px !important;
    color: white !important;
    padding: 8px 16px !important;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.btn-suggestion:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

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

.btn-suggestion i {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* ===== 4. MULTI-STEP WORKFLOW SYSTEM ===== */

/* Step Container Base */
.step-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.step-container.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
    animation: fadeIn 0.5s ease;
}

/* Step 1 - Normal Flow */
#step-1.active {
    position: relative;
    z-index: 10;
}

/* Steps 2,3,4 - Full Page Takeover */
#step-2.active,
#step-3.active,
#step-4.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent !important;
    backdrop-filter: none !important;
    z-index: 1000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Hide chat when steps 2-4 are active */
body.step-2-active #step-1,
body.step-2-active #chat-messages,
body.step-3-active #step-1, 
body.step-3-active #chat-messages,
body.step-4-active #step-1,
body.step-4-active #chat-messages {
    display: none !important;
    visibility: hidden !important;
}

/* ===== 5. FORM & INTERACTIVE ELEMENTS ===== */

/* Glass Cards */
.card {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 20px !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 0 32px rgba(255, 255, 255, 0.1) !important;
}

.card-body {
    background: transparent !important;
}

.card-title {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Form Elements */
.dynamic-form-container {
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px 5px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    color: white !important;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-text {
    color: rgba(255, 255, 255, 0.7) !important;
}

.form-control {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 12px !important;
    color: #333 !important;
    backdrop-filter: blur(10px);
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25) !important;
    color: #333 !important;
}

/* Step Actions */
.step-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    border-radius: 20px;
    padding: 8px 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn-lg {
    border-radius: 20px;
    padding: 10px 30px;
}

/* Button Variants */
.btn-primary {
    background: rgba(0, 123, 255, 0.8) !important;
    color: white !important;
}

.btn-primary:hover {
    background: rgba(0, 123, 255, 0.9) !important;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.btn-success {
    background: rgba(40, 167, 69, 0.8) !important;
    color: white !important;
}

.btn-success:hover {
    background: rgba(40, 167, 69, 0.9) !important;
}

.btn-outline-warning {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-color: rgba(255, 193, 7, 0.5) !important;
}

.btn-outline-warning:hover {
    background: rgba(255, 193, 7, 0.2) !important;
}

.btn-outline-success {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-color: rgba(40, 167, 69, 0.5) !important;
}

.btn-outline-success:hover {
    background: rgba(40, 167, 69, 0.2) !important;
}

/* ===== STEP 3 & 4 CONTENT BOXES - FIXED TEXT WRAPPING ===== */

/* Step 3 - Prompt Review */
.prompt-review {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    color: white !important;
    backdrop-filter: blur(10px);
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap !important; /* FIX: Allow text wrapping */
    word-wrap: break-word !important; /* FIX: Break long words */
    word-break: break-word !important; /* FIX: Break words if needed */
    line-height: 1.5;
}

/* Fix the pre tag inside prompt review */
.prompt-review pre {
    white-space: pre-wrap !important; /* FIX: Override pre default */
    word-wrap: break-word !important;
    word-break: break-word !important;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    background: transparent;
    border: none;
    padding: 0;
}

/* Step 4 - AI Generated Content */
.ai-generated-content {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    color: white !important;
    backdrop-filter: blur(10px);
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    word-wrap: break-word !important; /* FIX: Break long words */
    word-break: break-word !important; /* FIX: Break words if needed */
    white-space: normal !important; /* FIX: Allow normal text wrapping */
}

/* Ensure content inside AI generated content wraps properly */
#ai-generated-content {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

/* Scrollbar Styling for Better UX */
.prompt-review::-webkit-scrollbar,
.ai-generated-content::-webkit-scrollbar {
    width: 8px;
}

.prompt-review::-webkit-scrollbar-track,
.ai-generated-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.prompt-review::-webkit-scrollbar-thumb,
.ai-generated-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.prompt-review::-webkit-scrollbar-thumb:hover,
.ai-generated-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== 6. MODALS & OVERLAYS ===== */

/* Glass Modal */
.glass-modal {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(25px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 20px !important;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.25),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(0, 0, 0, 0.05) !important;
}

.glass-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: transparent !important;
}

.glass-modal .modal-title {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.glass-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: transparent !important;
}

.modal-backdrop {
    background-color: rgba(102, 126, 234, 0.7) !important;
}

.modal-backdrop.show {
    opacity: 0.8 !important;
}

/* Modal Chat Messages */
.modal-chat-messages {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.modal-message {
    margin-bottom: 15px;
    max-width: 100%;
}

.modal-user-message {
    margin-left: auto;
    margin-right: 0;
    max-width: 80%;
}

.modal-ai-message {
    margin-left: 0;
    margin-right: auto;
    max-width: 80%;
}

.modal-message-content {
    padding: 12px 18px;
    border-radius: 18px;
    backdrop-filter: blur(20px) saturate(180%) !important;
    word-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.modal-user-message .modal-message-content {
    background: rgba(0, 123, 255, 0.3) !important;
    color: white;
    border-bottom-right-radius: 4px;
}

.modal-ai-message .modal-message-content {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white;
    border-bottom-left-radius: 4px;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.preloader.d-none {
    display: none !important;
}

.preloader-image {
    max-height: 50px;
    width: auto;
}

/* AI Generated Tables */
.ai-table-container {
    margin: 15px 0;
    overflow-x: auto;
}

.ai-generated-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.ai-generated-table th {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.ai-generated-table td {
    padding: 10px 15px;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-generated-table tr:last-child td {
    border-bottom: none;
}

.ai-generated-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Mobile responsiveness for tables */
@media (max-width: 768px) {
    .ai-table-container {
        font-size: 0.9rem;
    }
    
    .ai-generated-table th,
    .ai-generated-table td {
        padding: 8px 10px;
    }
}

/* ===== 7. ANIMATIONS & EFFECTS ===== */

@keyframes subtleGlow {
    0%, 100% {
        opacity: 0.7;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

@keyframes pulseThinking {
    0% {
        transform: scale(0.7);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(0.7);
        opacity: 0.4;
    }
}

@keyframes fullGlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeInUp 0.5s ease;
}

/* Typing Animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 5px 0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #6c757d;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-5px); opacity: 1; }
}

/* ===== 8. RESPONSIVE DESIGN - MOBILE FIRST ===== */

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {
    /* Navigation & Sidebar */
    .global-sidebar-toggle {
        top: 15px;
        left: 15px;
        gap: 0 !important;
        padding: 0 10px !important;
    }
    
    .sidebar-toggle-text {
        display: none;
    }
    
    .nav-right-icons {
        top: 15px;
        right: 15px;
        gap: 8px;
    }
    
    .global-logout-btn,
    .global-admin-gear {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
    
    .global-sidebar-toggle.sidebar-open {
        left: 315px;
    }
    
    /* Chat Interface */
    .floating-input-container {
        width: 95%;
        bottom: 20px;
    }
    
    .main-content-with-sidebar.open .floating-input-container {
        width: calc(95% - 300px);
        left: calc(50% + 150px);
    }
    
    .message {
        max-width: 95%;
    }
    
    .main-content-with-sidebar.open .message {
        max-width: calc(95% - 300px);
    }
    
    /* Suggestion Buttons */
    .suggestion-buttons-container {
        text-align: center;
    }
    
    .suggestion-buttons {
        justify-content: center;
        gap: 6px;
    }
    
    .btn-suggestion {
        padding: 6px 12px !important;
        font-size: 0.75rem;
    }
    
    .suggestion-title {
        text-align: center;
    }
    
    /* Step Actions */
    .step-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .step-actions .btn {
        width: 100%;
        max-width: 250px;
        margin-bottom: 10px;
    }
    
    /* Full Page Steps */
    #step-2.active,
    #step-3.active,
    #step-4.active {
        padding: 10px;
    }

    /* Step 3 & 4 Content Boxes */
    .prompt-review,
    .ai-generated-content {
        padding: 15px;
        max-height: 250px;
        font-size: 0.9rem;
    }
    
    .prompt-review pre {
        font-size: 0.85rem;
    }
}

/* Mobile Devices (480px and below) */
@media (max-width: 480px) {
    /* Navigation & Sidebar */
    .global-sidebar-toggle.sidebar-open {
        left: calc(100vw - 60px);
    }
    
    .main-content-with-sidebar.open .floating-input-container {
        width: 95%;
        left: 50%;
    }
    
    /* Chat Interface */
    .message {
        max-width: 98%;
        width: 98%;
    }
    
    .main-content-with-sidebar.open .message {
        max-width: 98%;
    }
    
    /* Suggestion Buttons */
    .suggestion-buttons {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    
    .btn-suggestion {
        width: 100%;
        max-width: 200px;
        justify-content: center;
        padding: 8px 12px !important;
    }
    
    /* Cards & Layout */
    .card-body {
        padding: 20px !important;
    }
    
    /* Step Containers */
    #step-2.active .card,
    #step-3.active .card,
    #step-4.active .card {
        width: 95%;
    }

    /* Step 3 & 4 Content Boxes */
    .prompt-review,
    .ai-generated-content {
        padding: 12px;
        max-height: 200px;
    }
}

/* Small Mobile Devices (360px and below) */
@media (max-width: 360px) {
    .global-top-nav {
        padding: 0 10px;
    }
    
    .global-sidebar-toggle,
    .global-admin-gear {
        width: 35px;
        height: 35px;
    }
    
    .floating-input-container {
        bottom: 15px;
    }
    
    .integrated-input {
        padding: 12px 45px 12px 15px;
        font-size: 0.9rem;
    }
    
    .send-button-integrated {
        right: 8px;
        bottom: 8px;
    }
}