:root {
    --primary-purple: #8B5CF6;
    --secondary-purple: #A78BFA;
    --dark-purple: #6D28D9;
    --light-purple: #C4B5FD;
    --accent-purple: #DDD6FE;
    --bright-purple: #9333EA;
    --glow-purple: #A855F7;

    --bg-primary: #0A0A0F;
    --bg-secondary: #131318;
    --bg-tertiary: #1A1A22;
    --bg-card: rgba(30, 30, 45, 0.8);
    --bg-glass: rgba(139, 92, 246, 0.15);
    --bg-glass-dark: rgba(109, 40, 217, 0.2);

    --text-primary: #F8FAFC;
    --text-secondary: #E2E8F0;
    --text-muted: #CBD5E1;
    --text-glow: #DDD6FE;

    --border-color: rgba(139, 92, 246, 0.3);
    --border-light: rgba(167, 139, 250, 0.4);
    --border-bright: rgba(147, 51, 234, 0.6);

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    --shadow-glass: 0 4px 16px rgba(139, 92, 246, 0.15);
    --shadow-glow: 0 0 10px rgba(139, 92, 246, 0.3);
    --shadow-bright: 0 0 20px rgba(147, 51, 234, 0.4);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.6);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --blur-light: blur(4px);
    --blur-medium: blur(8px);
    --blur-heavy: blur(12px);
}

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

/* Performance optimizations */
* {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f0f23 40%, #000000 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(147, 51, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(109, 40, 217, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Glass Effect Classes */
.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: var(--blur-medium);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
    position: relative;
}

.glass-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.02) 100%);
    border-radius: inherit;
    pointer-events: none;
    z-index: -1;
}

.glass-input {
    background: rgba(30, 30, 45, 0.8) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    will-change: border-color, box-shadow;
}

.glass-input:focus {
    border-color: var(--bright-purple) !important;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.3), inset 0 0 10px rgba(139, 92, 246, 0.1) !important;
    background: rgba(30, 30, 45, 0.8) !important;
}

.glass-textarea {
    background: rgba(30, 30, 45, 0.8) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    will-change: border-color, box-shadow;
}

.glass-textarea:focus {
    border-color: var(--bright-purple) !important;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.3), inset 0 0 10px rgba(139, 92, 246, 0.1) !important;
    background: rgba(30, 30, 45, 0.8) !important;
}

.glass-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--bright-purple)) !important;
    border: 1px solid var(--border-bright) !important;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.glass-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.glass-btn:hover::before {
    left: 100%;
}

.glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-bright), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: var(--glow-purple);
}

.glass-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.glass-btn:disabled:hover {
    transform: none !important;
    box-shadow: var(--shadow-glass), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.glass-btn .btn-loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.glass-btn.loading .btn-loading {
    display: flex;
}

.glass-btn.loading span {
    display: none;
}

.glass-btn.loading {
    position: relative;
    overflow: hidden;
}

.glass-btn.loading::before {
    display: none;
}

/* Glass button submit override */
.submit-btn.glass-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.submit-btn.glass-btn:disabled:hover {
    transform: none !important;
    box-shadow: var(--shadow-glass), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.submit-btn.glass-btn.loading {
    opacity: 0.8;
    min-width: fit-content;
    width: auto;
}

.submit-btn.glass-btn.loading:hover {
    transform: none !important;
}

.glass-btn.loading {
    min-width: fit-content;
    width: auto;
}

/* Webhook Bar */
.webhook-bar {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: var(--blur-heavy);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-glass);
}

.webhook-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.webhook-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-glow);
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
    white-space: nowrap;
}

.webhook-label i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
}

.webhook-input {
    flex: 1;
    min-width: 300px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.webhook-save-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    color: #FCA5A5;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: var(--blur-light);
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.admin-link:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Navigation */
.navbar {
    backdrop-filter: var(--blur-heavy);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 150;
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-glow);
    text-shadow: 0 0 20px rgba(221, 214, 254, 0.8);
}

.nav-logo i {
    font-size: 1.75rem;
    color: var(--bright-purple);
    filter: drop-shadow(0 0 12px rgba(147, 51, 234, 0.8));
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(147, 51, 234, 0.8)); }
    50% { filter: drop-shadow(0 0 20px rgba(147, 51, 234, 1)); }
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: var(--blur-light);
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-glow);
    background: var(--bg-glass);
    border-color: var(--border-color);
    transform: translateY(-1px);
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.6);
}

.nav-link.active {
    color: var(--text-glow);
    background: var(--bg-glass-dark);
    border-color: var(--border-bright);
    text-shadow: 0 0 15px rgba(221, 214, 254, 0.8);
    box-shadow: inset 0 0 20px rgba(147, 51, 234, 0.2);
}

