/* Templates UI Styles */

/* Template buttons in editor */
.template-actions {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.btn-template {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-base);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-template--small {
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
}

.btn-template-save {
    color: var(--white);
    background: var(--primary);
    border: 1px solid var(--primary);
}

.btn-template-save:hover {
    background: var(--primary-hover);
}

.btn-template-load {
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
}

.btn-template-load:hover {
    background: var(--gray-50);
}

/* Template modal overlay */
.template-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.template-modal.is-open {
    display: flex;
}

.template-modal__content {
    background: var(--white);
    border-radius: var(--radius-base);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.template-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.template-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.template-modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-base);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.template-modal__close:hover {
    background: var(--gray-100);
    color: var(--text);
}

.template-modal__body {
    padding: var(--space-6);
}

/* Template list */
.template-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.template-list__empty {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--text-secondary);
}

.template-card {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    transition: all var(--transition);
}

.template-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.template-card__preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.template-card__colors {
    display: flex;
    width: 100%;
    height: 100%;
}

.template-card__color {
    flex: 1;
}

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

.template-card__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-1);
}

.template-card__meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.template-card__actions {
    display: flex;
    gap: var(--space-2);
}

.template-card__btn {
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.template-card__btn--primary {
    color: var(--white);
    background: var(--primary);
    border: 1px solid var(--primary);
}

.template-card__btn--primary:hover {
    background: var(--primary-hover);
}

.template-card__btn--secondary {
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
}

.template-card__btn--secondary:hover {
    background: var(--gray-50);
}

.template-card__btn--danger {
    color: var(--error);
    background: var(--white);
    border: 1px solid var(--border);
}

.template-card__btn--danger:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--error);
}

/* Save template form */
.template-form__field {
    margin-bottom: var(--space-4);
}

.template-form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.template-form__input {
    width: 100%;
    padding: var(--space-3);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    transition: all var(--transition);
}

.template-form__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.template-form__actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-6);
}

.template-form__btn {
    padding: var(--space-3) var(--space-5);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-base);
    cursor: pointer;
    transition: all var(--transition);
}

.template-form__btn--primary {
    color: var(--white);
    background: var(--primary);
    border: 1px solid var(--primary);
}

.template-form__btn--primary:hover {
    background: var(--primary-hover);
}

.template-form__btn--secondary {
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
}

.template-form__btn--secondary:hover {
    background: var(--gray-50);
}
