/* --- Root Variables --- */
:root {
    --notification-bg-color: #ffffff;
    --notification-border-color: #e85653;
    --notification-border-width: 2px;
    --notification-border-radius: 10px;
    --notification-font-family: 'Poppins';
    --primary-color: #776EFF;
    --text-color: #333333;
    --light-gray: #f7f7fa;
    --border-color: #e9eafc;
    --card-shadow: 0 4px 16px rgba(119,110,255,0.08);
}

/* Layout */
.wisecampaign-sales-notification-admin {
    padding: 32px 0 0 0;
    /* background: #f7f7fa; */
    min-height: 100vh;
}
.wisecampaign-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 20px 10px;
    padding: 0 15px;
}
.wisecampaign-admin-header h1 {
    font-size: 1.7em;
    margin: 0;
    font-weight: 700;
    color: #222;
    padding-left: 8px;
}
.wisecampaign-admin-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 100px;
}
.wisecampaign-btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s, color 0.2s, border 0.2s;
}
.wisecampaign-btn.save {
    background: #776EFF;
    color: #fff;
}
.wisecampaign-btn.reset {
    background: #fff;
    color: #776EFF;
    border: 2px solid #776EFF;
}
.wisecampaign-btn.reset:hover {
    background: #776EFF;
    color: #fff;
}
.wisecampaign-admin-main {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    /* Add a max-width for large screens if you want */
    max-width: 1200px;
    margin: 0 auto;
}
.wisecampaign-admin-sidebar {
    flex: 2 1 0;
    min-width: 420px;
    max-width: 640px;
    width: 100%;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    padding: 32px 28px;
    margin-bottom: 0;
}
.wisecampaign-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}
.wisecampaign-tab {
    flex: 1;
    padding: 12px 0;
    background: #f7f7fa;
    border: none;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.wisecampaign-tab.active {
    background: #fff;
    color: #776EFF;
    border-bottom: 2px solid #776EFF;
}
.wisecampaign-tab-content {
    display: none;
}
.wisecampaign-tab-content[style*="display: block"], .wisecampaign-tab-content:not([style*="display: none"]) {
    display: block;
}
.wisecampaign-template-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 12px;
}
.template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px;
    background: #fdfdff;
    border: 2px solid #e9eafc;
    border-radius: 14px;
    cursor: pointer;
    transition: border 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(119,110,255,0.04);
}
.template-card.selected,
.template-card:hover {
    border-color: #776EFF;
    box-shadow: 0 4px 16px rgba(119,110,255,0.12);
}
.template-card input[type="radio"] {
    display: none;
}
.template-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #eee;
    margin-bottom: 4px;
}
.template-card span {
    font-weight: 600;
    color: #555;
    font-size: 1.05em;
    text-align: center;
}
.wisecampaign-admin-preview {
    flex: 1 1 0;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: sticky; /* UPDATED: This makes the preview section stick to the top on scroll */
    top: 100px; /* UPDATED: Sets the distance from the top when sticky */
}
.wisecampaign-live-preview-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
    color: #444;
}
.wisecampaign-live-preview-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    padding: 32px 24px;
    min-width: 320px;
    max-width: 420px;
    margin: 0 auto;
}
#wisecampaign-notification-preview {
    display: inline-flex;
    align-items: stretch;
    width: 380px;
    min-height: 100px;
    margin: 0;
    padding: 16px 20px;
    position: relative;
    font-family: var(--notification-font-family), sans-serif;
    background-color: var(--notification-bg-color);
    border-style: solid;
    border-color: var(--notification-border-color);
    border-width: var(--notification-border-width);
    border-radius: var(--notification-border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(0.97);
    transition: all 0.2s ease-in-out;
}
#wisecampaign-notification-preview img {
    width: 100px;
    height: 100px;
    margin-right: 20px;
    object-fit: cover;
    align-self: center;
}
#wisecampaign-notification-preview .notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
}

/* Settings Tab Styling */
.wisecampaign-settings-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wisecampaign-settings-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.wisecampaign-settings-card-header {
    background: var(--light-gray);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.wisecampaign-settings-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.wisecampaign-settings-card-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    transition: transform 0.2s ease;
}

.wisecampaign-settings-card.collapsed .wisecampaign-settings-card-toggle {
    transform: rotate(180deg);
}

.wisecampaign-settings-card-body {
    padding: 20px;
}

