/* Marketing Campaign Template Selector Enhancements */

/* Template Selector Container */
.marketing-template-selector {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

/* Search and Filter Bar */
.template-filter-bar {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.template-search-input {
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    transition: all 0.3s ease !important;
}

.template-search-input:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
}

.template-filter-select {
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    background-color: white !important;
}

/* Template Grid */
.marketing-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Individual Template Cards */
.marketing-template-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.marketing-template-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.marketing-template-card.selected {
    border-color: #0d6efd !important;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.2);
}

.marketing-template-card.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d6efd, #0084ff);
}

/* Template Preview Thumbnail */
.template-thumbnail {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 1px solid #e9ecef;
}

.template-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.template-thumbnail-placeholder {
    color: #6c757d;
    font-size: 2rem;
    opacity: 0.5;
}

.template-thumbnail-overlay {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Template Card Content */
.template-card-header {
    margin-bottom: 0.5rem;
}

.template-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card-description {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Template Metadata */
.template-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.template-meta-item {
    font-size: 0.8rem;
    color: #495057;
}

.template-meta-label {
    font-weight: 500;
    color: #6c757d;
}

/* Status and Priority Badges */
.template-status-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-active-badge {
    background: #d4edda !important;
    color: #155724 !important;
}

.template-inactive-badge {
    background: #f1f3f4 !important;
    color: #5f6368 !important;
}

.template-priority-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.priority-high {
    background: #f8d7da !important;
    color: #721c24 !important;
}

.priority-normal {
    background: #cce7ff !important;
    color: #004085 !important;
}

.priority-low {
    background: #e9ecef !important;
    color: #495057 !important;
}

/* Usage Statistics */
.template-usage-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}

.usage-stat {
    text-align: center;
    flex: 1;
}

.usage-stat-number {
    font-size: 1rem;
    font-weight: 600;
    color: #0d6efd;
    display: block;
}

.usage-stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selected Template Indicator */
.selected-indicator {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    background: #0d6efd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
}

.marketing-template-card.selected .selected-indicator {
    opacity: 1;
    transform: scale(1);
}

/* Empty State */
.templates-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.templates-empty-icon {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

/* Loading State */
.templates-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.templates-loading .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-right: 1rem;
}

/* Filter Badges */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.filter-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.filter-badge:hover {
    background: #bbdefb;
}

.filter-badge .remove-filter {
    cursor: pointer;
    width: 16px;
    height: 16px;
    background: rgba(25, 118, 210, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .marketing-templates-grid {
        grid-template-columns: 1fr;
        max-height: 300px;
    }
    
    .template-filter-bar {
        padding: 0.75rem;
    }
    
    .template-filter-bar .row > div {
        margin-bottom: 0.5rem;
    }
}

/* Advanced Preview Modal Styles */
.template-preview-modal .modal-dialog {
    max-width: 800px;
}

.template-preview-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    padding: 1rem;
}

.template-preview-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.template-preview-details h5 {
    color: #212529;
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f3f4;
}

.detail-label {
    font-weight: 500;
    color: #6c757d;
}

.detail-value {
    color: #212529;
}

/* Animation for template selection */
@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.marketing-template-card.selecting {
    animation: selectPulse 0.3s ease;
}

/* Scrollbar styling for template grid */
.marketing-templates-grid::-webkit-scrollbar {
    width: 6px;
}

.marketing-templates-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.marketing-templates-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.marketing-templates-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Quick action buttons on template cards */
.template-quick-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.marketing-template-card:hover .template-quick-actions {
    opacity: 1;
}

.quick-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.quick-action-btn:hover {
    background: white;
    color: #0d6efd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
