/* LawGlitch Portfolio Dashboard Styles */

:root {
    --cream: #fdfaf5; /* Updated from join-us */
    --gold: #d4af37;
    --black: #0a0a0a; /* Updated from join-us */
    --royal-blue: #1a237e; /* Added from join-us */
    --light-gray: #f0f0f0; /* Added from join-us */
    --dark-gray: #333; /* Updated from join-us */
    --success-green: #4CAF50; /* Added from join-us */
    --transition: all 0.3s ease-in-out; /* Updated from join-us */
    --box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); /* Added from join-us */
    --gold-glow: 0 0 15px rgba(212, 175, 55, 0.7); /* Added from join-us */
    --border-radius: 8px;
    --border-radius-large: 12px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--cream);
    color: var(--black);
    line-height: 1.6;
    min-height: 100vh;
}

/* Authentication States */
.auth-loading,
.auth-required {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f8f4eb 0%, var(--gold) 50%, var(--royal-blue) 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1000;
    color: white;
    text-align: center;
    transition: opacity 0.3s ease;
}

.auth-loading.hidden,
.auth-required.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes gradientShift { /* Added from join-us */
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.auth-required h2 { /* Adjusted for new auth-section styling */
    font-size: clamp(2rem, 6vw, 3.5rem);
    margin-bottom: 20px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    line-height: 1.2;
}

.auth-required p#auth-message { /* Adjusted for new auth-section styling */
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

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

/* Auth Buttons Container */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Google Sign In Button */
.google-btn { /* Updated from join-us */
    background-color: #fff;
    color: var(--dark-gray);
    border: 2px solid var(--gold);
    padding: 15px 40px;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    border-radius: 50px; /* Added from join-us */
    box-shadow: var(--box-shadow); /* Added from join-us */
    width: 100%;
    max-width: 280px;
    justify-content: center;
    margin: 0 auto;
}

.google-btn:hover { /* Updated from join-us */
    background-color: var(--gold);
    color: var(--royal-blue);
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--gold-glow);
}

.google-btn .fa-google { /* Added from join-us */
    color: #4285f4;
}
.google-btn:hover .fa-google { /* Added from join-us */
    color: var(--royal-blue);
}

/* Join Button */
.join-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--gold);
    color: var(--black);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    width: auto; /* Ensure it sizes to content */
    justify-content: center;
    text-decoration: none;
}

.join-btn:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
}

.auth-separator {
    color: white; /* Changed for visibility on new background */
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
    position: relative;
}

.auth-separator::before,
.auth-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: rgba(255, 255, 255, 0.3); /* Changed for visibility on new background */
}

.auth-separator::before {
    left: 0;
}

.auth-separator::after {
    right: 0;
}

.auth-note {
    color: white; /* Changed for visibility on new background */
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Dashboard Header */
.dashboard-header {
    background: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px var(--shadow-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-law { color: var(--black); }
.logo-glitch { color: var(--gold); }

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

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    border: none;
    background: none;
    color: var(--gray-dark);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--gold);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}

.profile-btn:hover {
    transform: scale(1.05);
}

.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow-medium);
    min-width: 200px;
    padding: 1rem;
}

.profile-info {
    border-bottom: 1px solid var(--gray-light);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.profile-email {
    font-size: 0.8rem;
    color: var(--gray-dark);
}

.sign-out-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    border: none;
    background: none;
    color: #dc3545;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.sign-out-btn:hover {
    background: #fff5f5;
}

/* Main Dashboard Content */
.dashboard-content {
    margin-top: 70px;
    padding: 2rem;
}

.dashboard-section {
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: 0 2px 8px var(--shadow-light);
    height: calc(100vh - 114px); /* 100vh - header - padding */
    overflow: hidden;
}

/* Meetings Section */
.iframe-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.expand-iframe-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.expand-iframe-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.expand-iframe-btn i {
    font-size: 12px;
}

/* Ensure embedded ai-agent iframe doesn't get pushed offscreen when outer layout changes */
.ai-assistant-container, #ai-assistant-frame {
    min-width: 320px; /* keep a reasonable minimum so controls don't disappear */
    min-height: 400px;
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* Active Meetings Section */
.active-meetings-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.active-meetings-container .meeting-inputs {
    padding: 1rem;
    border-bottom: 1px solid var(--light-gray);
    background: white;
}

.active-meetings-container .iframe-container {
    flex: 1;
    height: auto;
    min-height: 700px; /* Minimum height to ensure visibility */
}

.active-meetings-container .iframe-container iframe {
    width: 100%;
    height: 100%;
    min-height: 700px;
    border: none;
}

/* Editor Section */
.editor-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.editor-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--gold);
    color: var(--black);
}

