/**
 * Creative Member Assets - Frontend Styles
 */

/* Message Styles */
.cma-message {
    padding: 1em;
    border-radius: 6px;
    margin-bottom: 1em;
    display: none;
}

.cma-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cma-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cma-message-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.cma-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Progress Styles */
.cma-upload-progress {
    margin-top: 1em;
}

.cma-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5em;
}

.cma-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6f5da8, #8b7cb8);
    width: 0%;
    transition: width 0.3s ease;
}

.cma-progress-text {
    font-size: 0.9em;
    color: #666;
}

/* Gallery Controls */
.cma-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
    gap: 1em;
}

.cma-gallery-controls {
    display: flex;
    align-items: center;
    gap: 1em;
}

.cma-context-filter {
    padding: 0.5em;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.cma-cleanup-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cma-cleanup-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Empty State */
.cma-empty-state {
    text-align: center;
    padding: 3em 2em;
    color: #666;
    grid-column: 1 / -1;
}

.cma-empty-state h4 {
    margin-bottom: 0.5em;
    color: #333;
}

/* Load More */
.cma-load-more {
    text-align: center;
    margin-top: 2em;
}

.cma-load-more-btn {
    background: #6f5da8;
    color: white;
    border: none;
    padding: 0.8em 2em;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cma-load-more-btn:hover {
    background: #5a4a87;
    transform: translateY(-2px);
}

/* Lightbox */
.cma-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.cma-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: default;
}

.cma-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.cma-close:hover {
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cma-asset-manager {
        padding: 1em;
    }
    
    .cma-gallery-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cma-gallery-controls {
        justify-content: space-between;
    }
    
    .cma-drop-zone {
        padding: 2em 1em;
    }
    
    .cma-upload-icon {
        font-size: 2em;
    }
    
    .cma-file-overlay button {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .cma-lightbox img {
        max-width: 95%;
        max-height: 95%;
    }
    
    .cma-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .cma-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8em;
    }
    
    .cma-file-info {
        padding: 0.8em;
    }
    
    .cma-file-name {
        font-size: 0.9em;
    }
    
    .cma-file-meta {
        font-size: 0.8em;
        flex-direction: column;
        gap: 0.2em;
    }
    
    .cma-usage-badge {
        font-size: 0.7em;
        padding: 0.1em 0.4em;
    }
}

/* Animation for file cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cma-file-card {
    animation: fadeInUp 0.3s ease-out;
}

/* Drag and drop states */
.cma-drop-zone.dragover {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Loading states */
.cma-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.cma-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #6f5da8;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Focus styles for accessibility */
.cma-browse-btn:focus,
.cma-cleanup-btn:focus,
.cma-load-more-btn:focus,
.cma-file-overlay button:focus {
    outline: 2px solid #6f5da8;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cma-file-card {
        border: 2px solid #000;
    }
    
    .cma-usage-active {
        background: #000;
        color: #fff;
    }
    
    .cma-usage-unused {
        background: #fff;
        color: #000;
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cma-file-card,
    .cma-progress-fill,
    .cma-usage-fill,
    .cma-file-overlay,
    .cma-load-more-btn {
        transition: none;
    }
    
    .cma-file-card {
        animation: none;
    }
    
    .cma-drop-zone.dragover {
        animation: none;
    }
}
