 .open-popup-btn {
    background-color: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.open-popup-btn:hover {
    background-color: #005a87;
}

/* Popup Overlay */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s;
}

.popup-overlay.active {
    display: block;
    opacity: 1;
}

/* Popup Modal */
.popup-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.popup-modal.active {
    display: block;
    opacity: 1;
}

.popup-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.popup-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-popup-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.close-popup-btn:hover {
    background-color: #eee;
    color: #000;
}

.popup-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group select:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #0073aa;
}

/* Predefined Templates Section */
.templates-section {
    margin-top: 30px;
    display: none;
}

.templates-section.active {
    display: block;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Custom Scrollbar for templates grid */
.templates-grid::-webkit-scrollbar {
    width: 8px;
}

.templates-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.templates-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.templates-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.template-item {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #f9f9f9;
}

.template-item:hover {
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.template-item.selected {
    border-color: #0073aa;
    background-color: #e6f3f8;
}

.template-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.template-item .template-label {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: #555;
    background-color: white;
}

.template-item.selected .template-label {
    background-color: #0073aa;
    color: white;
    font-weight: 500;
}

.popup-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #0073aa;
    color: white;
}

.btn-primary:hover {
    background-color: #005a87;
}

.btn-secondary {
    background-color: #ddd;
    color: #333;
}

.btn-secondary:hover {
    background-color: #ccc;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    display: flex;
    opacity: 1;
}

.loading-content {
    background-color: white;
    padding: 30px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 250px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}