.btn-primary:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--gray-dark);
}

.btn-secondary:hover {
    background: #e5e5e5;
}

.editor-main {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    overflow: hidden;
}

.editor-sidebar {
    background: var(--cream-light);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.helper-text h3 {
    color: var(--navy);
    margin-bottom: 0.75rem;
}

.helper-text ul {
    list-style-position: inside;
    margin: 0.75rem 0;
}

.helper-text li {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.json-editor-container {
    position: relative;
    height: 100px;
}

#json-editor {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    color: var(--black);
    background: var(--cream-light);
}

#json-editor:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
}

.toast {
    padding: 1rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: 0 4px 12px var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid #28a745;
}

.toast.error {
    border-left: 4px solid #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Payments Panel */
.payments-container {
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.payments-header { padding: 1.25rem 1.25rem 0; }
.payments-header h2 { color: var(--navy); margin-bottom: 0.25rem; }
.payments-header .muted { color: var(--gray-dark); font-size: 0.9rem; }

.payments-main { width: 100%; padding: 1.25rem; margin-top: 0; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; overflow-y: auto; }
.payments-main form { width: 100%; }
.payments-main label { font-weight: 600; color: var(--navy); }
.payments-main input[type="text"], .payments-main input[type="url"] {
    padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid var(--gray-light); background: white;
}

.payments-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.payments-note { font-size: 0.85rem; color: var(--gray-dark); margin-top: 0.75rem; }

/* Debug Info */
.debug-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.9rem;
    max-width: 600px;
    word-break: break-word;
    color: #666;
}

/* New styles for portfolio editor canvas and sidebars */

.editor-container {
    display: flex;
    height: 80vh;
    gap: 20px;
    padding: 10px;
    box-sizing: border-box;
}

/* Main Canvas */
.canvas-container {
    width: 55%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.canvas-header {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.canvas-btn {
    background: #eee;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.canvas-btn.active {
    background: var(--gold);
    color: white;
}

.btn-icon {
    font-size: 1.2rem;
}

.canvas-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Preview Container */
.preview-container {
    position: relative;
    width: 100%;
    height: auto;
    background-color: white;
    border: 1px solid var(--light-gray);
    padding: 1rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Fix scattered template previews */
.template-preview {
    height: auto;
    max-height: 200px;
    width: 100%;
    background: linear-gradient(135deg, var(--cream-light), var(--cream));
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ensure iframe in preview container scales properly */
.preview-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Code Editor Container */
.code-content {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: #1e1e1e;
    padding: 20px;
    overflow-y: auto;
}

.code-content.hidden {
    display: none;
}

.code-editor {
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    resize: none;
    outline: none;
    padding: 10px;
    tab-size: 4;
    white-space: pre;
}

.preview-container h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--royal-blue);
}

.preview-wrapper {
    flex: 1;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.canvas-content textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
}

/* Template Editor Styles */

.template-selector {
    padding: 1rem;
}

.template-selector h3 {
    color: var(--navy);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

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

.template-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-medium);
}

.template-preview {
    height: 120px;
    background: linear-gradient(135deg, var(--cream-light), var(--cream));
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-colors {
    display: flex;
    gap: 4px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.template-card h4 {
    color: var(--navy);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.template-select-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--gold);
    color: var(--black);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.template-select-btn:hover {
    background: var(--gold-dark);
}

/* Editor Form Styles */
.editor-form {
    padding: 1rem;
    overflow-y: auto;
    height: 100%;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-light);
}

.form-section h4 {
    color: var(--navy);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

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

.color-picker {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

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

.items-container {
    margin-bottom: 1rem;
}

.item-row {
    background: var(--cream-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    position: relative;
    border: 1px solid var(--gray-light);
}

.remove-item-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-item-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.add-item-btn {
    padding: 0.5rem 1rem;
    background: var(--gold);
    color: var(--black);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-item-btn:hover {
    background: var(--gold-dark);
}

.upload-trigger {
    margin-top: 0.5rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
    text-align: center;
}

#save-portfolio-editor {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: 0 4px 12px var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease-out;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid #28a745;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification i {
    font-size: 1.2rem;
}

.notification.success i {
    color: #28a745;
}

.notification.error i {
    color: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
    }
    
    .ai-sidebar,
    .image-sidebar {
        width: 100%;
        max-width: none;
    }
    
    .canvas-container {
        width: 100%;
        height: 400px;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .color-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gray-light);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 1s linear infinite;
}

/* Image Sidebar Styles - Removed */
/*
.image-sidebar {
    width: 20%;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.image-header {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.image-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-preview-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.image-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.image-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.9rem;
}
*/

/* Wallet Section */
.wallet-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.wallet-section:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wallet-section i {
    color: #fbbf24;
}

.wallet-balance {
    font-weight: 600;
    color: #fbbf24;
}

/* Modal */
.modal { 
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0;
    bottom: 0;
    width: 100%; 
    height: 100vh; 
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
    padding: 20px;
    overflow-y: auto;
}

.modal-content { 
    background: var(--white); 
    position: relative;
    width: 100%;
    max-width: 600px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 20px;
    color: var(--dark-gray);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

.modal-close:hover {
    background: rgba(0,0,0,0.1);
    transform: rotate(90deg);
}

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

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.wallet-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Template Buttons */
.template-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-btn {
    padding: 12px 16px;
    background: var(--gold);
    color: var(--black);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.template-btn:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
}


/* New Editor Layout Styles */
.editor-workspace {
    display: flex;
    height: 100%;
}

.editor-panel {
    width: 350px;
    padding: 20px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.preview-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.canvas-header {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: right;
}

.canvas-content, .code-content {
    flex-grow: 1;
    overflow-y: auto;
}

.code-editor {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
}

/* ========================================
   NEW INLINE EDITOR STYLES
   ======================================== */

/* Main Editor Container */
.inline-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: var(--cream);
}

/* Editor Header */
.inline-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 2px solid var(--light-gray);
}

.inline-editor-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--black);
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--light-gray);
    background: white;
    color: var(--dark-gray);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover:not(:disabled) {
    background: var(--light-gray);
    transform: translateY(-1px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Editor Layout */
.inline-editor-layout {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

/* Code Panel */
.code-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Form Panel */
.form-panel {
    flex: 0 0 40%; /* Take 40% of the space */
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Adjust preview panel when form is active */
.inline-editor-layout.form-active .preview-panel {
    flex: 0 0 60%; /* Take 60% of the space */
}

.inline-editor-layout.form-active .code-panel {
    display: none; /* Ensure code panel is hidden */
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--cream);
    border-bottom: 1px solid var(--light-gray);
}

.panel-title {
    font-weight: 600;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--dark-gray);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.expand-btn:hover {
    background: var(--light-gray);
    color: var(--gold);
}

/* Code Textarea */
.code-textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: none;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #1e1e1e;
    color: #d4d4d4;
    outline: none;
}

.code-textarea::placeholder {
    color: #6a6a6a;
}

/* Preview Frame */
.preview-frame {
    flex: 1;
    width: 100%;
    background: #f5f5f5;
    overflow: auto;
    position: relative;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--dark-gray);
    text-align: center;
    padding: 2rem;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--gold);
}

.preview-placeholder p {
    font-size: 1rem;
    color: var(--dark-gray);
}

/* Template Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-large);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--light-gray);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--black);
}

.modal-close {
    padding: 0.5rem;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-gray);
    transition: var(--transition);
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--light-gray);
    color: var(--black);
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.template-card {
    background: var(--cream);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.template-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.template-preview-thumb {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, var(--royal-blue), var(--gold));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.template-preview-thumb i {
    font-size: 3rem;
    color: white;
}

/* Animated Thumbnail Previews with Miniaturized iframes */
.template-card .thumbnail-preview {
    width: 100%;
    height: 300px;
    margin-bottom: 1rem;
}

.thumbnail-preview {
    padding: 0;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    overflow: hidden;
    animation: slideUpFade 0.5s ease-out forwards;
    opacity: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: relative;
}

.thumbnail-iframe {
    width: 1920px;
    height: 1080px;
    border: none;
    display: block;
    transform: scale(0.15625);
    transform-origin: top left;
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
    background: white;
    margin: 0;
    padding: 0;
}

/* Fallback icon styling when thumbnails aren't available */
.template-card > i.fas {
    display: block;
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, var(--royal-blue), var(--gold));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 3rem;
    color: white;
}

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

.template-card h4 {
    margin: 0 0 1rem 0;
    color: var(--black);
    font-size: 1.1rem;
}

.select-template-btn {
    width: 100%;
}

/* Fullscreen Modal */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.fullscreen-modal.hidden {
    display: none;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.fullscreen-header span {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fullscreen-close {
    padding: 0.5rem 1rem;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fullscreen-content {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
}

.fullscreen-code-textarea {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    border: none;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    background: #1e1e1e;
    color: #d4d4d4;
    outline: none;
}

/* Wallet iFrame Modal Styles */
.wallet-iframe-modal {
    max-width: 950px;
    max-height: 85vh;
    height: 85vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--royal-blue);
    font-size: 1.3rem;
}

.close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark-gray);
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--black);
}

#wallet-iframe {
    flex: 1;
    background: white;
}

