/* Theme Selector - Card-Based Grid Layout */

.theme-management {
    padding: 1.5rem;
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Theme Card */
.theme-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #dee2e6 0%, #dee2e6 100%);
    transition: all 0.3s ease;
    z-index: 1;
}

.theme-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: #adb5bd;
}

.theme-card:hover::before {
    height: 6px;
}

/* Theme-specific accent colors */
.theme-milano::before {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.theme-modern::before {
    background: linear-gradient(90deg, #007bff 0%, #6610f2 100%);
}

.theme-classic::before {
    background: linear-gradient(90deg, #6f42c1 0%, #e83e8c 100%);
}

.theme-empty::before {
    background: linear-gradient(90deg, #6c757d 0%, #495057 100%);
}

.theme-minimal::before {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
}

.theme-bold::before {
    background: linear-gradient(90deg, #dc3545 0%, #fd7e14 100%);
}

/* Active Theme Styling */
.theme-card.theme-active {
    border-color: #28a745;
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.25);
    background: linear-gradient(to bottom, #ffffff 0%, #f8fff9 100%);
}

.theme-card.theme-active::before {
    height: 6px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.theme-card.theme-active:hover {
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.35);
    transform: translateY(-8px);
}

.theme-card.theme-active .theme-card-header {
    position: relative;
}

.theme-card.theme-active .theme-card-header::after {
    content: '';
    position: absolute;
    top: -1.5rem;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 0 0 4px 4px;
}

/* Preview Image Area */
.theme-card-preview {
    position: relative;
    width: 100%;
    height: 240px;
    background: #f8f9fa;
    overflow: hidden;
    border-bottom: 1px solid #e9ecef;
}

.theme-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.theme-card:hover .theme-preview-image {
    transform: scale(1.05);
}

.theme-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.theme-preview-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.9;
    z-index: 0;
}

.theme-preview-placeholder i,
.theme-preview-placeholder span {
    position: relative;
    z-index: 1;
}

.theme-preview-placeholder i {
    font-size: 4rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.theme-preview-placeholder span {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Theme-specific placeholder colors */
.theme-milano-placeholder::before {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.theme-modern-placeholder::before {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
}

.theme-classic-placeholder::before {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
}

.theme-empty-placeholder::before {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.theme-minimal-placeholder::before {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    opacity: 1;
}

.theme-minimal-placeholder {
    color: #212529;
    text-shadow: none;
}

.theme-bold-placeholder::before {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

/* Active Badge */
.theme-active-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
    z-index: 10;
}

.theme-active-badge i {
    font-size: 0.875rem;
}

/* Card Body */
.theme-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.theme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.theme-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    flex: 1;
    line-height: 1.4;
    letter-spacing: -0.5px;
}

.theme-description {
    color: #495057;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.5rem;
}

/* Theme Metadata */
.theme-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.theme-meta small {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: #6c757d;
    font-weight: 500;
}

.theme-meta i {
    font-size: 0.875rem;
    color: #495057;
}

/* Action Buttons */
.theme-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.theme-actions .btn {
    flex: 1;
    min-width: 90px;
    white-space: nowrap;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.theme-actions .btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
}

.theme-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-actions .btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .theme-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .theme-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .theme-card-preview {
        height: 180px;
    }
    
    .theme-management {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .theme-actions {
        flex-direction: column;
    }
    
    .theme-actions .btn {
        width: 100%;
    }
}

/* Filter and Search */
#themeSearch,
#themeFilter,
#themeSort {
    transition: all 0.2s ease;
}

#themeSearch:focus,
#themeFilter:focus,
#themeSort:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

/* Hidden state for filtered items */
.theme-card.hidden {
    display: none;
}

/* Loading State */
.theme-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.theme-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Preview Mode Banner */
.preview-mode-banner {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #212529;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 9999;
    border-bottom: 2px solid #ff9800;
}

.preview-mode-banner .container-fluid {
    max-width: 100%;
}

.preview-mode-banner i {
    font-size: 1.25rem;
}

.preview-mode-banner strong {
    font-weight: 600;
}

.preview-mode-banner .btn {
    font-weight: 500;
}

.preview-mode-banner .btn-outline-light {
    border-color: rgba(33, 37, 41, 0.3);
    color: #212529;
}

.preview-mode-banner .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(33, 37, 41, 0.5);
}

.preview-mode-banner .btn-light {
    background-color: #ffffff;
    color: #212529;
    border-color: #ffffff;
}

.preview-mode-banner .btn-light:hover {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

@media (max-width: 768px) {
    .preview-mode-banner .col-md-8,
    .preview-mode-banner .col-md-4 {
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .preview-mode-banner .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