.wisecampaign-settings-card.collapsed .wisecampaign-settings-card-body {
    display: none;
}

/* Form Field Styling */
.wisecampaign-form-field {
    margin-bottom: 20px;
}

.wisecampaign-form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 14px;
}

.wisecampaign-form-field input[type="text"],
.wisecampaign-form-field input[type="number"],
.wisecampaign-form-field select,
.wisecampaign-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.2s;
}

.wisecampaign-form-field input[type="text"]:focus,
.wisecampaign-form-field input[type="number"]:focus,
.wisecampaign-form-field select:focus,
.wisecampaign-form-field textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(119, 110, 255, 0.1);
}

.wisecampaign-form-field .description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Color picker fields */
.wisecampaign-color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wisecampaign-color-field input[type="text"] {
    flex: 1;
}

.wisecampaign-color-field .wp-color-result {
    margin: 0;
}

/* Section dividers */
.wisecampaign-section-divider {
    margin: 25px 0;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.wisecampaign-section-divider span {
    position: absolute;
    top: -10px;
    left: 20px;
    background: #fff;
    padding: 0 10px;
    font-size: 14px;
    color: #888;
}

/* Slider styling */
.slider-wrapper {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-input {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e9eafc;
    border-radius: 3px;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
}

.unit {
    color: #666;
    font-size: 13px;
}

#wisecampaign-notification-preview .buyer-info {
    font-size: 14px;
    color: #555;
}
#wisecampaign-notification-preview .buyer-name {
    font-weight: 600;
}
#wisecampaign-notification-preview .product-name {
    margin: 4px 0 !important;
    font-size: 22px;
    font-weight: 700;
    color: #1e1e1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
#wisecampaign-notification-preview .location-info {
    font-size: 13px;
    color: #555;
}
#wisecampaign-notification-preview .notification-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
#wisecampaign-notification-preview .timestamp,
#wisecampaign-notification-preview .brand-credit {
    font-size: 11px;
    color: #888;
}
/* Feedback */
.wisecampaign-feedback-message {
    font-weight: 600;
    color: #34a853;
    opacity: 0;
    visibility: hidden;
    vertical-align: middle;
    transform: translateY(20px);
    transition: opacity 0.4s, transform 0.4s, visibility 0.4s;
}
.wisecampaign-feedback-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.wisecampaign-feedback-message.error {
    color: #d63638;
}

/* Settings Section Improvements */
.wisecampaign-admin-sidebar h4 {
    font-size: 1.08em;
    font-weight: 600;
    margin: 28px 0 12px 0;
    color: #776EFF;
    letter-spacing: 0.01em;
}

.wisecampaign-admin-sidebar label {
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    color: #222;
}

.wisecampaign-admin-sidebar .form-table,
.wisecampaign-admin-sidebar table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 16px;
}

.wisecampaign-admin-sidebar .form-table td,
.wisecampaign-admin-sidebar table td {
    padding: 0;
    vertical-align: middle;
}

.wisecampaign-admin-sidebar input[type="text"],
.wisecampaign-admin-sidebar input[type="number"],
.wisecampaign-admin-sidebar select,
.wisecampaign-admin-sidebar textarea {
    width: 100%;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fafaff;
    margin-bottom: 10px;
    font-size: 1em;
    box-sizing: border-box;
}

.wisecampaign-admin-sidebar input[type="checkbox"] {
    margin-right: 6px;
}

.wisecampaign-admin-sidebar .description {
    font-size: 0.97em;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.wisecampaign-admin-sidebar .section-divider {
    border: none;
    border-top: 1px solid #f0f0f0;
    margin: 22px 0 18px 0;
}

/* Make select and textarea taller for better UX */
.wisecampaign-admin-sidebar select[multiple],
.wisecampaign-admin-sidebar textarea {
    min-height: 80px;
    font-size: 1em;
}

/* Space between fields */
.wisecampaign-admin-sidebar .form-table tr,
.wisecampaign-admin-sidebar table tr {
    margin-bottom: 18px;
    display: block;
}

/* --- Toggle beside title --- */
.wisecampaign-admin-header-title-group {
    display: flex;
    align-items: center;
    gap: 18px;
}
.wisecampaign-toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-left: 10px;
    position: relative;
}

