/**
 * Public styles for WP Digital Asset Manager
 *
 * @package WP_DAM
 */

/* General Styles */
.wp-dam-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.wp-dam-heading {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.wp-dam-button {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-weight: 500;
    font-size: 14px;
    line-height: 2;
    min-height: 30px;
}

.wp-dam-button:hover {
    background: #135e96;
    color: #fff;
    text-decoration: none;
}

.wp-dam-button.secondary {
    background: #f0f0f0;
    color: #333;
}

.wp-dam-button.secondary:hover {
    background: #e0e0e0;
    color: #333;
}

.wp-dam-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.wp-dam-toolbar-left,
.wp-dam-toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wp-dam-search {
    position: relative;
    min-width: 200px;
}

.wp-dam-search input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    padding-right: 30px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wp-dam-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.wp-dam-pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.wp-dam-pagination a,
.wp-dam-pagination span {
    margin: 0 5px;
    padding: 5px 10px;
    border-radius: 3px;
    text-decoration: none;
}

.wp-dam-pagination a {
    background: #f0f0f0;
    color: #333;
}

.wp-dam-pagination a:hover {
    background: #2271b1;
    color: #fff;
}

.wp-dam-pagination .current {
    background: #2271b1;
    color: #fff;
}

/* Asset Gallery */
.wp-dam-assets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.wp-dam-asset-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wp-dam-asset-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.wp-dam-asset-preview {
    position: relative;
    padding-top: 75%;
    background: #f7f7f7;
}

.wp-dam-asset-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-dam-asset-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: #ccc;
}

.wp-dam-asset-info {
    padding: 15px;
}

.wp-dam-asset-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-dam-asset-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.wp-dam-asset-meta span {
    display: inline-block;
    margin-right: 15px;
}

.wp-dam-asset-actions {
    display: flex;
    gap: 5px;
}

/* Collections */
.wp-dam-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

.wp-dam-collections-sidebar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

.wp-dam-collections-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.wp-dam-collections-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-dam-collections-tree li {
    margin: 0;
    padding: 5px 0;
}

.wp-dam-collections-tree li ul {
    margin-left: 20px;
}

.wp-dam-collection-name {
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.wp-dam-collection-name:hover {
    background: #f1f1f1;
    text-decoration: none;
}

.wp-dam-collection-name.active {
    background: #e6f0f7;
    text-decoration: none;
}

.wp-dam-collection-icon {
    margin-right: 8px;
    color: #2271b1;
}

.wp-dam-collection-count {
    margin-left: auto;
    background: #eee;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
}

.wp-dam-collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.wp-dam-collection-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.wp-dam-collection-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
}

.wp-dam-collection-preview {
    position: relative;
    padding-top: 60%;
    background: #f0f0f0;
}

.wp-dam-collection-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-dam-collection-thumbnail {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 10px;
    gap: 5px;
}

.wp-dam-collection-thumbnail img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.wp-dam-collection-info {
    padding: 15px;
}

