/* Global styles */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin-top: 60px;
    padding: 20px;
    background-color: #121212;
    color: #fff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
}

.control-hint {
    font-size: 0.8rem;
    color: #8bb4f7;
    margin-top: 4px;
    font-style: italic;
}

/* Topbar styles now come from /styles.css */

.logo {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

/* Removed conflicting nav-link styles - using Topbar.js component styles instead */

/* User menu styles */
.user-menu-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    height: 40px;
    width: 40px;

    align-items: center;
    justify-content: center;
}

.credits-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 22px;
    background: rgba(29, 29, 29, 0);
    color: #363636;
    border-radius: 4px;
    font-weight: 400;
    border : 1px solid #e5e7eb;
}

.credits-indicator i {
    color: #3b82f6;
}

.btn-upgrade {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    height: 30px;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    width: 120px;
}

.btn-upgrade:hover {
    background: #45a049;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #1d1d1d00;
    color: rgb(41, 41, 41);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    font-size: 14px;
    border: 1px solid #e5e7eb;
}

/* User dropdown menu styles */
.user-dropdown {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    width: 300px;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s;
    position: relative;
}

.user-dropdown a:hover {
    background-color: #f3f4f6;
}

.user-dropdown a::before {
    content: '';
    width: 20px;
    height: 20px;
    background-size: 20px;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
}

/* Icons for menu items */
.user-dropdown a[href="/profile"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E");
}

.user-dropdown a[href="/profile?tab=subscription"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 10V3L4 14h7v7l9-11h-7z'/%3E%3C/svg%3E");
}

.user-dropdown a[href="/logout"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ff4d4d'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1'/%3E%3C/svg%3E");
}