.prompt-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-purple), var(--bright-purple));
    color: white;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    backdrop-filter: var(--blur-light);
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-bright);
    border-color: var(--glow-purple);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
    border: 1px solid #b91c1c;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    margin-left: 1rem;
    white-space: nowrap;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.admin-panel-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--dark-purple), var(--primary-purple));
    color: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    text-decoration: none;
    margin-left: 1rem;
}

.admin-panel-btn:hover {
    background: linear-gradient(135deg, var(--primary-purple), var(--bright-purple));
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Main Content */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-glow), var(--bright-purple), var(--secondary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 0 0 40px rgba(147, 51, 234, 0.5);
    animation: title-glow 3s ease-in-out infinite alternate;
}

@keyframes title-glow {
    from { filter: drop-shadow(0 0 20px rgba(147, 51, 234, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(147, 51, 234, 0.8)); }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 0 10px rgba(226, 232, 240, 0.3);
}

/* Form Styles */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.story-form {
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.form-group {
    margin-bottom: 2rem;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-glow);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
}

.form-label i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
}

.form-select,
.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
    text-shadow: 0 0 5px rgba(203, 213, 225, 0.3);
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.loading-spinner i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Performance-optimized animations */
.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
    will-change: opacity, transform;
}

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

/* Optimize transform layers */
.story-card, .glass-btn, .glass-input, .glass-textarea {
    will-change: auto;
}

.story-card:hover, .glass-btn:hover {
    will-change: transform, box-shadow;
}

.submit-btn {
    width: 100%;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: none;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

.submit-btn.loading .btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submit-btn.loading span {
    display: none;
}

/* Result Container */
.result-container {
    max-width: 800px;
    margin: 3rem auto 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: var(--blur-medium);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: var(--bg-glass-dark);
    border-bottom: 1px solid var(--border-color);
}

.result-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-glow);
    font-size: 1.25rem;
    text-shadow: 0 0 15px rgba(221, 214, 254, 0.6);
}

.result-header h3 i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 10px rgba(147, 51, 234, 0.8));
}

.save-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.generated-story {
    padding: 2rem;
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-shadow: 0 0 5px rgba(226, 232, 240, 0.2);
}

/* Stories Grid */
.stories-container {
    margin-top: 2rem;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.story-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s ease;
    cursor: pointer;
    backdrop-filter: var(--blur-medium);
    position: relative;
}

.story-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-bright);
    border-color: var(--border-bright);
}

.story-card-header {
    padding: 1.5rem 1.5rem 1rem;
    background: var(--bg-glass-dark);
}

.story-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-glow);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
}

.story-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.story-card-preview {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    text-shadow: 0 0 5px rgba(226, 232, 240, 0.2);
}

.loading-card {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    border-radius: var(--radius-lg);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    padding: 2rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: var(--blur-heavy);
    z-index: 999;
    display: none;
}

.modal-overlay.active {
    display: block;
}

.modal-content {
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    z-index: 1001;
    backdrop-filter: var(--blur-heavy);
}

.story-modal-content {
    max-width: 800px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: var(--bg-glass-dark);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-glow);
    font-size: 1.25rem;
    margin: 0;
    text-shadow: 0 0 15px rgba(221, 214, 254, 0.6);
}

.modal-header h3 i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 10px rgba(147, 51, 234, 0.8));
}

.modal-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    backdrop-filter: var(--blur-light);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: 60vh;
    backdrop-filter: var(--blur-light);
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-glass-dark);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--bright-purple));
    color: white;
    border-color: var(--border-bright);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glass);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border-color: var(--border-color);
    backdrop-filter: var(--blur-light);
}

.btn-secondary:hover {
    color: var(--text-glow);
    border-color: var(--border-light);
    background: var(--bg-glass-dark);
}

.story-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-shadow: 0 0 5px rgba(226, 232, 240, 0.2);
}

.story-content p {
    margin-bottom: 1.5rem;
}

/* Admin Styles */
.admin-body {
    background: radial-gradient(ellipse at center, #1e1b4b 0%, #0f0f23 50%, #000000 100%);
}

.admin-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.admin-login-card {
    max-width: 400px;
    width: 100%;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    text-align: center;
}

.admin-logo {
    margin-bottom: 2rem;
}

.admin-logo i {
    font-size: 3rem;
    color: var(--bright-purple);
    filter: drop-shadow(0 0 20px rgba(147, 51, 234, 0.8));
    margin-bottom: 1rem;
    display: block;
}

.admin-logo h1 {
    color: var(--text-glow);
    text-shadow: 0 0 20px rgba(221, 214, 254, 0.8);
    font-size: 1.75rem;
}

.admin-form {
    text-align: left;
}

.first-time-setup {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
}

.first-time-setup h2 {
    color: var(--text-glow);
    margin-bottom: 1rem;
    text-align: center;
}

.first-time-setup p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
}

