/* ============================================
   UI Components Styles
   ============================================ */

/* Gallery Section */
.gallery-section {
    padding: var(--space-md);
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.gallery-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--neon-magenta);
}

.toggle-icon {
    display: inline-block;
    transition: transform var(--transition-normal);
}

.gallery-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.gallery-section.collapsed .gallery-content {
    display: none;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-text-muted);
    text-align: center;
}

.gallery-empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.gallery-item {
    position: relative;
    aspect-ratio: 3/2;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.gallery-item:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
    transform: translateY(-4px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: opacity var(--transition-normal);
    display: flex;
    align-items: flex-end;
    padding: var(--space-sm);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-info {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* Drawing Tools Panel */
.drawing-tools {
    position: fixed;
    top: 50%;
    left: var(--space-md);
    transform: translateY(-50%);
    padding: var(--space-md);
    z-index: var(--z-toolbar);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    width: 160px;
}

.drawing-tools h4 {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-align: center;
}

.drawing-colors {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: center;
}

.color-btn {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: white;
    box-shadow: 0 0 10px currentColor;
}

.drawing-sizes {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
}

.size-btn {
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.size-btn:hover {
    background: var(--color-surface-hover);
}

.size-btn.active {
    background: var(--neon-cyan);
    color: var(--color-bg-primary);
    border-color: var(--neon-cyan);
}

.drawing-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    padding: var(--space-lg);
    overflow-y: auto;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
    color: var(--neon-cyan);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Projects List */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.project-item:hover {
    background: var(--color-surface-hover);
    border-color: var(--neon-cyan);
}

.project-item-name {
    font-weight: 500;
}

.project-item-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.projects-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-muted);
}

/* Upload Area */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-area:hover {
    border-color: var(--neon-cyan);
    background: var(--color-surface-hover);
}

.upload-area.dragover {
    border-color: var(--neon-cyan);
    background: rgba(0, 245, 255, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.upload-area p {
    color: var(--color-text-secondary);
    text-align: center;
}

.upload-preview {
    margin-top: var(--space-md);
    text-align: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.success {
    border-color: var(--neon-lime);
}

.toast.error {
    border-color: #ff4757;
}

.toast.info {
    border-color: var(--neon-cyan);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-xs);
}

.toast-close:hover {
    color: var(--color-text-primary);
}

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

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.empty-state-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 160px 1fr 180px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .toolbar {
        flex-direction: row;
        overflow-x: auto;
        padding: var(--space-sm);
    }
    
    .tool-buttons {
        flex-direction: row;
    }
    
    .toolbar-left {
        order: 2;
    }
    
    .canvas-area {
        order: 1;
    }
    
    .toolbar-right {
        order: 3;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .drawing-tools {
        position: fixed;
        top: auto;
        bottom: var(--space-md);
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        width: auto;
    }
}
