/* ==== Premium UI for Template Studio / Builder ==== */
.tp-login-template,
#tpsa-login-template {
    width: 100%;
}

/* Tabs */
.template-studio .tabs {
    display: flex;
    gap: 8px;
}

.template-studio .tabs .button {
    border-radius: 10px;
    padding: 8px 14px;
}

.template-studio .tabs .button-primary {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}

.template-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.single-template {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    position: relative;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.single-template:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.template-screenshot {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.template-content {
    padding: 12px;
}

.single-template h3 {
    margin: 0 0 10px 0 !important;
    font-size: 14px;
    font-weight: 600;
}

.use-template {
    width: 100%;
    justify-content: center;
    background: linear-gradient(145deg, #c8f4c3, #a8e1a3);
    border: 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* ModalImage header alignment (yours) */
.__react_modal_image__header {
    width: 50% !important;
    position: absolute !important;
    bottom: 0 !important;
    top: auto !important;
    left: 50% !important;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

/* ==== Custom Builder ==== */
.custom-template-builder {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

/* Control panel (left) */
.custom-template-builder .builder-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.custom-template-builder .builder-panel h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
}

.color-fields-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.custom-template-builder .field .color-field {
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}

.custom-template-builder .field,
.custom-template-builder fieldset {
    margin: 12px 0 14px;
}

.custom-template-builder fieldset {
    border: 1px solid #eef0f3;
    border-radius: 12px;
    padding: 12px;
    background: #fbfbfd;
}

.custom-template-builder fieldset legend {
    font-weight: 700;
    font-size: 12px;
    padding: 0 6px;
    color: #374151;
}

/* Inputs */
.custom-template-builder input[type='text'],
.custom-template-builder input[type='number'],
.custom-template-builder input[type='url'],
.custom-template-builder select,
.custom-template-builder textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-template-builder input[type='text']:focus,
.custom-template-builder input[type='number']:focus,
.custom-template-builder input[type='url']:focus,
.custom-template-builder select:focus,
.custom-template-builder textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-template-builder input[type='color'] {
    width: 48px;
    height: 36px;
    padding: 2px;
    border-radius: 8px;
    border: none;
}

/* Inline radio/checkbox */
.custom-template-builder .inline-controls {
    display: flex;
    gap: 14px;
    margin: 6px 0;
}

.custom-template-builder .inline-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Small helper text */
.custom-template-builder .hint {
    font-size: 12px;
    color: #6b7280;
}

/* Action row */
.custom-template-builder .actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.custom-template-builder .actions .button {
    border-radius: 10px;
}

.custom-template-builder .actions .button-secondary {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

/* Preview panel (right) */
.custom-template-builder .preview-wrap {
    display: grid;
    gap: 14px;
}

.custom-template-builder .card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Mock preview block */
#cdp-preview {
    min-height: 520px;
    border: 1px dashed #e5e7eb;
    border-radius: 12px;
}

/* Iframe preview */
.custom-template-builder .preview-iframe {
    width: 100%;
    height: 620px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.tpsa-button-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #814bfe;
    color: #fff;
    cursor: pointer;
    border: 1px solid #814bfe;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.active {
    background-color: #fff;
    color: #814bfe;
    border: 1px solid #ccc;
}

.section-title {
    margin-top: 20px;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 1200px) {
    .custom-template-builder {
        grid-template-columns: 1fr;
    }

    .template-list {
        grid-template-columns: 1fr;
    }
}