.wp-dam-collection-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.wp-dam-collection-description {
    color: #666;
    font-size: 13px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.wp-dam-collection-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

/* Single Asset View */
.wp-dam-single-asset {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.wp-dam-asset-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.wp-dam-asset-header h1 {
    margin: 0 0 5px 0;
    font-size: 24px;
}

.wp-dam-asset-subheader {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 14px;
}

.wp-dam-asset-author {
    margin-right: 15px;
}

.wp-dam-asset-date {
    margin-right: 15px;
}

.wp-dam-asset-views {
    margin-left: auto;
}

.wp-dam-asset-body {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    padding: 20px;
}

.wp-dam-asset-main-content {
    display: flex;
    flex-direction: column;
}

.wp-dam-asset-preview-large {
    text-align: center;
    margin-bottom: 20px;
    background: #f7f7f7;
    border-radius: 8px;
    padding: 20px;
}

.wp-dam-asset-preview-large img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 4px;
}

.wp-dam-asset-description {
    margin-bottom: 20px;
}

.wp-dam-asset-sidebar {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 20px;
}

.wp-dam-asset-sidebar-section {
    margin-bottom: 20px;
}

.wp-dam-asset-sidebar-section:last-child {
    margin-bottom: 0;
}

.wp-dam-asset-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.wp-dam-asset-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-dam-asset-meta-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.wp-dam-asset-meta-label {
    font-weight: 600;
    color: #333;
}

.wp-dam-asset-meta-value {
    text-align: right;
    color: #666;
}

.wp-dam-asset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.wp-dam-asset-tag {
    background: #e6f0f7;
    color: #2271b1;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    text-decoration: none;
}

.wp-dam-asset-tag:hover {
    background: #2271b1;
    color: #fff;
    text-decoration: none;
}

.wp-dam-asset-collections {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-dam-asset-collection-item {
    margin-bottom: 8px;
}

.wp-dam-asset-collection-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #2271b1;
    font-size: 14px;
}

.wp-dam-asset-collection-link:hover {
    text-decoration: underline;
}

.wp-dam-asset-collection-icon {
    margin-right: 5px;
}

.wp-dam-asset-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wp-dam-asset-button {
    width: 100%;
    text-align: center;
}

/* Upload Form */
.wp-dam-upload-form {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.wp-dam-upload-zone {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    background: #f9f9f9;
}

.wp-dam-upload-zone:hover, 
.wp-dam-upload-zone.drag-over {
    border-color: #2271b1;
    background: #f0f7ff;
}

.wp-dam-upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.wp-dam-upload-icon {
    margin-bottom: 15px;
    color: #2271b1;
}

.wp-dam-upload-text {
    font-size: 14px;
    color: #666;
}

.wp-dam-upload-preview-image {
    margin-top: 20px;
}

.wp-dam-upload-preview-image img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wp-dam-form-footer {
    margin-top: 20px;
    text-align: right;
}

/* User Dashboard */
.wp-dam-dashboard-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.wp-dam-dashboard-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.wp-dam-dashboard-tab:hover {
    color: #2271b1;
}

.wp-dam-dashboard-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.wp-dam-dashboard-section {
    display: none;
}

.wp-dam-dashboard-section.active {
    display: block;
}

.wp-dam-empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wp-dam-empty-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.wp-dam-empty-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.wp-dam-empty-description {
    color: #666;
    max-width: 400px;
    margin: 0 auto 20px;
}

/* Login Form */
.wp-dam-login-container {
    max-width: 400px;
    margin: 40px auto;
}

.wp-dam-login-form {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.wp-dam-login-title {
    text-align: center;
    margin-bottom: 20px;
}

.wp-dam-login-submit {
    width: 100%;
}

.wp-dam-login-links {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.wp-dam-login-links a {
    color: #2271b1;
    text-decoration: none;
}

.wp-dam-login-links a:hover {
    text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 782px) {
    .wp-dam-layout {
        grid-template-columns: 1fr;
    }
    
    .wp-dam-assets,
    .wp-dam-collections-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .wp-dam-asset-body {
        grid-template-columns: 1fr;
    }
    
    .wp-dam-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .wp-dam-toolbar-right {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
}

/* Legal/Rights Information */
.wp-dam-asset-legal {
    margin-top: 25px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.wp-dam-asset-legal h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.wp-dam-asset-legal-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wp-dam-legal-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wp-dam-legal-icon {
    color: #555;
    font-size: 18px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-dam-legal-text {
    font-size: 14px;
    line-height: 1.4;
}

.wp-dam-legal-text strong {
    margin-right: 5px;
    color: #333;
}

.wp-dam-legal-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.wp-dam-legal-description {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

/* Visual Search Styles */
.wp-dam-visual-search {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.wp-dam-search-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.wp-dam-tab-button {
    padding: 10px 15px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 15px;
}

.wp-dam-tab-button:hover {
    color: #2271b1;
}

.wp-dam-tab-button.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.wp-dam-tab-content {
    display: none;
}

.wp-dam-tab-content.active {
    display: block;
}

/* Visual Search Results */
.wp-dam-visual-search-results {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wp-dam-search-info {
    display: flex;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.wp-dam-search-reference {
    flex: 1;
    padding-right: 30px;
}

.wp-dam-search-filters {
    width: 300px;
    padding-left: 30px;
    border-left: 1px solid #eee;
}

.wp-dam-reference-asset {
    display: flex;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.wp-dam-reference-thumbnail {
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
    margin-right: 15px;
}

.wp-dam-reference-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-dam-reference-details {
    flex: 1;
}

.wp-dam-reference-details h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.wp-dam-reference-collections {
    margin-top: 10px;
}

.wp-dam-collection-tag {
    display: inline-block;
    background: #eee;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.wp-dam-filter-field {
    margin-bottom: 15px;
}

.wp-dam-filter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
}

.wp-dam-filter-field select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wp-dam-filter-actions {
    margin-top: 20px;
}

.wp-dam-similar-assets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.wp-dam-similar-item {
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.wp-dam-similar-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.wp-dam-similar-thumbnail {
    height: 180px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-dam-similar-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-dam-similar-info {
    padding: 15px;
}

.wp-dam-similar-title {
    margin: 0 0 5px 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-dam-similar-meta {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
}

.wp-dam-similar-score {
    font-weight: 600;
    color: #2271b1;
}

.wp-dam-similar-actions {
    display: flex;
    justify-content: space-between;
}

.wp-dam-search-footer {
    margin-top: 20px;
    text-align: center;
}

.wp-dam-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.wp-dam-empty-icon {
    color: #ccc;
    margin-bottom: 20px;
}

.wp-dam-empty-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.wp-dam-empty-description {
    color: #666;
    margin-bottom: 20px;
}

/* Performance optimization styles */
.wp-dam-lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.wp-dam-loaded {
    opacity: 1;
}

.wp-dam-image-placeholder {
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.wp-dam-image-placeholder::before {
    content: "";
    display: block;
    position: absolute;
    left: -150px;
    top: 0;
    height: 100%;
    width: 150px;
    background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 1.5s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(100% + 150px));
    }
}

.wp-dam-load-more {
    text-align: center;
    margin: 20px 0;
}

/* Performance classes for asset grid */
.wp-dam-optimized-grid {
    will-change: transform;
    contain: layout style;
}

.wp-dam-asset-item {
    contain: content;
}

/* Optimized rendering for large lists */
.wp-dam-collections-tree {
    contain: content;
}

/* Reduced layout thrashing */
.wp-dam-asset-preview img {
    aspect-ratio: attr(width) / attr(height);
} 