/*
 * dialog-managetemplates.css
 *
 * Styles for Manage Templates dialog (full screen)
 */

.managetemplates-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.managetemplates-modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.managetemplates-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.managetemplates-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.managetemplates-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.managetemplates-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.managetemplates-modal-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.managetemplates-form {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.managetemplates-form-group {
    margin-bottom: 20px;
}

.managetemplates-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.managetemplates-form-group > input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #f9f9f9;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.managetemplates-form-group > input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Custom select dropdown */
.managetemplates-select-wrapper {
    position: relative;
    width: 100%;
}

.managetemplates-select-wrapper select {
    display: none;
}

.managetemplates-select-display {
    width: 100%;
    padding: 12px 44px 12px 14px;
    font-size: 1rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #f9f9f9;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.managetemplates-select-wrapper.open .managetemplates-select-display {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    border-radius: 6px 6px 0 0;
}

.managetemplates-select-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    pointer-events: none;
    transition: transform 0.25s ease;
    line-height: 1;
}

.managetemplates-select-wrapper.open .managetemplates-select-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.managetemplates-select-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d0d0d0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.managetemplates-select-wrapper.open .managetemplates-select-list {
    display: block;
}

.managetemplates-select-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s ease;
}

.managetemplates-select-item:hover {
    background: #f0f0ff;
}

.managetemplates-select-item.selected {
    background: #e8ecff;
    font-weight: 600;
}

.managetemplates-button-container {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.managetemplates-button {
    padding: 12px 36px;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.managetemplates-button-new {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
}

.managetemplates-button-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.4);
}

.managetemplates-button-new:active {
    transform: translateY(0);
}

.managetemplates-button-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.managetemplates-button-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.managetemplates-button-save:active {
    transform: translateY(0);
}

.managetemplates-button-save:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.managetemplates-button-rename {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.managetemplates-button-rename:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.managetemplates-button-rename:active {
    transform: translateY(0);
}

.managetemplates-button-rename:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.managetemplates-button-delete {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: white;
}

.managetemplates-button-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.managetemplates-button-delete:active {
    transform: translateY(0);
}

.managetemplates-button-delete:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.managetemplates-button-show {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.managetemplates-button-show:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.managetemplates-button-show:active {
    transform: translateY(0);
}

.managetemplates-button-show:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.managetemplates-button-cancel {
    background: #f0f0f0;
    color: #333;
}

.managetemplates-button-cancel:hover {
    background: #e0e0e0;
}

.managetemplates-status {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
}

.managetemplates-status.hidden {
    display: none;
}

.managetemplates-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.managetemplates-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.managetemplates-status.loading {
    background: #e2e3ff;
    color: #3d3d9e;
    border: 1px solid #c5c6ff;
}

/* Spinner for loading state */
.managetemplates-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #3d3d9e;
    border-radius: 50%;
    border-top-color: transparent;
    animation: managetemplates-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes managetemplates-spin {
    to {
        transform: rotate(360deg);
    }
}

/* *******************************************************
 * New Template Sub-Dialog
 * ******************************************************* */

.managetemplates-new-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.managetemplates-new-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
}

.managetemplates-new-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    border-radius: 12px 12px 0 0;
}

.managetemplates-new-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.managetemplates-new-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.managetemplates-new-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.managetemplates-new-body {
    padding: 24px;
}

.managetemplates-new-status {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
}

.managetemplates-new-status.hidden {
    display: none;
}

.managetemplates-new-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.managetemplates-new-button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* *******************************************************
 * Rename Template Sub-Dialog
 * ******************************************************* */

.managetemplates-rename-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.managetemplates-rename-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
}

.managetemplates-rename-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.managetemplates-rename-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.managetemplates-rename-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.managetemplates-rename-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.managetemplates-rename-body {
    padding: 24px;
}

.managetemplates-rename-current {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #555;
}

.managetemplates-rename-status {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
}

.managetemplates-rename-status.hidden {
    display: none;
}

.managetemplates-rename-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.managetemplates-rename-button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* *******************************************************
 * Show/Preview Sub-Dialog
 * ******************************************************* */

.managetemplates-show-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.managetemplates-show-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.managetemplates-show-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 12px 12px 0 0;
}

.managetemplates-show-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.managetemplates-show-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.managetemplates-show-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.managetemplates-show-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.managetemplates-show-content {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    min-height: 200px;
    background: #fafafa;
    resize: both;
    overflow: auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13.33px;
    line-height: 1.5;
    color: #333;
}

/* Match widget-htmleditor content styling for consistent preview */
.managetemplates-show-content h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

.managetemplates-show-content h2 {
    font-size: 1.5em;
    margin: 0.75em 0;
}

.managetemplates-show-content h3 {
    font-size: 1.17em;
    margin: 0.83em 0;
}

.managetemplates-show-content p {
    margin: 1em 0;
}

.managetemplates-show-content ul,
.managetemplates-show-content ol {
    margin: 0.4em 0;
    padding-left: 2em;
}

.managetemplates-show-content blockquote {
    margin: 1em 0;
    padding: 10px 20px;
    border-left: 4px solid #667eea;
}

.managetemplates-show-button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.managetemplates-button-done {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.managetemplates-button-done:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.managetemplates-button-done:active {
    transform: translateY(0);
}

/* *******************************************************
 * Delete Confirmation Sub-Dialog
 * ******************************************************* */

.managetemplates-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.managetemplates-confirm-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
}

.managetemplates-confirm-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    border-radius: 12px 12px 0 0;
}

.managetemplates-confirm-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.managetemplates-confirm-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.managetemplates-confirm-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.managetemplates-confirm-body {
    padding: 24px;
}

.managetemplates-confirm-message {
    font-size: 1rem;
    color: #333;
    text-align: center;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.managetemplates-confirm-button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .managetemplates-modal-dialog {
        border-radius: 0;
    }

    .managetemplates-modal-header {
        border-radius: 0;
        padding: 16px 20px;
    }

    .managetemplates-modal-header h2 {
        font-size: 1.3rem;
    }

    .managetemplates-modal-body {
        padding: 20px;
    }

    .managetemplates-button-container {
        flex-direction: column;
    }

    .managetemplates-button {
        width: 100%;
    }

    .managetemplates-new-dialog {
        width: 95%;
    }

    .managetemplates-show-dialog {
        width: 95%;
        max-height: 90vh;
    }

    .managetemplates-new-button-container {
        flex-direction: column;
    }

    .managetemplates-new-button-container .managetemplates-button {
        width: 100%;
    }

    .managetemplates-rename-dialog {
        width: 95%;
    }

    .managetemplates-rename-button-container {
        flex-direction: column;
    }

    .managetemplates-rename-button-container .managetemplates-button {
        width: 100%;
    }

    .managetemplates-confirm-dialog {
        width: 95%;
    }

    .managetemplates-confirm-button-container {
        flex-direction: column;
    }

    .managetemplates-confirm-button-container .managetemplates-button {
        width: 100%;
    }
}