/* Toggle visibility transition effects */
.wisecampaign-admin-sidebar,
.wisecampaign-admin-preview {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wisecampaign-admin-sidebar.hidden,
.wisecampaign-admin-preview.hidden {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.wisecampaign-toggle-label input[type="checkbox"] {
    display: none;
}
.wisecampaign-toggle-slider {
    width: 42px;
    height: 22px;
    background: #e0e0e0;
    border-radius: 22px;
    position: relative;
    transition: background 0.2s;
    display: inline-block;
}
.wisecampaign-toggle-slider:before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.wisecampaign-toggle-label input[type="checkbox"]:checked + .wisecampaign-toggle-slider {
    background: #776EFF;
}
.wisecampaign-toggle-label input[type="checkbox"]:checked + .wisecampaign-toggle-slider:before {
    transform: translateX(20px);
}

/* --- Settings Card Styling --- */
.wisecampaign-settings-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.wisecampaign-settings-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    margin-top: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.wisecampaign-settings-card:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.wisecampaign-settings-card-header {
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 600;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}
.wisecampaign-settings-card-header:hover {
    background: #f0f2f5;
}
.wisecampaign-settings-card-body {
    padding: 20px;
    background: #fff;
}
.wisecampaign-settings-card.collapsed .wisecampaign-settings-card-body {
    display: none;
}
.wisecampaign-card-toggle {
    background: none;
    border: none;
    color: #777;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wisecampaign-settings-card.collapsed .wisecampaign-card-toggle {
    transform: rotate(180deg);
}

/* Field Spacing & Alignment */
.wisecampaign-field-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.wisecampaign-field-label {
    flex: 1;
    padding-right: 15px;
    font-weight: 600;
    color: #333;
}

.wisecampaign-field-control {
    flex: 2;
}

.wisecampaign-admin-sidebar .form-table,
.wisecampaign-admin-sidebar table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    margin: 0;
}

.wisecampaign-admin-sidebar .form-table th,
.wisecampaign-admin-sidebar table th {
    padding: 10px 10px 10px 0;
    width: 200px;
    text-align: left;
    vertical-align: top;
    font-weight: 600;
    color: #333;
}

.wisecampaign-admin-sidebar .form-table td,
.wisecampaign-admin-sidebar table td {
    padding: 10px 0;
    vertical-align: middle;
}

.wisecampaign-admin-sidebar input[type="text"],
.wisecampaign-admin-sidebar input[type="number"],
.wisecampaign-admin-sidebar select,
.wisecampaign-admin-sidebar textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    margin-bottom: 5px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}

.wisecampaign-admin-sidebar input[type="text"]:focus,
.wisecampaign-admin-sidebar input[type="number"]:focus,
.wisecampaign-admin-sidebar select:focus,
.wisecampaign-admin-sidebar textarea:focus {
    border-color: #776EFF;
    box-shadow: 0 0 0 1px #776EFF;
    outline: none;
}

.wisecampaign-admin-sidebar label {
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    color: #333;
    font-size: 14px;
}

.wisecampaign-admin-sidebar .description {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
    margin-bottom: 0;
    display: block;
    line-height: 1.5;
}

.wisecampaign-admin-sidebar .section-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* Sliders and Color Pickers */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.slider-input {
    flex-grow: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    outline: none;
    border-radius: 3px;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #776EFF;
    cursor: pointer;
    border: none;
}

.slider-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #776EFF;
    cursor: pointer;
    border: none;
}

.slider-value {
    width: 50px;
    text-align: center;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.unit {
    font-size: 12px;
    color: #666;
}

.wp-color-picker-field {
    min-width: 120px;
    margin-right: 10px;
}

/* Tab Styling */
.wisecampaign-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 2px solid #e3e6f8;
}

.wisecampaign-tab {
    flex: 1;
    padding: 13px 0 11px 0;
    background: #f7f7fa;
    border: none;
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 1.08em;
    border-bottom: 2px solid transparent;
}

.wisecampaign-tab.active {
    background: #fff;
    color: #776EFF;
    border-bottom: 2.5px solid #776EFF;
    z-index: 2;
}

/* Responsive */
@media (max-width: 900px) {
    .wisecampaign-admin-main {
        flex-direction: column;
        gap: 24px;
    }
    .wisecampaign-admin-sidebar,
    .wisecampaign-admin-preview {
        min-width: 0;
        width: 100%;
    }
    .wisecampaign-live-preview-card {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    #wisecampaign-notification-preview {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
}