/* Credits display at the top */
.user-dropdown::before {
    content: attr(data-credits);
    display: block;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Logout link special styling */
.user-dropdown a[href="/logout"] {
    color: #ef4444;
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

/* Adjust main content for sticky header */
main, .container {
    padding-top: 1rem;
}

/* User dropdown styles - duplicate removed, using above styles */

/* User dropdown content */
.user-dropdown-content {
    color: #1f2937;
}

.menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 400;
    font-size: 0.875rem;
    color: #1f2937;
}

.user-email {
    font-size: 0.75rem;
    color: #6b7280;
}

.menu-items {
    padding: 4px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

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

.menu-item i {
    width: 20px;
    color: #6b7280;
}

.menu-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0;
}

.menu-section-title {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 400;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Removed duplicate nav-link styles - using Topbar.js component styles instead */

.logo {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Removed third nav-link styles - using Topbar.js component styles instead */

.btn-login, .btn-signup {
    color: #ffffff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-login:hover, .btn-signup:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Topbar dropdown styles */
.dropdown-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.dropdown-section-title {
    font-size: 0.8rem;
    color: #999;
    padding: 8px 16px 4px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    font-weight: 400;
}

/* Collections Page */
.collections-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.collections-section,
.generations-section {
    margin-bottom: 40px;
}

.collections-grid,
.generations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.collection-grid-container {
    position: relative;
    padding-top: 75%;
    background: #1a1a1a;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
}

.main-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(66.66% - 2px);
    height: 100%;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.small-thumbnails {
    position: absolute;
    top: 0;
    right: 0;
    width: calc(33.33% - 2px);
    height: 100%;
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
}

.small-thumbnail {
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.small-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.collection-card {
    background: #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
    height: 100%;
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.collection-info {
    padding: 16px;
}

.collection-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 400;
    color: white;
}

.collection-count {
    margin-top: 4px;
    font-size: 0.9em;
    color: #999;
}

.new-collection {
    border: 2px dashed #444;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.new-collection:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.05);
}

.collection-placeholder {
    text-align: center;
    color: #666;
}

.collection-placeholder span {
    font-size: 2em;
    display: block;
    margin-bottom: 8px;
}

.collection-placeholder p {
    margin: 0;
    font-size: 1.1em;
}

/* Placeholder Grid */
.placeholder-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
}

.main-placeholder {
    grid-row: 1 / span 2;
    position: relative !important;
    height: 100%;
    width: 100%;
}

.right-placeholders {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
}

/* Image Placeholders */
.image-placeholder {
    background-color: #404040;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
}

.image-placeholder::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
    width: 24px;
    height: 24px;
    opacity: 0.5;
}

.small-placeholder {
    position: relative;
    width: 100%;
    height: 100%;
}

.options-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    z-index: 1;
}

.options-icon:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.collection-info {
    padding: 12px;
}

.collection-title {
    color: #fff;
    font-size: 14px;
    margin: 0;
}

.collection-count {
    color: #888;
    font-size: 12px;
    margin-top: 4px;
}

.new-collection {
    border: 2px dashed #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 200px;
}

.new-collection .collection-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: #666;
}

.new-collection:hover {
    border-color: #888;
    background-color: #333;
}

/* Generation Card */
.generation-card {
    position: relative;
    border-radius: 8px;
    background-color: #2a2a2a;
    overflow: hidden;
    margin-bottom: 20px;
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    overflow: hidden;
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #1a1a1a;
}

.button-wrapper {
    padding: 12px;
    display: flex;
    justify-content: center;
    background-color: #2a2a2a;
}

.add-to-collection-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.add-to-collection-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 400;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 400;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1f2937;
    font-size: 0.875rem;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #0066cc;
    color: white;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.btn-secondary {
    background-color: #333;
    color: white;
}

.btn-secondary:hover {
    background-color: #444;
}

/* Collection Selector Modal */
.collection-selector {
    width: 300px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.collections-list {
    flex-grow: 1;
    overflow-y: auto;
    margin: 16px 0;
}

.collection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.collection-item:hover {
    background-color: #3a3a3a;
}

.collection-title {
    color: #fff;
    font-size: 14px;
}

.collection-count {
    color: #888;
    font-size: 12px;
}

.new-collection-option {
    border-top: 1px solid #3a3a3a;
    padding-top: 12px;
}

.new-collection-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.new-collection-button:hover {
    background-color: #3a3a3a;
}

.new-collection-button svg {
    width: 16px;
    height: 16px;
}

/* Collection Details Page */
.collection-header {
    margin: 2rem 0;
    text-align: center;
}

.collection-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.collection-header p {
    color: #666;
    font-size: 1.1rem;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.image-container {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 1rem;
    transition: transform 0.2s;
}

.image-container:hover {
    transform: translateY(-5px);
}

.image-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.image-prompt {
    color: #ccc;
    font-size: 0.9rem;
    margin: 0;
    text-align: center;
}

/* Image Card Styles */
.image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

/* Hover Effect */
.hover-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-wrapper:hover .hover-effect {
    opacity: 1;
}

/* Menu Button */
.menu-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(137, 137, 137,.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.menu-button:hover,
.menu-button.active {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

.image-wrapper:hover .menu-button {
    opacity: 1;
}

/* Menu Dropdown */
.menu-dropdown {
    position: absolute;
    top: 44px;
    right: 8px;
    background: #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 8px;
    display: none;
    min-width: 200px;
    z-index: 1000;
}

.menu-dropdown.active {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
}

.menu-item:hover {
    background: rgb(255, 255, 255);
}

.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-item.text-danger {
    color: #ff4444;
}

.menu-item.text-danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

.menu-item i {
    width: 16px;
    color: #666;
}

.menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* Generation Card */
.generation-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a1a;
}

.generation-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Profile Section */
.profile-section {
    position: relative;
}

.profile-trigger {
    cursor: pointer;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

/* Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
    display: none;
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: bold;
    color: #333;
}

.user-email {
    color: #666;
    font-size: 0.9rem;
}

.upgrade-banner {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.banner-content {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
}

.plan-info {
    margin-bottom: 0.5rem;
}

.plan-name {
    font-weight: bold;
    color: #333;
}

.plan-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.upgrade-button {
    width: 100%;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.upgrade-button:hover {
    background: #45a049;
}

.dropdown-menu {
    padding: 0.5rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item i {
    width: 20px;
    color: #666;
}

.dropdown-footer {
    padding: 0.5rem 0;
    border-top: 1px solid #eee;
}

/* Profile Page */
.profile-page {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.profile-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 2rem;
}

.profile-tab {
    padding: 1rem 0;
    color: #666;
    text-decoration: none;
    position: relative;
}

.profile-tab.active {
    color: #4CAF50;
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #4CAF50;
}

.profile-section {
    margin-bottom: 2rem;
}

.profile-section h2 {
    margin-bottom: 1rem;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #8a8a8a;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #272727;
    border-radius: 4px;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: #4CAF50;
    color: white;
    border: none;
}

.btn-secondary {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.error {
    color: #ff4d4d;
    margin: 1rem 0;
}

.style-section {
    margin: 2rem 0;
}

.style-section h3 {
    color: #fff;
    margin-bottom: 1rem;
}

#result {
    margin-top: 2rem;
}

#result img {
    max-width: 100%;
    border-radius: 8px;
}

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

/* Image Card Styles */
.image-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a1a;
    margin-bottom: 4px;
}

.image-container {
    position: relative;
    width: 100%;
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.menu-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-container:hover .menu-button {
    opacity: 1;
}

.context-menu {
    position: absolute;
    top: 45px;
    right: 10px;
    background: #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 150px;
}

.menu-item {
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.menu-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.menu-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Toast Notification Styles */
.toast-notification {
    pointer-events: none;
    position: fixed;
    z-index: 10000;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: #1E1E1E;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

.close-modal {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.collections-list {
    margin: 15px 0;
    display: grid;
    gap: 10px;
}

.collection-item {
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    color: #1f2937;
    font-size: 0.875rem;
}

.collection-item:hover {
    background: #f3f4f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.collection-item.selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: #9ca3af;
    position: relative;
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: #e5e7eb;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

#newCollectionName {
    width: 100%;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    margin: 10px 0;
}

.create-collection {
    width: 100%;
    margin-top: 10px;
}

.style-list {
    margin: 2rem 0;
}

.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 40px;
}

.style-carousel {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 1rem 0;
}

.style-carousel::-webkit-scrollbar {
    display: none;
}

.style-item {
    flex: 0 0 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.style-item:hover {
    transform: translateY(-2px);
}

.style-item.selected {
    border-color: #4CAF50;
}

.style-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.style-name {
    padding: 0.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.custom-select {
    display: block;
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.custom-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
 /* Reset and Basic Styling */
 * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevent body scroll */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; /* Example font, include if needed */
    font-size: 14px;
    background-color: #f4f7fc;
    color: #cacaca;
}

/* Studio Layout */
.studio-container {
    display: flex;
    flex-direction: column;
    height: 100vh;

}

.studio-header {
    background-color: #1e293b; /* Dark blue/grey */
    color: #e2e8f0; /* Light grey text */
    padding: 10px 20px;
    font-size: 1.2em;
    font-weight: 400;
    flex-shrink: 0; /* Prevent header from shrinking */
}
.pickr .pcr-button {
border: 1px solid #ccc !important; /* Light grey border */
}

.main-content {
    display: flex;
    flex-grow: 1; /* Takes remaining height */
    overflow: hidden; /* Prevent this container from scrolling */
}

.canvas-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #d1d5db; /* Neutral grey background */
    overflow: hidden; /* Hide scrollbars, panning is manual */
    position: relative; /* Needed for positioning zoom controls */
    cursor: default; /* Default cursor for selection mode */
    z-index: 1; /* Ensure canvas stays below sidebar */
    isolation: isolate; /* Create stacking context */
}
.canvas-area.panning,
.canvas-area.panning canvas {
    cursor: grabbing !important;
}
.canvas-area.hand-mode,
.canvas-area.hand-mode canvas {
    cursor: grab !important;
}
.canvas-area.hand-mode.panning,
.canvas-area.hand-mode.panning canvas {
    cursor: grabbing !important;
}

/* Rulers */
.ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #e5e5e5;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    z-index: 1000;
}

.horizontal-ruler {
    position: absolute;
    top: 0;
    left: 20px;
    height: 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ccc;
    z-index: 999;
    cursor: crosshair;
}

.vertical-ruler {
    position: absolute;
    top: 20px;
    left: 0;
    width: 20px;
    background: #f5f5f5;
    border-right: 1px solid #ccc;
    z-index: 999;
    cursor: crosshair;
}

/* Guidelines */
.guidelines-container {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
    z-index: 998;
}

.guideline {
    position: absolute;
    background: #00bfff;
    pointer-events: auto;
    z-index: 998;
}

.guideline.horizontal {
    height: 1px;
    width: 100%;
    cursor: ns-resize;
}

.guideline.vertical {
    width: 1px;
    height: 100%;
    cursor: ew-resize;
}

.guideline:hover {
    background: #ff6b6b;
}

.guideline.dragging {
    background: #ff6b6b;
}

canvas {
    border: 1px solid #9ca3af; /* Slightly darker border for contrast */
    background-color: #ffffff; /* White canvas background */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: block; /* Remove extra space below */
    cursor: default; /* Override parent cursor */
}
 canvas.dragging { cursor: grabbing; } /* For object dragging */


/* NEW 3-PARTS CANVAS CONTROLS - Using unique class names to avoid conflicts */

/* Canvas Controls Container - Holds all 3 parts */
.new-canvas-controls-container {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 9999999 !important; /* Must be higher than sidebar and gradient picker dropdown */
}

/* Individual Canvas Control Parts */
.new-canvas-controls {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-height: 45px;
    padding-top: 4px;
    padding-bottom: 4px;
    padding-right: 15px;
    padding-left: 15px;
    border: 1px solid #f7f7f7;

}

.new-canvas-controls button {
    background: none;
    border: none;
    font-size: 0.9em;
    cursor: pointer;
    border-radius: 4px;
    color: #4b5563;
    transition: background-color 0.2s ease;
}

.new-canvas-controls button:hover {
    background-color: #e5e7eb;
}

/* Navigation Mode Button Styles */
.new-canvas-controls .nav-mode-btn {
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.new-canvas-controls .nav-mode-btn img {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.new-canvas-controls .nav-mode-btn:hover img {
    opacity: 0.85;
}

.new-canvas-controls .nav-mode-btn.active {
    background-color: #3b82f6;
}

.new-canvas-controls .nav-mode-btn.active img {
    opacity: 1;
    filter: brightness(0) invert(1); /* White icon when active */
}

.new-canvas-controls .nav-mode-btn.active:hover {
    background-color: #2563eb;
}

/* Focus target button special style - not a toggle, just an action */
.new-canvas-controls #focusTargetBtn:not(.active):hover {
    background-color: #dbeafe;
}

.new-canvas-controls #focusTargetBtn:not(.active):hover img {
    opacity: 1;
    filter: none;
}

.new-canvas-controls .zoom-level {
    font-size: 0.8em;
    min-width: 45px;
    text-align: center;
    color: #374151;
}

.new-canvas-controls .separator {
    width: 1px;
    height: 15px;
    background-color: #d1d5db;
    margin: 0 4px;
}

/* Multi-Project Navigation Styles for NEW controls */
.new-canvas-controls #multiProjectPrevBtn,
.new-canvas-controls #multiProjectNextBtn,
.new-canvas-controls #multiProjectAddBtn {
    font-size: 13px;
    padding: 4px 8px;
    font-weight: 400;
    min-width: 28px;
}

.new-canvas-controls #multiProjectPrevBtn:disabled,
.new-canvas-controls #multiProjectNextBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.new-canvas-controls #multiProjectAddBtn {
    font-size: 13px;
    color: #222222;
    font-weight: 400;
}

.new-canvas-controls #multiProjectAddBtn:hover {
    background-color: #dbeafe;
    color: #2b2b2b;
}

.new-canvas-controls .multi-project-indicator {
    font-size: 0.75em;
    min-width: 40px;
    text-align: center;
    color: #6b7280;
    font-weight: 400;
}

.new-canvas-controls .multi-project-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0 4px;
}

/* Export Button Styling */
.export-btn-blue {
    background-color: #3b82f6 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700; /* Bold white text */
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.export-btn-blue:hover {
    background-color: #2563eb !important;
}

.export-btn-blue img {
    filter: brightness(0) invert(1); /* White icon */
}

.export-btn-blue span {
    color: white !important;
    font-weight: 700; /* Bold white text */
}

/* EXPORT DROPDOWN MODAL */
.export-dropdown-modal {
    position: fixed;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 350px;
    z-index: 100000 !important;
    overflow: hidden;
    pointer-events: auto;
}

.export-dropdown-modal.hidden {
    display: none !important;
}

/* Export Tabs */
.export-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.export-tab {
    flex: 1;
    padding: 15px 16px;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    font-weight: 700;
}

.export-tab:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.export-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: white;
    font-weight: 700;
}

/* Tab Content */
.export-tab-content {
    display: none;
    padding: 20px;
}

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

/* Form Groups */
.export-form-group {
    margin-bottom: 16px;
}

.export-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.export-select,
.export-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.export-select:hover,
.export-input:hover {
    border-color: #9ca3af;
}

.export-select:focus,
.export-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modal Buttons */
.export-modal-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.export-modal-btn-primary {
    background-color: #3b82f6;
    color: white;
    font-weight: 700;
}

.export-modal-btn-primary:hover {
    background-color: #2c78f3;
}

.export-modal-btn-dark {
    background-color: #3b82f6;
    color: white;
    font-weight: 700;
}

.export-modal-btn-dark:hover {
    background-color: #2a74ec;
}

/* Export Mode Toggle */
.export-mode-toggle-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background-color: #f3f4f6;
    border-radius: 8px;
}

.export-mode-toggle-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-mode-toggle-btn:hover {
    color: #374151;
}

.export-mode-toggle-btn.active {
    background-color: white;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.canvas-controls button {
    background: none;
    border: none;
    font-size: 0.9em;
    padding: 3px 2px;
    cursor: pointer;
    border-radius: 4px;
    color: #4b5563;
    transition: background-color 0.2s ease;
}
 .canvas-controls button:hover {
     background-color: #e5e7eb;
 }
 .canvas-controls .zoom-level {
     font-size: 0.8em;
     min-width: 45px;
     text-align: center;
     color: #374151;
 }
 .canvas-controls .separator {
    width: 1px;
    height: 15px;
    background-color: #d1d5db;
    margin: 0 4px;
 }

 /* Performance Controls */
 .canvas-controls .performance-indicator {
    font-size: 1.2em;
    cursor: pointer;
    transition: transform 0.2s ease;
    user-select: none;
 }
 .canvas-controls .performance-indicator:hover {
    transform: scale(1.1);
 }
 .canvas-controls #performanceToggleBtn {
    font-size: 0.85em;
    padding: 4px 8px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
 }
 .canvas-controls #performanceToggleBtn:hover {
    background-color: #e5e7eb;
 }

 /* Lock, Hide, and Ungroup Object Controls */
 .canvas-controls #lockObjectBtn,
 .canvas-controls #hideObjectBtn,
 .canvas-controls #unlockAllBtn,
 .canvas-controls #unhideAllBtn,
 .canvas-controls #ungroupSvgBtn {
    font-size: 1.1em;
    padding: 4px 8px;
    transition: all 0.2s ease;
 }
 .canvas-controls #lockObjectBtn:hover:not(:disabled),
 .canvas-controls #hideObjectBtn:hover:not(:disabled),
 .canvas-controls #unlockAllBtn:hover:not(:disabled),
 .canvas-controls #unhideAllBtn:hover:not(:disabled),
 .canvas-controls #ungroupSvgBtn:hover:not(:disabled) {
    background-color: #e5e7eb;
    transform: scale(1.05);
 }
 .canvas-controls #lockObjectBtn:disabled,
 .canvas-controls #hideObjectBtn:disabled,
 .canvas-controls #unlockAllBtn:disabled,
 .canvas-controls #unhideAllBtn:disabled,
 .canvas-controls #ungroupSvgBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
 }
 .canvas-controls #lockObjectBtn.active {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
 }
 .canvas-controls #hideObjectBtn.active {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
 }
 .canvas-controls #unlockAllBtn {
    background-color: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
 }
 .canvas-controls #unlockAllBtn:hover:not(:disabled) {
    background-color: #dcfce7;
    border-color: #16a34a;
    color: #14532d;
 }

 /* Green Unlock Icon Styles */
 .green-unlock-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: #22c55e;
    color: white;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 }

 .green-unlock-icon:hover {
    background-color: #16a34a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
 }

 /* Visual indication for locked objects */
 .canvas-locked-object {
    opacity: 0.8;
    filter: brightness(0.9);
 }

 .canvas-locked-object::after {
    content: '🔒';
    position: absolute;
    top: -5px;
    left: -5px;
    background: rgba(245, 158, 11, 0.9);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 999;
 }
 .canvas-controls #unhideAllBtn {
    background-color: #f0f9ff;
    border-color: #3b82f6;
    color: #1d4ed8;
 }
 .canvas-controls #unhideAllBtn:hover:not(:disabled) {
    background-color: #dbeafe;
    border-color: #2563eb;
    color: #1e3a8a;
 }

 /* Ungroup SVG Button Specific Styling */
 .canvas-controls #ungroupSvgBtn {
    background-color: #f0f9ff;
    border-color: #888888;
    color: #474747;
 }
 .canvas-controls #ungroupSvgBtn:hover:not(:disabled) {
    background-color: #e0f2fe;
    border-color: #0284c7;
    color: #0c4a6e;
 }
 .canvas-controls #ungroupSvgBtn:active {
    background-color: #bae6fd;
    transform: scale(0.98);
 }

 /* Object State Indicator Icons */
 .object-state-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    user-select: none;
 }
 .object-state-indicator:hover {
    background-color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 }
 .object-state-indicator.locked {
    color: #92400e;
    border-color: #f59e0b;
    background-color: rgba(254, 243, 199, 0.9);
 }
 .object-state-indicator.hidden {
    color: #dc2626;
    border-color: #ef4444;
    background-color: rgba(254, 226, 226, 0.9);
 }
 .canvas-controls #performanceToggleBtn.active {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
 }

 /* Guidelines Control Buttons */
 .canvas-controls #toggleGuidelinesBtn,
 .canvas-controls #clearGuidelinesBtn {
    font-size: 1.2em;
    padding: 4px 8px;
 }
 .canvas-controls #toggleGuidelinesBtn:hover,
 .canvas-controls #clearGuidelinesBtn:hover {
    background-color: #e0f2fe;
 }

