/*
Theme Name: AI Cinematic Story Creator v1.7
Description: Enhanced WordPress theme with modern design, glassmorphism effects, and premium animations
Version: 1.7
Author: AI Story Creator Team
Text Domain: ai-cinematic-v17
*/

:root {
    /* Enhanced color palette with richer tones */
    --primary: #7C6CE7;
    --primary-light: #9C8CEF;
    --primary-dark: #5C4CBF;
    --primary-glow: rgba(124, 108, 231, 0.5);
    
    --secondary: #00D4FF;
    --secondary-glow: rgba(0, 212, 255, 0.4);
    
    --dark: #0A0A0F;
    --dark-elevated: #12121A;
    --light: #F8F9FA;
    --accent: #FF6B9D;
    --accent-glow: rgba(255, 107, 157, 0.3);
    --success: #00C9A7;
    
    /* Glassmorphism variables */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Chat theme variables */
    --chat-bg: #0A0A0F;
    --chat-container-bg: rgba(18, 18, 26, 0.7);
    --chat-message-user-bg: linear-gradient(135deg, var(--primary), var(--primary-light));
    --chat-message-ai-bg: rgba(255, 255, 255, 0.08);
    --suggestion-bg: rgba(124, 108, 231, 0.15);
    --suggestion-border: var(--primary);
    --suggestion-hover-bg: rgba(124, 108, 231, 0.35);
    --suggestion-text: var(--light);
    
    /* Scene cards with glassmorphism */
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.15);
    --title-color: var(--secondary);
    --text-color: #E8E8E8;
    --highlight-color: var(--accent);
    --meta-bg-color: rgba(124, 108, 231, 0.2);
    --meta-text-color: var(--primary-light);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow); }
    50% { box-shadow: 0 0 30px var(--primary-glow), 0 0 60px var(--primary-glow); }
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--chat-bg);
    color: var(--text-color);
    line-height: 1.7;
    /* Animated gradient background */
    background: linear-gradient(-45deg, #0A0A0F, #12121A, #1A1A28, #0F0F1A);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow-x: hidden;
}

/* Premium pseudo-element background pattern */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(124, 108, 231, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 107, 157, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Enhanced glassmorphic header */
.chat-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px 30px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: var(--glass-shadow),
                0 0 40px rgba(124, 108, 231, 0.1);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(124, 108, 231, 0.05),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.chat-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--secondary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.chat-header p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Enhanced chat container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: var(--chat-container-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 15px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    scroll-behavior: smooth;
}

/* Scroll bar styling */
.chat-container::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

/* Premium message styling */
.message {
    max-width: 75%;
    padding: 16px 20px;
    margin: 12px 20px;
    border-radius: 18px;
    animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.user {
    background: var(--chat-message-user-bg);
    margin-left: auto;
    color: white;
    box-shadow: 0 8px 24px rgba(124, 108, 231, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    font-weight: 500;
}

.message.user::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
    pointer-events: none;
}

.message.assistant {
    background: var(--chat-message-ai-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-right: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Enhanced input container */
.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 15px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow),
                0 -4px 20px rgba(0, 0, 0, 0.1);
    align-items: center;
    position: relative;
}

.chat-input-container textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px 18px;
    color: var(--light);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    resize: vertical;
    min-height: 50px;
    max-height: 150px;
    line-height: 1.5;
}

.chat-input-container textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-input-container textarea:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 108, 231, 0.15),
                0 4px 12px rgba(124, 108, 231, 0.2);
    outline: none;
}

/* Premium button styling */
.send-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 20px var(--primary-glow);
    position: relative;
    overflow: hidden;
}

.send-button::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.send-button:hover::before {
    width: 300px;
    height: 300px;
}

.send-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px var(--primary-glow),
                0 0 40px var(--primary-glow);
}

.send-button:active {
    transform: translateY(0) scale(0.98);
}

/* Enhanced loading indicator */
.loading-indicator{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    color: var(--secondary);
    font-size: 0.95rem;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 5;
}