/* AI Assistant Editor Styles */
.ai-assistant-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.ai-editor-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
    padding: 1.5rem;
}

.ai-editor-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-editor-header h2 {
    font-size: 1.5rem;
    color: var(--royal-blue);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-editor-header h2 i {
    color: var(--gold);
}

.ai-editor-subtitle {
    font-size: 0.9rem;
    color: var(--dark-gray);
    margin: 0;
}

.ai-editor-main {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 500px;
    overflow: hidden;
}

.ai-editor-column,
.ai-preview-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.ai-editor-header-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f0f7ff;
    border-bottom: 1px solid #b3d9ff;
}

.ai-editor-header-small h3 {
    font-size: 1rem;
    color: var(--royal-blue);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-editor-header-small h3 i {
    color: var(--gold);
}

.editor-label {
    font-size: 0.75rem;
    background: var(--gold);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.ai-code-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    overflow: hidden;
}

.ace-editor-wrapper {
    width: 100%;
    height: 100%;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
}

.ai-preview-frame {
    flex: 1;
    background: white;
    overflow: auto;
    position: relative;
}

.ai-preview-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.ai-editor-controls {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1rem;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 6px 6px;
}

.ai-control-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.ai-sync-btn {
    background: #e8f4f8;
    color: #0066cc;
}

.ai-sync-btn:hover {
    background: #d0e8f0;
    transform: translateY(-2px);
}

.ai-reset-btn {
    background: #fff3cd;
    color: #856404;
}

.ai-reset-btn:hover {
    background: #ffeaa7;
    transform: translateY(-2px);
}

.ai-apply-btn {
    background: var(--gold);
    color: white;
    box-shadow: var(--box-shadow);
}

.ai-apply-btn:hover {
    background: #c9a332;
    transform: translateY(-2px);
    box-shadow: var(--gold-glow);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .wallet-iframe-modal {
        max-width: 95vw;
        max-height: 90vh;
        height: 90vh;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .inline-editor-layout {
        flex-direction: column;
    }

    .inline-editor-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .editor-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-btn,
    .btn {
        flex: 1;
        min-width: 100px;
    }

    .code-panel,
    .preview-panel {
        min-height: 400px;
    }

    .ai-editor-layout {
        flex-direction: column;
    }

    .ai-editor-main {
        flex-direction: column;
    }

    .ai-editor-column,
    .ai-preview-column {
        width: 100% !important;
        min-height: 400px;
    }

    .ai-editor-controls {
        flex-wrap: wrap;
    }

    .ai-control-btn {
        flex: 1;
        min-width: 120px;
    }

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

    .ai-chat-container {
        flex-direction: column;
    }

    .ai-chat-messages {
        min-height: 300px;
    }
}

#download-pwa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--gold);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 40px;
    height: 40px;
}

#download-pwa-btn span {
    display: none;
}

