/* Custom CSS for Drawing Application */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
}

/* Navigation */
.navbar {
    background: var(--primary-color) !important;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Mobile navbar adjustments */
@media (max-width: 767.98px) {
    .navbar {
        padding: 0.2rem 0.4rem;
        min-height: 45px;
    }
    
    .navbar-brand {
        font-size: 1rem;
        font-weight: 600;
    }
    
    .navbar-nav .nav-link {
        padding: 0.2rem 0.4rem;
        font-size: 0.85rem;
    }
    
    /* Hide Home and Dashboard links on mobile */
    .navbar-nav .nav-link[href="/"] {
        display: none;
    }
    
    .navbar-nav .nav-link[href="/admin"] {
        display: none;
    }
    
    .navbar-nav .dropdown-toggle {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
    
    .navbar-nav .badge {
        font-size: 0.65rem;
        padding: 0.15em 0.3em;
    }
    
    .dropdown-menu {
        font-size: 0.9rem;
    }
    
    .dropdown-header {
        font-size: 0.8rem;
        padding: 0.25rem 1rem;
    }
    
    /* Make navbar items more compact */
    .navbar-nav {
        align-items: center;
    }
    
    .navbar-nav .nav-item {
        margin: 0;
    }
    
    /* Compact dropdown items */
    .dropdown-item {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    .dropdown-item .badge {
        font-size: 0.7rem;
        padding: 0.2em 0.4em;
    }
}

/* Sidebar */
.sidebar {
    background: white;
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 76px);
    max-height: calc(100vh - 76px);
    padding: 1.5rem 1rem;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: sticky;
    top: 76px;
}

.toolbar-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 2rem; /* Extra padding for last section */
}

.toolbar-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-group {
    margin-bottom: 1.5rem;
}

.tool-group:last-child {
    margin-bottom: 0;
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.range-value {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-group-vertical .btn {
    margin-bottom: 0.5rem;
    border-radius: 8px !important;
}

.btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

.btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Canvas Container */
.canvas-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin: 1rem;
}

.canvas-header {
    background: var(--light-color);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
}

.canvas-wrapper {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    background: 
        radial-gradient(circle at 20px 20px, #e2e8f0 1px, transparent 1px),
        radial-gradient(circle at 20px 20px, #e2e8f0 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

#drawingCanvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    background: white;
    cursor: crosshair;
}

.canvas-info {
    background: var(--light-color);
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

/* Modal */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.modal-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
}

.loading-spinner p {
    color: var(--dark-color);
    font-weight: 500;
    margin: 0;
}

/* Form Controls */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.form-range {
    height: 6px;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: var(--shadow-sm);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: var(--shadow-sm);
}

.form-control-color {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .canvas-container {
        margin: 0.5rem;
    }
    
    .canvas-wrapper {
        padding: 1rem;
        min-height: 400px;
    }
    
    #drawingCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .canvas-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .canvas-controls {
        align-self: flex-end;
    }
}

@media (max-width: 576px) {
    .sidebar {
        padding: 1rem 0.5rem;
    }
    
    .toolbar-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .canvas-wrapper {
        padding: 0.5rem;
        min-height: 300px;
    }
    
    .canvas-header {
        padding: 0.75rem 1rem;
    }
    
    .canvas-info {
        padding: 0.5rem 1rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Sidebar specific scrollbar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.sidebar::-webkit-scrollbar-thumb:active {
    background: var(--secondary-color);
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Tooltip styles */
.tooltip {
    font-size: 0.8rem;
}

.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: 6px;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.online {
    background-color: var(--success-color);
}

.status-indicator.offline {
    background-color: var(--danger-color);
}

/* Custom checkbox and radio styles */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Button group customizations */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Icon spacing */
.btn i {
    margin-right: 0.5rem;
}

/* Hover effects */
.tool-group:hover .form-label {
    color: var(--primary-color);
}

/* Focus states */
.btn:focus,
.form-control:focus,
.form-range:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* User info in navbar */
.user-info {
    display: flex;
    align-items: center;
    color: white;
    font-weight: 500;
}

.user-info i {
    font-size: 1.2rem;
}

.user-info span {
    margin-right: 0.5rem;
}

/* AI Generation specific styles */
.btn-outline-warning {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.btn-outline-warning:hover {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.preview-container,
.result-container {
    position: relative;
}

.preview-container canvas {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.result-container img {
    transition: transform 0.3s ease;
}

.result-container img:hover {
    transform: scale(1.05);
}

/* AI Modal specific styles */
/* #aiModal .modal-dialog {
    max-width: 800px;
} */

#aiModal .modal-body {
    padding: 2rem;
}

#aiModal .preview-container,
#aiModal .result-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading spinner for AI generation */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* AI Generation button animation */
#generateAI {
    position: relative;
    overflow: hidden;
}

#generateAI::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;
}

#generateAI:hover::before {
    left: 100%;
}

/* AI Result container */
#aiResult {
    transition: all 0.3s ease;
}

#aiResult.loading {
    background: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Gallery Styles */
.gallery-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    background: white;
}

.gallery-item {
    position: relative;
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.gallery-item.selected {
    border-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.gallery-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    background: #f8f9fa;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-actions {
    display: flex;
    gap: 4px;
}

.gallery-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.gallery-action-btn.load {
    background: var(--success-color);
    color: white;
}

.gallery-action-btn.load:hover {
    background: #059669;
    transform: scale(1.1);
}

.gallery-action-btn.delete {
    background: var(--danger-color);
    color: white;
}

.gallery-action-btn.delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 4px 6px;
    font-size: 10px;
    line-height: 1.2;
}

.gallery-prompt {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-date {
    opacity: 0.8;
    font-size: 9px;
}

.gallery-empty {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.gallery-empty i {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Gallery pagination */
.gallery-pagination .page-link {
    font-size: 12px;
    padding: 4px 8px;
}

/* Responsive gallery */
@media (max-width: 768px) {
    .gallery-container {
        max-height: 300px;
    }
    
    .gallery-thumbnail {
        height: 60px;
    }
    
    .gallery-action-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}

/* Upgrade menu item styling */
.upgrade-item {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    color: #92400e !important;
    font-weight: 600 !important;
    border-left: 3px solid #f59e0b !important;
    transition: all 0.3s ease !important;
}

.upgrade-item:hover {
    background: linear-gradient(135deg, #fde68a, #fcd34d) !important;
    color: #78350f !important;
    transform: translateX(5px) !important;
}

.upgrade-item .badge {
    background: #f59e0b !important;
    color: white !important;
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
}

/* Upgrade Modal Styling */
.upgrade-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 2rem;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.upgrade-benefits {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.benefit-item:last-child {
    margin-bottom: 0;
}

.benefit-item i {
    font-size: 1rem;
    width: 20px;
    flex-shrink: 0;
}

#upgradeRequestForm .form-control,
#upgradeRequestForm .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    transition: all 0.3s ease;
}

#upgradeRequestForm .form-control:focus,
#upgradeRequestForm .form-select:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0.2rem rgba(245, 158, 11, 0.25);
}

#upgradeRequestForm .form-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Floating AI Generation Button */
.floating-ai-button {
    position: absolute;
    bottom: 140px;
    right: 20px;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

/* Floating AI Video Generation Button */
.floating-ai-video-button {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

.floating-ai-button .btn,
.floating-ai-video-button .btn {
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.floating-ai-button .btn:hover,
.floating-ai-video-button .btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(245, 158, 11, 0.6);
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.floating-ai-button .btn:active,
.floating-ai-video-button .btn:active {
    transform: translateY(-1px) scale(1.02);
}

.floating-ai-button .btn::before,
.floating-ai-video-button .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.floating-ai-button .btn:hover::before,
.floating-ai-video-button .btn:hover::before {
    left: 100%;
}

/* Floating animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Responsive adjustments for floating button */
@media (max-width: 768px) {
    .floating-ai-button {
        bottom: 15px;
        right: 15px;
    }
    
    .floating-ai-video-button {
        bottom: 75px;
        right: 15px;
    }
    
    .floating-ai-button .btn,
    .floating-ai-video-button .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Canvas wrapper positioning for floating button */
.canvas-wrapper {
    position: relative;
}

/* ===== MOBILE CHAT INTERFACE ===== */

/* Mobile Chat Interface */
.mobile-chat-interface {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 80%;
}

.chat-message.user .message-content {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.assistant .message-avatar {
    background: var(--primary-color);
    color: white;
}

.chat-message.user .message-avatar {
    background: #6c757d;
    color: white;
}

.message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-message.user .message-text {
    background: var(--primary-color);
    color: white;
}

.message-text p {
    margin: 0;
    line-height: 1.4;
}

/* Chat Input Area */
.chat-input-area {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Image Preview Area */
.image-preview-area {
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-preview-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.image-preview-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.image-preview-name {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-preview-add {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-preview-add:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.image-preview-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #dc3545;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.image-preview-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Components preview strip */
.components-preview-strip {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.components-preview-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.components-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.components-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 100%;
}

.chat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    background: white;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Mobile responsive adjustments */
@media (max-width: 767.98px) {
    .mobile-chat-interface {
        top: 45px; /* Adjust for smaller navbar on mobile */
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .chat-input-area {
        padding: 12px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-text {
        padding: 10px 14px;
        font-size: 15px;
    }
    
    .chat-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Image message styles */
.message-image {
    max-width: 200px;
    border-radius: 12px;
    margin-top: 8px;
    position: relative;
}

.message-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Image preview overlay */
.image-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview:hover .image-preview-overlay {
    opacity: 1;
}

.preview-text {
    color: white;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading message styles */
.message-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-style: italic;
}

.message-loading .spinner-border {
    width: 16px;
    height: 16px;
}

/* Dark mode support for chat */
@media (prefers-color-scheme: dark) {
    .mobile-chat-interface {
        background: #1e293b;
    }
    
    .chat-input-area {
        background: #334155;
        border-top-color: #475569;
    }
    
    .message-text {
        background: #334155;
        color: #e2e8f0;
    }
    
    .chat-message.user .message-text {
        background: var(--primary-color);
        color: white;
    }
    
    .chat-input {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }
    
    .chat-input:focus {
        border-color: var(--primary-color);
    }
    
    .chat-attach-btn {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }
    
        .chat-attach-btn:hover {
            background: #475569;
            border-color: var(--primary-color);
            color: var(--primary-color);
        }

        .image-preview-area {
            background: #334155;
            border-color: #475569;
        }

        .image-preview-name {
            color: #e2e8f0;
        }

        .image-preview-thumbnail {
            border-color: #475569;
        }
    }

/* Mobile Full Screen Image Viewer */
.mobile-fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
}

.fullscreen-overlay {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fullscreen-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

.fullscreen-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.fullscreen-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Clickable images in chat */
.clickable-image {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.clickable-image:hover {
    transform: scale(1.02);
}

/* Video gallery overlay styles */
.gallery-item {
    position: relative;
    cursor: pointer;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1 !important;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-overlay .btn-group {
    opacity: 1;
}

/* Ensure video elements work with overlay */
.gallery-item video {
    border-radius: 6px;
}

/* Make sure overlay is above video */
.gallery-item .gallery-overlay {
    z-index: 10;
}

/* Video gallery specific styles */
.gallery-item video {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

/* Ensure buttons are visible in overlay */
.gallery-overlay .btn {
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.gallery-overlay .btn-info {
    background-color: rgba(13, 202, 240, 0.8);
    border-color: rgba(13, 202, 240, 0.8);
}

.gallery-overlay .btn-danger {
    background-color: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 0.8);
}

.gallery-overlay .btn:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Video generation modal styles */
.gallery-image-item {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.gallery-image-item:hover {
    transform: scale(1.02);
}

.gallery-image-item.selected img {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.video-gallery-selection {
    background-color: #f8f9fa;
}

.selected-image-preview {
    background-color: #ffffff;
    border: 2px dashed #dee2e6 !important;
}

.selected-image-preview img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== SIMPLIFIED DRAWING MODE ===== */

/* Simplified mode - hide sidebars and show only canvas */
.simplified-mode .sidebar {
    display: none !important;
}

.simplified-mode .navbar {
    display: none !important;
}

.simplified-mode .col-md-7 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.simplified-mode .canvas-container {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.simplified-mode .canvas-header {
    display: none;
}

.simplified-mode .canvas-wrapper {
    padding: 0;
    min-height: 100vh;
    padding-top: 60px; /* Account for the top toolbar */
    background: 
        radial-gradient(circle at 20px 20px, #e2e8f0 1px, transparent 1px),
        radial-gradient(circle at 20px 20px, #e2e8f0 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.simplified-mode .canvas-info {
    display: none;
}

/* Simplified toolbar */
.simplified-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    z-index: 10000; /* Higher than navbar */
    min-height: 60px;
}

.simplified-toolbar .simple-tools {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.simplified-toolbar .tool-group {
    margin-bottom: 0;
}

.simplified-toolbar .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.simplified-toolbar .form-range {
    width: 100%;
    margin-bottom: 0.25rem;
}

.simplified-toolbar .range-value {
    font-size: 0.75rem;
    text-align: center;
    color: #64748b;
}

.simplified-toolbar .form-control-color {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.simplified-toolbar .btn-group {
    width: 100%;
}

.simplified-toolbar .btn-group .btn {
    flex: 1;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.5rem;
}

.simplified-toolbar .btn-group .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.simplified-toolbar .btn-group .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Simple mode toggle button */
#toggleSimpleMode {
    transition: all 0.3s ease;
}

#toggleSimpleMode.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#toggleSimpleMode.active:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Mobile responsive for simplified mode */
@media (max-width: 768px) {
    .simplified-toolbar {
        padding: 0.5rem;
        min-height: 50px;
    }
    
    .simplified-toolbar .simple-tools {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .simplified-toolbar .tool-group {
        flex: 0 0 auto;
        min-width: 60px;
    }
    
    .simplified-toolbar .btn-group .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
        min-width: 35px;
    }
    
    .simplified-toolbar .form-label {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
        display: none; /* Hide labels on mobile to save space */
    }
    
    .simplified-toolbar .form-range {
        margin-bottom: 0.1rem;
        width: 60px;
    }
    
    .simplified-toolbar .range-value {
        font-size: 0.6rem;
        display: none; /* Hide range values on mobile */
    }
    
    .simplified-toolbar .form-control-color {
        height: 30px;
        width: 30px;
        border-radius: 50%;
    }
    
    
    .simplified-mode .canvas-wrapper {
        padding-top: 50px;
    }
    
    .simplified-mode #drawingCanvas {
        width: calc(100vw - 10px) !important;
        height: calc(100vh - 70px) !important;
        max-width: none !important;
        max-height: none !important;
    }
}

/* Canvas in simplified mode */
.simplified-mode #drawingCanvas {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 80px) !important;
    max-width: none !important;
    max-height: none !important;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    background: white;
    object-fit: contain;
}

/* Ensure AI button is always visible in simplified mode */
.simplified-mode .floating-ai-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
}

.simplified-mode .floating-ai-video-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1001;
}

/* Hide mobile chat interface in simplified mode */
.simplified-mode .mobile-chat-interface {
    display: none !important;
}