.success-message {
    color: var(--success);
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    text-align: center;
    margin-top: 1rem;
}

.error-message {
    color: var(--error);
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    text-align: center;
    margin-top: 1rem;
}

.admin-submit-btn {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
}

.admin-footer {
    margin-top: 2rem;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: var(--text-glow);
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.6);
}

/* Admin Panel */
.admin-panel {
    min-height: 100vh;
}

.admin-navbar {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.admin-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-glow);
    text-shadow: 0 0 20px rgba(221, 214, 254, 0.8);
}

.admin-nav-logo i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 12px rgba(147, 51, 234, 0.8));
}

.admin-nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-nav-btn, .admin-nav-btn.nav-link {
    padding: 0.75rem 1.25rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: var(--blur-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.admin-nav-btn:hover,
.admin-nav-btn.active,
.admin-nav-btn.nav-link:hover {
    background: var(--bg-glass-dark);
    color: var(--text-glow);
    border-color: var(--border-bright);
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.6);
}

.admin-logout-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-logout-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.5);
}

.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.admin-section {
    padding: 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
}

.admin-section h2 {
    margin-bottom: 2rem;
    color: var(--text-glow);
    text-shadow: 0 0 15px rgba(221, 214, 254, 0.6);
}

.admin-stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.admin-story-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    backdrop-filter: var(--blur-medium);
}

.admin-story-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.admin-story-header h3 {
    color: var(--text-glow);
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
}

.admin-story-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-btn {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: var(--blur-light);
}

.admin-btn.edit {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93C5FD;
}

.admin-btn.edit:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.5);
}

.admin-btn.delete {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

.admin-btn.delete:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.5);
}

.admin-story-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.admin-story-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    text-shadow: 0 0 5px rgba(226, 232, 240, 0.2);
}

.prompt-editor {
    max-width: 800px;
}

.admin-save-btn {
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.setting-item {
    padding: 1.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--blur-light);
}

.setting-item h3 {
    color: var(--text-glow);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.connected {
    background: rgba(16, 185, 129, 0.2);
    color: #6EE7B7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.admin-empty,
.admin-error {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.admin-empty i,
.admin-error i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .webhook-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .webhook-input {
        min-width: auto;
    }

    .nav-container {
        padding: 0 1rem;
        flex-direction: column;
        height: auto;
        gap: 1rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-link,
    .prompt-btn,
    .logout-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .logout-btn {
        margin-left: 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .main-container {
        padding: 1.5rem 1rem;
    }

    .story-form {
        padding: 1.5rem;
    }

    .stories-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 1rem;
    }

    .modal-body {
        max-height: 50vh;
    }

    .admin-nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-stories-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .story-form {
        padding: 1rem;
    }

    .modal-content {
        margin: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .admin-login-card {
        padding: 1.5rem;
    }

    .nav-link,
    .prompt-btn,
    .logout-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        gap: 0.35rem;
    }

    .nav-menu {
        gap: 0.35rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    60% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

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

/* Form Stats */
.form-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--blur-light);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-item i {
    color: var(--bright-purple);
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
}

/* Message Container */
.message-container {
    max-width: 600px;
    margin: 2rem auto;
    position: relative;
}

.message-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    backdrop-filter: var(--blur-medium);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.message-content i {
    font-size: 1.25rem;
}

/* Search Container */
.search-container {
    max-width: 800px;
    margin: 0 auto 2rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bright-purple);
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
    font-size: 1.1rem;
    z-index: 10;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur-heavy);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    display: none;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background: var(--bg-glass);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-glow);
    text-shadow: 0 0 10px rgba(221, 214, 254, 0.5);
    margin-bottom: 0.5rem;
}

.search-result-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-bright);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Pagination Info */
.pagination-info {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--primary-purple);
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Search Highlight */
.search-highlight {
    background: linear-gradient(135deg, var(--bright-purple), var(--secondary-purple));
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-purple), var(--bright-purple));
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--bright-purple), var(--glow-purple));
}
/* Story Edit Textarea */
.story-edit-textarea {
    resize: vertical;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
}

/* Modal Footer Button Styles */
.modal-footer {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-glass-dark);
    border-color: var(--border-bright);
}

.btn i {
    font-size: 0.875rem;
}
