/* Manage Templates Page Styles */

.manage-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2d2d2d;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #404040;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left h2 {
    color: white;
    margin: 0 0 5px 0;
    font-size: 24px;
}

.template-count {
    color: #aaa;
    font-size: 14px;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.create-new-btn {
    background-color: #28a745;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.create-new-btn:hover {
    background-color: #1e7e34;
}

.export-btn,
.import-btn {
    background-color: #404040;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.export-btn:hover,
.import-btn:hover {
    background-color: #555;
}

/* Templates Grid */
.templates-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.template-card {
    background-color: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.template-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b9d;
}

.template-header {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #404040;
}

.template-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #1a1a1a;
}

.template-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-basic-info {
    flex: 1;
    min-width: 0;
}

.template-basic-info .template-title {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.template-basic-info .template-description {
    margin: 0 0 10px 0;
    font-size: 13px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-basic-info .template-stats {
    gap: 10px;
    margin: 0;
}

.template-preview {
    height: 150px;
    background-color: #1a1a1a;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.tier-preview {
    display: flex;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
}

.tier-label-preview {
    width: 40px;
    background-color: #ff6b9d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.tier-items-preview {
    flex: 1;
    background-color: #404040;
    display: flex;
    align-items: center;
    padding: 2px;
    gap: 2px;
}

.tier-item-preview {
    width: 26px;
    height: 26px;
    border-radius: 2px;
    overflow: hidden;
}

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

.template-info {
    padding: 15px 20px 20px 20px;
}

.template-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.template-description {
    color: #aaa;
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 12px;
    color: #666;
}

.template-stats {
    display: flex;
    gap: 15px;
}

.public-badge,
.local-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.public-badge {
    background-color: #28a745;
    color: white;
}

.local-badge {
    background-color: #6c757d;
    color: white;
}

.template-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.edit-btn {
    background-color: #007bff;
    color: white;
}

.edit-btn:hover {
    background-color: #0056b3;
}

.duplicate-btn {
    background-color: #6f42c1;
    color: white;
}

.duplicate-btn:hover {
    background-color: #5a2d8c;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #b21e2f;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #404040;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: white;
    font-size: 24px;
    margin: 0 0 10px 0;
}

.empty-state p {
    color: #aaa;
    font-size: 16px;
    margin: 0 0 25px 0;
}

.create-first-btn {
    background-color: #28a745;
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s ease;
    display: inline-block;
}

.create-first-btn:hover {
    background-color: #1e7e34;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #2d2d2d;
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid #404040;
}

.modal-content h3 {
    color: white;
    margin: 0 0 15px 0;
    font-size: 20px;
}

.modal-content p {
    color: #aaa;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.warning-text {
    color: #dc3545 !important;
    font-weight: 600;
    margin-bottom: 25px !important;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.cancel-btn:hover {
    background-color: #545b62;
}

.modal .delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.modal .delete-btn:hover {
    background-color: #b21e2f;
}

/* Responsive Design */
@media (max-width: 768px) {
    .manage-main {
        padding: 15px;
    }
    
    .templates-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-right {
        justify-content: center;
    }
    
    .templates-container {
        grid-template-columns: 1fr;
    }
    
    .template-actions {
        flex-direction: column;
    }
    
    .action-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .template-card {
        margin: 0 -10px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .cancel-btn,
    .modal .delete-btn {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.template-card {
    animation: fadeIn 0.3s ease;
}

/* Success/Error Messages */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    animation: fadeIn 0.3s ease;
}

.message.success {
    background-color: #28a745;
}

.message.error {
    background-color: #dc3545;
}

.message.warning {
    background-color: #ffc107;
    color: #333;
}