.typing-animation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 9px;
    height: 9px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    box-shadow: 0 0 10px var(--secondary-glow);
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { 
        transform: translateY(0);
        opacity: 0.7;
    }
    30% { 
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Premium scene cards with glassmorphism */
.scene-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border: 1px solid var(--card-border);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scene-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% 100%;
    animation: gradientFlow 3s ease infinite;
}

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

.scene-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.15) inset,
                0 0 60px rgba(124, 108, 231, 0.2);
}

.scene-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 18px;
    background: linear-gradient(135deg, var(--secondary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    letter-spacing: -0.3px;
}

.scene-description {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 18px;
    color: var(--text-color);
}

.scene-description h3 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.scene-description strong.section-header {
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-top: 18px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.scene-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.scene-meta span {
    background: var(--meta-bg-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 18px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--meta-text-color);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s ease;
}

.scene-meta span:hover {
    background: rgba(124, 108, 231, 0.35);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(124, 108, 231, 0.4);
}

/* Enhanced welcome message */
.welcome-message {
    text-align: center;
    padding: 40px 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    margin: 24px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    animation: fadeIn 0.6s ease;
}

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

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.welcome-message p {
    font-size: 1.15rem;
    margin-bottom: 28px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
}

/* Premium example prompts */
.example-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 18px 0;
}

.example-prompt {
    background: var(--suggestion-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--suggestion-border);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--suggestion-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.example-prompt::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.example-prompt:hover::before {
    width: 300px;
    height: 300px;
}

.example-prompt:hover {
    background: var(--suggestion-hover-bg);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 24px rgba(124, 108, 231, 0.4),
                0 0 30px rgba(124, 108, 231, 0.2);
    border-color: var(--secondary);
}

.example-prompt:active {
    transform: translateY(0) scale(0.98);
}

/* Enhanced controls */
.story-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.control-button {
    background: linear-gradient(135deg, var(--secondary), #00BFFF);
    color: var(--dark);
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px var(--secondary-glow);
    position: relative;
    overflow: hidden;
}

.control-button::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.control-button:hover::before {
    width: 300px;
    height: 300px;
}

.control-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.5),
                0 0 40px rgba(0, 212, 255, 0.3);
}

.control-button:active {
    transform: translateY(0) scale(0.98);
}

/* Enhanced options area */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 18px 0;
    justify-content: center;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.option-select {
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--light);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
}

.option-select:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--secondary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.option-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--secondary);
}

/* Utility classes */
.hidden {
    display: none !important;
}

.copy-scene-btn {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.copy-scene-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* Error message */
.error-message {
    color: #FF6B6B;
    background: rgba(255, 107, 107, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid #FF6B6B;
    margin: 12px 0;
    text-align: center;
    font-weight: 600;
}

/* Debug output */
.debug-output {
    display: none;
    margin-top: 20px;
    padding: 18px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid #333;
    font-family: "Fira Code", "Cascadia Code", monospace;
    font-size: 0.85rem;
    color: #8BE9FD;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Custom scrollbar globally */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        padding: 8px 12px;
    }
    
    .chat-header h2 {
        font-size: 1.6rem;
    }
    
    .chat-header {
        padding: 20px;
        border-radius: 16px;
    }
    
    .message {
        max-width: 90%;
        padding: 14px 16px;
    }
    
    .scene-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .scene-title {
        font-size: 1.4rem;
    }
    
    .welcome-message h2 {
        font-size: 1.6rem;
    }
    
    .options-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .option-select {
        width: 100%;
    }
    
    .chat-input-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .send-button {
        width: 100%;
        height: 48px;
        border-radius: 12px;
    }
    
    .story-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .control-button {
        width: 100%;
        justify-content: center;
    }
    
    .example-prompts {
        gap: 10px;
    }
    
    .example-prompt {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .chat-header h2 {
        font-size: 1.4rem;
    }
    
    .welcome-message {
        padding: 24px 20px;
        margin: 16px;
    }
    
    .scene-card {
        padding: 16px;
    }
}