/* Multi-Project Navigation Styles */
.canvas-controls #multiProjectPrevBtn,
.canvas-controls #multiProjectNextBtn,
.canvas-controls #multiProjectAddBtn {
    font-size: 0.9em;
    padding: 4px 0px;
    font-weight: 400;
    min-width: 28px;
}

.canvas-controls #multiProjectPrevBtn:disabled,
.canvas-controls #multiProjectNextBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.canvas-controls #multiProjectAddBtn {
    font-size: 0.8em;
    color: #222222;
    font-weight: 400;
}

.canvas-controls #multiProjectAddBtn:hover {
    background-color: #dbeafe;
    color: #2b2b2b;
}

.canvas-controls .multi-project-indicator {
    font-size: 0.75em;
    min-width: 40px;
    text-align: center;
    color: #6b7280;
    font-weight: 400;
}

.canvas-controls .multi-project-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0 4px;
}

.multi-project-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multi-project-dot:hover {
    background-color: #9ca3af;
    transform: scale(1.2);
}

.multi-project-dot.active {
    background-color: #3b82f6;
    width: 8px;
    height: 8px;
}

/* AI Generator Mode Indicators */
.left-sidebar.restyle-mode {
    border-left: 4px solid #f59e0b;
}

.left-sidebar.replace-mode {
    border-left: 4px solid #3b82f6;
}

