/* Left Menu Styles */
.left-menu {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    z-index: 5;
    border-right: 1px solid #e2e8f0;
}

.left-menu-item {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.left-menu-item:hover {
    background-color: #f1f5f9;
}

.left-menu-item.active {
    background-color: #e2e8f0;
}

.left-menu-item img {
    width: 24px;
    height: 24px;
}

/* Left Sidebar Styles */
.left-sidebar {
    position: absolute;
    left: 60px;
    top: 0;
    bottom: 0;
    width: 460px;
    background-color: #ffffff;
    z-index: 3;
    border-right: 1px solid #e2e8f0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    color: #1e293b;
}

.left-sidebar.active {
    transform: translateX(0);
}

.left-sidebar.active ~ .canvas-area {
    margin-left: 320px; /* 60px (menu) + 260px (sidebar) */
    transition: margin-left 0.3s ease;
}

/* Menu Sidebar - Keep at 260px */
#menu-sidebar {
    width: 260px;
}

.left-sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-sidebar-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 400;
    color: #1e293b;
}

.left-sidebar-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 20px;
}

.left-sidebar-content {
    padding: 15px;
    background-color: #ffffff;
}

/* Images Sidebar - Wider for better image viewing */
#images-sidebar {
    width: 650px;
}

#images-sidebar.active ~ .canvas-area {
    margin-left: 710px; /* 60px (menu) + 650px (sidebar) */
    transition: margin-left 0.3s ease;
}

/* Tags Filter Section */
.tags-filter-section {
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
}

.tags-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.filter-tag:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.filter-tag.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.filter-tag.active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.filter-tag-count {
    margin-left: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 400;
}

.filter-tag.active .filter-tag-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    padding: 0 15px;
    margin-bottom: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.sidebar-tab:hover {
    color: #1f2937;
    background: #f9fafb;
}

.sidebar-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 400;
}

/* Sidebar Tab Content */
.sidebar-tab-content {
    display: none;
}

.sidebar-tab-content.active {
    display: block;
}

/* Images Grid - 3 columns for 650px sidebar */
.images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 15px;
}

/* Shapes Grid - 4 columns for smaller shapes */
.shapes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 15px;
}

/* Folder items in images grid */
.images-grid .folder-item {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.images-grid .folder-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: #cbd5e1;
}

.images-grid .folder-item .folder-preview {
    width: 100%;
    aspect-ratio: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #94a3b8;
}

.images-grid .folder-item .folder-info {
    padding: 10px;
    text-align: center;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.images-grid .folder-item .folder-name {
    font-size: 12px;
    font-weight: 400;
    color: #334155;
    margin-bottom: 4px;
}

.image-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.image-card-preview {
    width: 100%;
    aspect-ratio: 1;
    background: #e0e0e0;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-card-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-tags {
    display: none; /* Hide tags to make cards more compact */
    flex-wrap: wrap;
    gap: 4px;
    min-height: 20px;
}

.image-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 3px;
    color: #666;
}

.add-to-canvas-btn {
    width: 100%;
    padding: 3px;
    background: #ffffff;
    color: #252525;
    /* border: none; */
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.add-to-canvas-btn:hover {
    background: #e2e2e2;
}

.add-to-canvas-btn::before {
    content: '+';
    font-size: 14px;
}

/* Menu Sidebar Content */
.menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: 0.95em;
}

.menu-item:hover {
    color: rgb(100, 116, 139);
}