#download-pwa-btn:hover {
    color: var(--black);
    transform: scale(1.15);
}

#install-app-btn {
    display: none;
}

/* Premium Section Styling */
.premium-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.premium-header {
    text-align: center;
    margin-bottom: 60px;
}

.premium-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 10px;
}

.premium-header p {
    font-size: 1.1rem;
    color: var(--dark-gray);
}

.premium-plan-card {
    background: linear-gradient(135deg, var(--cream) 0%, #fefdf9 100%);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 50px 40px;
    text-align: center;
    margin-bottom: 60px;
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.15);
    position: relative;
}

.plan-badge {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    color: var(--gold);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.plan-header h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 15px;
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    margin-top: 15px;
}

.plan-price .currency {
    font-size: 1.5rem;
    color: var(--gold);
}

.plan-price .amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
}

.plan-price .period {
    font-size: 1rem;
    color: var(--dark-gray);
}

.plan-features {
    text-align: left;
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feature-row {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
    color: var(--black);
}

.feature-row i {
    color: var(--gold);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.upgrade-btn {
    background: var(--gold);
    color: var(--black);
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 600;
    margin-top: 30px;
    transition: all 0.3s ease;
}

.upgrade-btn:hover {
    background: #c4931a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

.custom-services {
    background: white;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.custom-services h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 10px;
}

.custom-services p {
    color: var(--dark-gray);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.custom-quote-btn {
    background: var(--black);
    color: white;
    padding: 14px 30px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.custom-quote-btn:hover {
    background: var(--dark-gray);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .premium-section {
        padding: 20px 15px;
    }

    .premium-header h2 {
        font-size: 1.8rem;
    }

    .premium-plan-card {
        padding: 30px 20px;
    }

    .plan-features {
        margin: 30px 0;
        gap: 15px;
    }

    .plan-price {
        flex-direction: column;
        gap: 0;
    }

    .plan-price .amount {
        font-size: 2rem;
    }
}