.left-sidebar.restyle-mode .left-sidebar-header {
    background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
    border-bottom: 1px solid #f59e0b;
}

.left-sidebar.replace-mode .left-sidebar-header {
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 100%);
    border-bottom: 1px solid #3b82f6;
}

.left-sidebar.restyle-mode .left-sidebar-header h3::after {
    content: " (Restyle Mode)";
    color: #92400e;
    font-size: 0.8em;
    font-weight: normal;
}

.left-sidebar.replace-mode .left-sidebar-header h3::after {
    content: " (Replace Mode)";
    color: #1e40af;
    font-size: 0.8em;
    font-weight: normal;
}

.left-sidebar.match-style-mode .left-sidebar-header {
    background: linear-gradient(135deg, #f3e8ff 0%, #ffffff 100%);
    border-bottom: 1px solid #a855f7;
}

.left-sidebar.match-style-mode .left-sidebar-header h3::after {
    content: " (Match Style Mode)";
    color: #6b21a8;
    font-size: 0.8em;
    font-weight: normal;
}

/* Hide template selector in Match Style mode */
.left-sidebar.match-style-mode .ai-template-grid-container {
    display: none !important;
}

.left-sidebar.match-style-mode .form-group:has(.ai-template-grid-container) {
    display: none !important;
}

/* 🖼️ AI Image Uploader Styles */
.ai-image-uploader-section {
    margin-bottom: 20px;
}

.ai-image-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 32px 20px;
    text-align: center;
    background-color: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-wrap: wrap;
    flex-direction: column;
}