/* Export Submenu Styles */
.export-submenu {
    margin-top: 8px;
    padding-left: 0;
    background-color: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.export-submenu.show {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 10px;
}

.export-submenu.hidden {
    display: none;
}

.submenu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu-item {
    padding: 10px 15px;
    color: #64748b;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.9em;
    border-bottom: 1px solid #e2e8f0;
}

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

.submenu-item:hover {
    background-color: #e2e8f0;
    color: #4CAF50;
}

.menu-item-with-submenu {
    position: relative;
}

.menu-item-with-submenu::after {
    content: '▼';
    position: absolute;
    right: 10px;
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.menu-item-with-submenu.active::after {
    transform: rotate(180deg);
}

/* Images and Elements Grid */
.image-grid, .element-grid, .shapes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

/* Images Grid - 4 columns for wider sidebar */
#images-sidebar .image-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Dynamic shapes container */
.dynamic-shapes-container {
    padding: 10px;
}

.dynamic-shapes-container .folders-section h4,
.dynamic-shapes-container .shapes-section h4 {
    margin: 16px 0 8px 0;
    color: #374151;
    font-size: 14px;
    font-weight: 400;
}

/* Shapes grid specific styling */
.shapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.shapes-grid .shape-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.shapes-grid .shape-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Folders grid for shapes */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.folders-grid .folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.folders-grid .folder-item:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.image-item, .element-item {
    aspect-ratio: 1;
    background-color: #dbdbdb;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.image-item:hover, .element-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e1;
}

.image-item img, .element-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

/* Dynamic Image Loading States */
.loading-state, .empty-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    text-align: center;
    color: #64748b;
    font-size: 0.9em;
}

.loading-state {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.error-state {
    color: #dc2626;
}

/* Stock Images specific styling */
.image-grid .image-item {
    position: relative;
    overflow: hidden;
}

.image-grid .image-item img {
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-grid .image-item:hover img {
    transform: scale(1.1);
}

/* Folder Navigation Styles */
.folder-navigation {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.9em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.folder-navigation .breadcrumb {
    color: #374151;
    font-weight: 400;
}

.folder-navigation .breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.folder-navigation .breadcrumb a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Folder Item Styles */
.folder-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    aspect-ratio: 1;
}

.folder-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.folder-item .folder-icon {
    font-size: 2em;
    margin-bottom: 5px;
    color: #3b82f6;
}

.folder-item .folder-name {
    font-size: 0.8em;
    color: #374151;
    font-weight: 400;
    word-break: break-word;
    text-align: center;
}

/* Mixed Grid (Folders + Images) */
.image-grid .folder-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.image-grid .folder-item:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

/* Saved Text Items */
.text-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.text-item {
    padding: 12px;
    margin-bottom: 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
    color: #1e293b;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border: 1px solid #e2e8f0;
    font-size: 0.95em;
}

.text-item:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
}

/* Text Styles Grid */
.text-styles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin-top: 10px;
}

.text-style-item {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.text-style-item:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.text-style-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
}

.text-style-fallback {
    width: 100%;
    height: 80px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.text-style-name {
    font-size: 0.85em;
    font-weight: 400;
    color: #1e293b;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading and message states for text styles */
.loading-message, .no-styles-message, .error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    text-align: center;
    color: #64748b;
    font-size: 0.9em;
    padding: 20px;
}

.loading-message {
    animation: pulse 2s infinite;
}

.error-message {
    color: #dc2626;
}

/* Section Titles */
.section-title {
    font-size: 0.95em;
    font-weight: 400;
    margin-bottom: 12px;
    margin-top: 20px;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

/* Accordion Styles */
.accordion-item {
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8fafc;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #e2e8f0;
}

.accordion-header:hover {
    background-color: #f1f5f9;
}

.accordion-header.active {
    background-color: #e2e8f0;
}

.accordion-item:not(.accordion-header.active) .accordion-header {
    border-bottom: none;
}

.accordion-arrow {
    margin-right: 10px;
    font-size: 0.8em;
    color: #64748b;
    transition: transform 0.2s ease;
}

.accordion-header.active .accordion-arrow {
    transform: rotate(90deg);
}

.accordion-title {
    font-size: 0.95em;
    font-weight: 400;
    color: #1e293b;
}

.accordion-content {
    display: none;
    padding: 15px;
    background-color: #ffffff;
}

.accordion-content.active {
    display: block;
}

/* Adjust main content to make room for left menu */
.main-content {
    position: relative;
}

.canvas-area {
    margin-left: 60px;
    transition: margin-left 0.3s ease;
}

/* AI Generator Sidebar Styles */
.ai-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85em;
    background-color: #ffffff;
    color: #1e293b;
    margin-bottom: 0;
}

.ai-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Horizontal layout for object input container */
.ai-object-enhancement-container {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.ai-tone-dropdown {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85em;
    background-color: #ffffff;
    color: #1e293b;
    cursor: pointer;
}

.ai-tone-dropdown:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-enhance-object-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #6366f1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ai-enhance-object-btn:hover {
    background-color: #f0f9ff;
    border-color: #6366f1;
}

.ai-enhance-object-btn i {
    font-size: 0.9em;
}

.ai-template-grid-container {
    position: relative;
    margin-top: 0.5rem;
}

.ai-template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ai-template-grid::-webkit-scrollbar {
    display: none;
}

.ai-custom-scrollbar {
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 300px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.ai-custom-scrollbar-thumb {
    position: absolute;
    right: 0;
    width: 6px;
    background: #6366f1;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ai-custom-scrollbar-thumb:hover {
    background: #4f46e5;
}

.ai-custom-scrollbar.hidden {
    opacity: 0;
}

.ai-generate-btn {
    width: 100%;
    padding: 10px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.ai-generate-btn:hover {
    background: #3576df;
}

.ai-generate-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ai-loading-container {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 400;
    color: #374151;
    margin-bottom: 6px;
}

/* Checkbox styling for Include Texts */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.checkbox-text {
    font-size: 0.85em;
    font-weight: 400;
    color: #374151;
}

.helper-text {
    color: #666;
    font-size: 0.75em;
    display: block;
    margin-top: 3px;
    line-height: 1.3;
}

/* AI Template Items */
.ai-template-item {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
    text-align: center;
    padding: 8px;
}

.ai-template-item:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
}

.ai-template-item.selected {
    border-color: #6366f1;
    background: #f0f9ff;
}

.template-preview {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.template-name {
    font-size: 0.75rem;
    font-weight: 400;
    color: #4b4b4b;
    margin: 0;
    line-height: 1.2;
}

.empty-message, .error-message {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 0.9em;
}

.error-message {
    color: #dc2626;
}

/* Color Palette Selector Light Theme */
color-palette-selector.light-theme-palette {
    --palette-bg: #ffffff;
    --palette-bg-hover: #f9fafb;
    --palette-border: #d1d5db;
    --palette-text: #374151;
    --palette-text-secondary: #6b7280;
    --palette-dropdown-bg: #ffffff;
    --palette-option-hover: #f3f4f6;
    --palette-option-selected: #eff6ff;
    --palette-shadow: rgba(0, 0, 0, 0.1);
}
