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

:root {
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --accent-gradient: linear-gradient(135deg, #22c55e 0%, #0d9488 100%);
    --main-bg-color: #ffffff;
    --main-text-color: #1f2937;
    --sidebar-bg: #f9fafb;
    --sidebar-accent: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --glass-effect: rgba(249, 250, 251, 0.8);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--main-bg-color);
    color: var(--main-text-color);
    min-height: 100vh;
    overflow-y: auto;
}

/* Login Modal Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(79, 70, 229, 0.05) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-container {
    background: white;
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.5s ease-out;
}

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

.login-header h2 {
    color: var(--main-text-color);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-header p {
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#password-input {
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    background-color: #f9fafb;
    color: var(--main-text-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    outline: none;
}

#password-input:focus {
    border-color: #2563eb;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-btn {
    padding: 15px 30px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
    opacity: 0.9;
}

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

.login-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 10px;
    padding: 10px;
    background-color: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

/* Global Loader Styles */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.global-loader-content {
    text-align: center;
    color: var(--main-text-color);
    animation: fadeInUp 0.6s ease-out;
}

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

.global-loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

.global-loader-content h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--main-text-color);
}

.global-loader-content p {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 400;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 400px;
    background-color: var(--sidebar-bg);
    color: var(--main-text-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.logout-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--main-text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--sidebar-accent);
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.filter-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--main-text-color);
}

.filter-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: white;
    color: var(--main-text-color);
    font-size: 14px;
}

.filter-section select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.categories-section, .assets-section {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 0;
}

.categories-section h3, .assets-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 10px;
}

.super-category-card {
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 200px;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.super-category-card:hover {
    border-color: #2563eb;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.15);
    background-color: #fafbfc;
}

.super-category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.super-category-card:hover::before {
    opacity: 1;
}

.super-category-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border: 3px solid #f3f4f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}


.category-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ffffff;
    background: var(--primary-gradient);
    border-radius: 50%;
}

.super-category-image::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    opacity: 0.1;
    z-index: -1;
}

.super-category-info h4 {
    color: var(--main-text-color);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.super-category-info p {
    color: #6b7280;
    font-size: 13px;
    margin: 0;
    font-weight: 500;
    background-color: #f3f4f6;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

.category-card {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

.category-card:hover {
    background-color: #fafbfc;
    transform: translateY(-2px);
    border-color: #d1d5db;
}

.category-card.selected {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

.category-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 14px;
    font-weight: 500;
}

.assets-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.back-button {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.asset-card {
    background-color: white;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

.asset-card:hover {
    background-color: #fafbfc;
    transform: translateY(-2px);
    border-color: #d1d5db;
}

.asset-card.selected {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

.asset-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 8px;
}

.asset-name {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
}

.asset-vendor {
    font-size: 10px;
    color: #6b7280;
}

/* Selected Assets Section */
.selected-assets-section {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    background-color: var(--sidebar-accent);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.selected-assets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.selected-assets-header h3 {
    font-size: 1.1rem;
    color: #2563eb;
}

.selected-assets-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    flex: 1;
}

.selected-assets-loading p {
    margin-top: 15px;
    color: #6b7280;
    font-size: 14px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.clear-selection-button {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-selection-button:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.selected-assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.selected-asset-card {
    background-color: white;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    position: relative;
    border: 2px solid #2563eb;
}

.selected-asset-thumbnail {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 6px;
}

.selected-asset-name {
    font-size: 10px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--main-text-color);
}

.selected-asset-vendor {
    font-size: 8px;
    color: #6b7280;
    margin-bottom: 6px;
}

.remove-asset-button {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-asset-button:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

.no-selection-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 20px;
}

.no-selection-message p {
    margin: 5px 0;
    font-size: 14px;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--main-bg-color);
    overflow: hidden;
}

.image-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 10px 20px;
    overflow-y: auto;
    max-height: 100vh;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.prompt-section {
    margin-bottom: 10px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.prompt-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--main-text-color);
    font-size: 14px;
}

.prompt-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid var(--border-color);
    background-color: white;
    color: var(--main-text-color);
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.prompt-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.prompt-textarea::placeholder {
    color: #6b7280;
    font-style: italic;
}

/* Quick Actions Section */
.quick-actions-section {
    margin-bottom: 10px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.quick-actions-section h3 {
    margin-bottom: 10px;
    color: var(--main-text-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 80px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.quick-action-btn:hover {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.quick-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-action-btn:hover::before {
    opacity: 1;
}

.quick-action-btn.selected {
    border-color: #22c55e;
    background-color: rgba(34, 197, 94, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.quick-action-btn.selected::before {
    opacity: 1;
    background: var(--accent-gradient);
}

.action-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.action-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--main-text-color);
    line-height: 1.3;
    text-align: center;
}

/* Responsive adjustments for quick actions */
@media (max-width: 768px) {
    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .quick-action-btn {
        padding: 12px 8px;
        min-height: 70px;
    }
    
    .action-icon {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .action-text {
        font-size: 11px;
    }
}

.viewer-header h2 {
    color: var(--main-text-color);
    font-size: 1.8rem;
}

.viewer-controls {
    display: flex;
    gap: 10px;
}

.control-button, .generate-button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.control-button {
    background-color: #6b7280;
    color: white;
}

.control-button:hover {
    background-color: #4b5563;
    transform: translateY(-1px);
}

.generate-button {
    background: var(--accent-gradient);
    color: white;
    font-size: 16px;
    padding: 12px 25px;
}

.generate-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.generate-button:disabled {
    background: #6b7280;
    cursor: not-allowed;
    opacity: 0.7;
}

.generate-button:disabled:hover {
    background: #6b7280;
    transform: none;
    box-shadow: none;
}

.save-all-button {
    background: var(--primary-gradient);
    color: white;
    font-size: 16px;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.save-all-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.save-all-button:disabled {
    background: #6b7280;
    cursor: not-allowed;
    opacity: 0.7;
}

.save-all-button:disabled:hover {
    background: #6b7280;
    transform: none;
    box-shadow: none;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    margin-bottom: 10px;
    position: relative;
    transition: all 0.3s ease;
    min-height: 500px;
    max-height: calc(100vh - 380px);
    overflow: hidden;
    padding: 0;
}

.canvas-container.drag-over {
    border-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
    transform: scale(1.02);
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(249, 250, 251, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.upload-overlay.show {
    opacity: 1;
    visibility: visible;
}

.upload-content {
    text-align: center;
    color: var(--main-text-color);
    padding: 40px;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.upload-content p {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.browse-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: underline;
}

.browse-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.upload-hint {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 15px;
}

#room-canvas {
    border: none;
    border-radius: 8px;
    background-color: white;
    cursor: crosshair;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: 100%;
    object-fit: contain;
    display: block;
}

.canvas-info {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    flex-shrink: 0;
    margin-top: 5px;
    font-size: 0.875rem;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #6b7280;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 40vh;
    }
    
    .main-content {
        min-height: 60vh;
        overflow: hidden;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .assets-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .canvas-container {
        max-height: calc(100vh - 480px);
        min-height: 400px;
    }
}

/* Image Slider Controls */
.image-slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    pointer-events: auto;
}

.slider-arrow-btn {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.slider-arrow-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.slider-arrow-btn:active {
    transform: scale(0.95);
}

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

.slider-arrow-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.slider-indicator {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    padding: 0 10px;
    user-select: none;
}

/* Preparing Data Indicator */
.preparing-data-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: white;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
}

.preparing-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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