.ai-image-drop-zone:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.ai-image-drop-zone.drag-over {
    border-color: #3b82f6;
    background-color: #dbeafe;
    border-style: solid;
}

.ai-upload-icon {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-upload-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-upload-main-text {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    display: block;
}

.ai-upload-or-text {
    font-size: 13px;
    color: #64748b;
    display: block;
}

.ai-browse-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.ai-browse-link:hover {
    text-decoration: underline;
}

.ai-upload-hint-text {
    font-size: 12px;
    color: #94a3b8;
    display: block;
    margin-top: 4px;
}

.ai-upload-formats-text {
    font-size: 11px;
    color: #cbd5e1;
    display: block;
}

/* Image Preview Styles */
.ai-image-preview-container {
    margin-bottom: 20px;
}

.ai-image-preview-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.ai-image-preview {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.ai-image-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.ai-image-delete-btn:hover {
    background-color: rgba(220, 38, 38, 1);
    transform: scale(1.05);
}

.ai-image-delete-btn:active {
    transform: scale(0.95);
}


/* Sidebar Styling - Comprehensive Fix */
.sidebar {
    width: 350px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    isolation: isolate; /* Create new stacking context */
    z-index: 0; /* Ensure sidebar stays above canvas */
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.sidebar-tab {
    padding: 12px 15px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.95em;
    font-weight: 400;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease-in-out;
     flex-grow: 1;
     text-align: center;
}

.sidebar-tab.active {
    color: #0f172a;
    border-bottom-color: #3b82f6;
}
 .sidebar-tab:hover:not(.active) {
    background-color: #f8fafc;
 }


.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    display: none;
    position: relative;
    z-index: 1;
    contain: layout style; /* CSS containment to prevent content escape */
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}
.sidebar-content.active {
    display: block;
}

/* Fix sidebar content scrolling for all tabs */
#text-tab-content,
#image-tab-content,
#admin-tab-content {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    transform: none !important;
    width: 100% !important;
    max-height: calc(100vh - 120px) !important; /* Max height for scrolling */
    height: auto !important; /* Let content determine height up to max */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* Firefox scrollbar styling */
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 #f1f5f9 !important;
}

/* Specific fix for image tab content scrolling */
#image-tab-content.active {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(100vh - 120px) !important;
}

/* Comprehensive Admin Tab Content Fix - Additional rules */
#admin-tab-content {
    contain: layout style !important;
    margin: 0 !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    /* Force admin content to stay within sidebar */
    max-width: 350px !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
    /* Enhanced scrolling */
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 #f1f5f9 !important;
}

/* Cross-browser scrollbar styling for all sidebar tabs */
#text-tab-content::-webkit-scrollbar,
#image-tab-content::-webkit-scrollbar,
#admin-tab-content::-webkit-scrollbar {
    width: 8px !important;
}

#text-tab-content::-webkit-scrollbar-track,
#image-tab-content::-webkit-scrollbar-track,
#admin-tab-content::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 4px !important;
}

#text-tab-content::-webkit-scrollbar-thumb,
#image-tab-content::-webkit-scrollbar-thumb,
#admin-tab-content::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 4px !important;
}

#text-tab-content::-webkit-scrollbar-thumb:hover,
#image-tab-content::-webkit-scrollbar-thumb:hover,
#admin-tab-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

/* Shape Box Container - Image Tab Only */
.shape-box-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    position: relative;
    z-index: 1;
}

/* Ensure Shape Box only appears in Image tab */
#text-tab-content .shape-box-container,
#ai-tab-content .shape-box-container,
#admin-tab-content .shape-box-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Ensure Shape Box is visible only in Image tab */
#image-tab-content .shape-box-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

/* Hide "No image selected" message by default */
#no-image-selected-msg {
    display: none !important;
}

/* Only show "No image selected" message in Image tab when no image is selected */
#image-tab-content.active #no-image-selected-msg {
    display: block !important;
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 20px;
    margin: 10px 0;
}

/* Hide "No image selected" message when image is selected */
body.image-selected #image-tab-content #no-image-selected-msg {
    display: none !important;
}

/* Ensure Shape Box button is properly styled and contained */
#btnDrawFittingRectangleShape {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Force all sidebar elements to stay within their containers */
.sidebar-content * {
    position: relative !important;
    box-sizing: border-box !important;
}

/* EXCEPTION: Gradient picker dropdown must be absolutely positioned */
.sidebar-content .gradient-picker-dropdown {
    position: absolute !important;
    max-width: none !important;
}

/* EXCEPTION: Gradient picker container and parents need overflow visible */
.sidebar-content .gradient-picker-container,
.sidebar-content .gradient-picker-parent,
.sidebar-content .control-group:has(.gradient-picker-container) {
    overflow: visible !important;
    contain: none !important;
}

/* Exception for absolutely positioned elements that need to be relative */
.sidebar-content .control-group,
.sidebar-content .button-container,
.sidebar-content .action-button {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/* Specific fixes for admin tab elements */
#admin-tab-content .admin-controls,
#admin-tab-content .admin-ai-controls,
#admin-tab-content .control-group,
#admin-tab-content .admin-controls-flex {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure admin header stays in place */
#admin-tab-content .admin-header {
    position: relative !important;
    width: 100% !important;
    margin-bottom: 15px !important;
}

/* Strengthen sidebar containment */
.sidebar {
    position: relative !important;
    overflow: hidden !important;
    contain: layout style !important;
}

/* Ensure all sidebar content stays contained */
.sidebar-content {
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    contain: layout style !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Tab Content Containment Rules */
.sidebar-content > * {
    position: relative;
    z-index: 1;
}

/* Prevent any control group from escaping its container */
.sidebar-content .control-group {
    position: relative;
    z-index: 1;
    contain: layout;
}

/* Comprehensive containment for all sidebar elements */
.sidebar * {
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================== */
/* GRADIENT PICKER EXCEPTIONS - Allow dropdown to overflow sidebar */
/* ============================================== */

/* Allow gradient picker container to escape containment */
.sidebar .gradient-picker-container,
.sidebar-content .gradient-picker-container {
    overflow: visible !important;
    contain: none !important;
}

/* Allow gradient picker parent (control-group) to show overflow */
.sidebar .gradient-picker-parent,
.sidebar-content .gradient-picker-parent,
.sidebar .control-group:has(.gradient-picker-container),
.sidebar-content .control-group:has(.gradient-picker-container) {
    overflow: visible !important;
    contain: none !important;
}

/* The dropdown must be absolutely positioned, not relative */
.sidebar .gradient-picker-dropdown,
.sidebar-content .gradient-picker-dropdown {
    position: absolute !important;
    max-width: none !important;
    overflow-y: auto !important;
}

/* Ensure control groups AFTER the color picker have lower z-index than dropdown */
/* These are the Image Edit subtab controls that appear below the color picker */
#imageColorIntensityGroup,
#image-controls .control-group:has(#iImageStroke),
#image-controls .control-group:has(#iImageShadow),
#imageMaskingGroup {
    position: relative !important;
    z-index: 1 !important;
}

/* Generic fix: All control groups in image-edit-panel should have low z-index */
.image-edit-panel .control-group {
    position: relative;
    z-index: 1;
}

/* Except the gradient picker parent which needs higher z-index */
.image-edit-panel .gradient-picker-parent,
.image-edit-panel .control-group:has(.gradient-picker-container) {
    z-index: 10 !important;
}

/* Prevent any absolute positioning from escaping sidebar */
.sidebar .control-group,
.sidebar .admin-controls,
.sidebar .admin-ai-controls,
.sidebar .button-container,
.sidebar .action-buttons {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/* Ensure proper stacking context for main layout */
.main-content {
    position: relative;
    z-index: 1;
    isolation: isolate;
}

/* Common Button Styling */
 .action-buttons {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
    flex-shrink: 0;
}
 .action-buttons button {
     padding: 8px 15px;
     border: none;
     border-radius: 6px;
     cursor: pointer;
     font-size: 0.9em;
     font-weight: 400;
     transition: background-color 0.2s ease;
     margin-left: 5px;
 }
.action-buttons .add-btn {
     background-color: #3b82f6;
     color: white;
     min-width: 80px;
 }
 .action-buttons .add-btn:hover { background-color: #2563eb; }
 .action-buttons .delete-btn {
     background-color: #ef4444;
     color: white;
 }
 .action-buttons .delete-btn:hover:enabled { background-color: #dc2626; }
 .action-buttons .delete-btn:disabled {
     background-color: #d1d5db;
     cursor: not-allowed;
 }

/* Text/Image Headers */
.text-properties-header, .image-properties-header {
     font-size: 1.1em;
     font-weight: 400;
     margin-bottom: 10px;
     color: #1e293b;
     border-bottom: 1px solid #e2e8f0;
     padding-bottom: 8px;
     flex-shrink: 0;
}


/* Text Property Tabs */
.text-property-tabs {
    display: flex;
    margin-bottom: 15px;
    background-color: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}
.property-tab {
     flex: 1;
     text-align: center;
     padding: 8px 5px;
     cursor: pointer;
     border: none;
     background-color: transparent;
     font-size: 0.85em;
     font-weight: 400;
     color: #475569;
     border-radius: 6px;
     transition: all 0.2s ease-in-out;
}
.property-tab.active {
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.property-tab:hover:not(.active) { background-color: #e2e8f0; }

.property-panel {
    display: none;
    flex-direction: column;
    gap: 12px;
}
.property-panel.active { display: flex; }

/* Control Group Styling */
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    width: 100%;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.control-group label,
.parameter-control > label,
.effect-control > div label,
.control-group .radio-group label {
     flex-basis: 10px;
     flex-shrink: 0;
     text-align: right;
     font-size: 13px !important;
     font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
     color: #374151;
     margin-right: 0;
     font-weight: 400 !important
}
.slider-container {
     flex-grow: 1;
     display: flex;
     align-items: center;
}
input[type="range"] {
    flex-grow: 1;
    height: 4px;
    cursor: pointer;
    width: auto;
    vertical-align: middle;
}
 span.slider-value {
     font-size: 0.85em;
     color: #64748b;
     text-align: right;
     min-width: 40px;
     margin-left: 8px;
 }
input[type="text"], select {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9em;
}
select#iFontFamily option {
     font-size: 16px;
     padding: 4px 8px;
}
input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0;
}
 .simplified-color-picker { flex-grow: 1; display: flex; }

/* Checkbox/Radio Styling */
 input[type="checkbox"], input[type="radio"] { margin-right: 5px; cursor: pointer; }
 .font-style-controls { display: flex; align-items: center; gap: 15px; margin-left: auto; }
 .font-style-controls label { flex-basis: auto; text-align: left; margin-right: 2px;}
 .font-style-controls input { margin-right: 8px;}
 .radio-group { display: flex; align-items: center; gap: 10px; }
 .radio-container { display: flex; align-items: center; }
 .radio-container label { width: auto; text-align: left; margin: 0; font-size: 0.9em; }
 .radio-container span { margin-left: 3px; font-size: 0.9em; color: #333; }
 .fill-direction label:first-child { flex-basis: 100px; flex-shrink: 0; text-align: right; }

/* Parameter Control Sections */
.parameter-control { display: none; flex-direction: column; gap: 10px; border-top: 1px dashed #e2e8f0; padding-top: 10px; margin-top: 10px; }
.parameter-control h3, .parameter-control h4 { font-size: 0.9em; font-weight: 400; color: #1e293b; margin: 5px 0; border: none; padding: 0; }
.parameter-control h4 { font-size: 0.85em; color: #475569; margin-left: 0; }
.parameter-control h5 { font-size: 0.8em; font-weight: 400; color: #334155; margin: 8px 0 2px 0; }
.normal .normal-param, .warp .warp-param, .skew .skew-param, .circle .circle-param, .curve .curve-param, .mesh .mesh-param, .horizontalLines .horizontal-lines-param, .colorCut .color-cut-param, .obliqueLines .oblique-lines-param, .fadingLinesCut .fading-lines-cut-param, .stroke-enabled .stroke-param, .shadow .shadow-param, .block-shadow .block-shadow-param, .line-shadow .line-shadow-param, .detailed-3d .detailed-3d-param, .grid-distort .grid-distort-param { display: flex; }
.warp .horizontal-skew { display: flex; } .skew .horizontal-skew, .skew .vertical-skew { display: flex; } .triangle-warp-enabled .shift-center-control { display: flex; } .warp-param .shift-center-control:not(.triangle-warp-enabled .shift-center-control) { display: none; }
.property-panel .parameter-control { width: 100%; margin-left: 0; padding-left: 0; }
.property-panel .control-group { padding-left: 5px; }
.property-panel .parameter-control h3, .property-panel .parameter-control h4, .property-panel .parameter-control h5 { padding-left: 5px; }

/* Image Tab Specific */
#image-controls { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
#image-file-input { display: none; }

/* ===== CONSISTENT DISABLED STYLING FOR BOTH TEXT AND IMAGE TABS ===== */

/* Disabled state styling for TEXT controls */
#text-controls input:disabled,
#text-controls select:disabled,
#text-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disabled state styling for IMAGE controls (10% darker - higher opacity) */
#image-controls input:disabled,
#image-controls select:disabled,
#image-controls button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Disabled range sliders - TEXT tab */
#text-controls input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Disabled range sliders - IMAGE tab (10% darker - higher opacity) */
#image-controls input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disabled color inputs - TEXT tab */
#text-controls input[type="color"]:disabled {
    opacity: 0.4;
    filter: grayscale(70%);
    cursor: not-allowed;
}

/* Disabled color inputs - IMAGE tab (10% darker - higher opacity) */
#image-controls input[type="color"]:disabled {
    opacity: 0.5;
    filter: grayscale(60%);
    cursor: not-allowed;
}

/* Disabled checkboxes - TEXT tab */
#text-controls input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Disabled checkboxes - IMAGE tab (10% darker - higher opacity) */
#image-controls input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disabled container styling - TEXT tab */
#text-controls .parameter-control.disabled,
#text-controls .controls-hidden-indent.disabled,
#text-controls .control-group.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Disabled container styling - IMAGE tab (10% darker - higher opacity) */
#image-controls .parameter-control.disabled,
#image-controls .controls-hidden-indent.disabled,
#image-controls .control-group.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Disabled labels and text - TEXT tab */
#text-controls.disabled label,
#text-controls.disabled .property-label,
#text-controls.disabled .slider-value,
#text-controls.disabled .section-title,
#text-controls .parameter-control.disabled label,
#text-controls .parameter-control.disabled .property-label,
#text-controls .parameter-control.disabled .slider-value,
#text-controls .control-group.disabled label,
#text-controls .control-group.disabled .property-label,
#text-controls .control-group.disabled .slider-value {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disabled labels and text - IMAGE tab (10% darker - higher opacity) */
#image-controls.disabled label,
#image-controls.disabled .property-label,
#image-controls.disabled .slider-value,
#image-controls.disabled .section-title,
#image-controls .parameter-control.disabled label,
#image-controls .parameter-control.disabled .property-label,
#image-controls .parameter-control.disabled .slider-value,
#image-controls .control-group.disabled label,
#image-controls .control-group.disabled .property-label,
#image-controls .control-group.disabled .slider-value {
    opacity: 0.6;
    cursor: not-allowed;
}

/* CSS Filters Styles */
#image-filters-controls { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.filter-presets-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; }
.filter-preset-btn {
    padding: 6px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.filter-preset-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}
.filter-preset-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}
.reset-filters-btn:hover {
    background-color: #c82333 !important;
}

/* Style the default Pickr button */
#canvasBgColorPicker .pcr-button {
    width: 28px !important; /* Match other controls */
    height: 28px !important;
    border-radius: 4px !important;
    border: 3px solid #d1d5db !important; /* Added border */
    box-shadow: none !important; /* Remove default shadow if any */
    vertical-align: middle; /* Align with other controls */
}
/* Ensure the container div doesn't interfere */
#canvasBgColorPicker {
    display: inline-block; /* Allow vertical alignment */
    vertical-align: middle;
    line-height: 0; /* Prevent extra space */
}

/* ALIGNMENT BUTTON IN CANVAS CONTROLS */
.align-main-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 400;
    margin-left: 8px;
}

.align-main-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.align-main-btn:active {
    background: #e5e7eb;
}

.align-main-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.selected-count {
    color: #464646;
    font-size: 11px;
    font-weight: 400;
    margin-left: 8px;
}

/* ALIGNMENT PANEL (POPUP) */
.alignment-panel {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999999 !important; /* Much higher than canvas controls (99999) */
    min-width: 400px;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.alignment-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 400;
    font-size: 14px;
    color: #111827;
}

.alignment-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.alignment-panel-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.alignment-panel-content {
    padding: 20px;
}

.alignment-section {
    margin-bottom: 20px;
}

.alignment-section:last-child {
    margin-bottom: 0;
}

.alignment-section-title {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.alignment-buttons-row {
    display: flex;
    gap: 10px;
}

.align-btn-panel {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #374151;
}

.align-btn-panel:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    color: #3b82f6;
}

.align-btn-panel:active {
    background: #e5e7eb;
    transform: scale(0.98);
}

.align-btn-panel svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.align-btn-panel span {
    font-size: 11px;
    font-weight: 400;
}

/* Multi-select visual feedback */
.multi-selected {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5) !important;
}

.multi-select-hint {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    z-index: 1001;
    backdrop-filter: blur(10px);
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    10%, 90% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* CANVAS RIGHT-CLICK CONTEXT MENU */
.canvas-context-menu {
    position: fixed;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000000;
    min-width: 220px;
    padding: 6px 0;
    animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.canvas-context-menu.hidden {
    display: none;
}

.context-menu-section {
    padding: 0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 13px;
    font-weight: 400;
    color: #374151;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    filter: brightness(0) saturate(100%) invert(27%) sepia(8%) saturate(738%) hue-rotate(182deg) brightness(95%) contrast(88%);
}

.context-menu-item:hover img {
    opacity: 1;
}

.context-menu-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.context-menu-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 6px 0;
}
