/*
 * Admin Styles for Entries Display for WPForms
 * Version: 0.4
 */

:root {
    --wpfed-bg-color: #f5f5f7;
    --wpfed-card-bg: #ffffff;
    --wpfed-text-color: #1d1d1f;
    --wpfed-text-secondary: #6e6e73;
    --wpfed-border-color: #d2d2d7;
    --wpfed-accent-color: #007aff;
    --wpfed-accent-color-hover: #0071e3;
    --wpfed-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --wpfed-border-radius: 12px;
    --wpfed-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --wpfed-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
}

body.settings_page_entries-display-for-wpforms {
    background-color: var(--wpfed-bg-color);
}

.wpfed-admin-wrap {
    margin: 0;
    font-family: var(--wpfed-font-family);
}

/* Header */
.wpfed-admin-header {
    background: var(--wpfed-card-bg);
    padding: 20px 40px;
    border-bottom: 1px solid var(--wpfed-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -20px -20px 25px -20px;
}

.wpfed-admin-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--wpfed-text-color);
    margin: 0;
}

/* Main Layout */
.wpfed-admin-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 0 20px;
}

.wpfed-admin-main {
    flex: 1;
    min-width: 550px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

/* Settings Card */
.wpfed-settings-card {
    background: var(--wpfed-card-bg);
    border-radius: var(--wpfed-border-radius);
    box-shadow: var(--wpfed-shadow);
    margin-bottom: 30px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.wpfed-settings-card:hover {
    box-shadow: var(--wpfed-shadow-hover);
}

.wpfed-settings-card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--wpfed-border-color);
}

.wpfed-settings-card-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.wpfed-settings-card-header p {
    font-size: 14px;
    color: var(--wpfed-text-secondary);
    margin: 5px 0 0;
}

.wpfed-settings-card-content {
    padding: 25px;
}

/* Form Table Overhaul */
.form-table {
    border-collapse: collapse;
    width: 100%;
}
.form-table tr {
    border-bottom: 1px solid var(--wpfed-border-color);
}
.form-table tr:last-child {
    border-bottom: none;
}
.form-table th,
.form-table td {
    padding: 20px 0;
    vertical-align: top;
    text-align: left;
}
.form-table th {
    width: 220px;
    font-weight: 500;
    color: var(--wpfed-text-color);
    padding-right: 20px;
}
.form-table p.description {
    font-size: 13px;
    color: var(--wpfed-text-secondary);
    margin-top: 8px;
}

/* Input & Select Styling */
.wpfed-admin-wrap input[type="text"],
.wpfed-admin-wrap input[type="number"],
.wpfed-admin-wrap select {
    width: 100%;
    max-width: 350px;
    background-color: #f0f0f0;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--wpfed-text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wpfed-admin-wrap .wp-picker-container input[type=text].wp-color-picker {
    width: 100px;
    padding-left: 35px;
}
.wpfed-admin-wrap .wp-picker-container .wp-color-result.button {
    min-height: 35px;
    border-radius: 8px;
    border: 1px solid var(--wpfed-border-color);
    background: var(--wpfed-card-bg);
}
.wpfed-admin-wrap .wp-picker-container .wp-color-result.button .wp-color-result-text {
    display: none;
}

.wpfed-admin-wrap input[type="text"]:focus,
.wpfed-admin-wrap input[type="number"]:focus,
.wpfed-admin-wrap select:focus {
    border-color: var(--wpfed-accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
    outline: none;
    background-color: var(--wpfed-card-bg);
}

/* Toggle Switch for Checkboxes */
.wpfed-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.wpfed-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.wpfed-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.wpfed-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .wpfed-toggle-slider {
    background-color: var(--wpfed-accent-color);
}
input:checked + .wpfed-toggle-slider:before {
    transform: translateX(22px);
}

/* Fields Container */
#wpfed_display_fields_container {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--wpfed-border-color);
    padding: 15px;
    background: var(--wpfed-bg-color);
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
}
#wpfed_display_fields_container label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}
#wpfed_display_fields_container label:last-child {
    margin-bottom: 0;
}

/* Sidebar */
.wpfed-admin-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: relative;
}

/* Live Preview Widget - Floating Sticky from current position */
.wpfed-preview-widget {
    position: sticky !important;
    top: 100px;
    z-index: 10;
    background: var(--wpfed-card-bg);
    padding: 25px;
    margin-bottom: 30px;
    border-radius: var(--wpfed-border-radius);
    box-shadow: var(--wpfed-shadow-hover) !important;
    transition: box-shadow 0.3s ease;
    border: 1px solid #6e6e73;
}

.wpfed-preview-widget:hover {
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.2) !important;
}

/* Other sidebar widgets */
.wpfed-sidebar-widget:not(.wpfed-preview-widget) {
    background: var(--wpfed-card-bg);
    padding: 25px;
    margin-bottom: 30px;
    border-radius: var(--wpfed-border-radius);
    box-shadow: var(--wpfed-shadow);
    transition: box-shadow 0.3s ease;
}
.wpfed-sidebar-widget {
    background: var(--wpfed-card-bg);
    padding: 25px;
    margin-bottom: 30px;
    border-radius: var(--wpfed-border-radius);
    box-shadow: var(--wpfed-shadow);
    transition: box-shadow 0.3s ease;
}
.wpfed-sidebar-widget:hover {
     box-shadow: var(--wpfed-shadow-hover);
}
.wpfed-sidebar-widget h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}
.wpfed-colors-grid, .wpfed-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    align-items: start;
}
.wpfed-color-option, .wpfed-dimension-option, .wpfed-effect-option {
    display: flex;
    flex-direction: column;
}
.wpfed-color-option label, .wpfed-dimension-option label, .wpfed-effect-option label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}
.wpfed-shortcode-option label {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
}

/* Shortcode Result */
.wpfed-shortcode-result {
    background: var(--wpfed-bg-color);
    border-radius: 8px;
    padding: 15px;
    position: relative;
}
.wpfed-shortcode-result code {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--wpfed-text-secondary);
}
#wpfed_copy_shortcode {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--wpfed-accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}
#wpfed_copy_shortcode:hover {
    background: var(--wpfed-accent-color-hover);
}
#wpfed_copy_shortcode .dashicons {
    font-size: 16px;
    line-height: 1.5;
}

/* Live Preview */
.wpfed-live-preview {
    padding: var(--preview-padding, 20px);
    border-radius: var(--preview-border-radius, 8px);
    background-color: var(--preview-bg-color, #f9f9f9);
    border: 1px solid var(--preview-border-color, #e0e0e0);
    color: var(--preview-text-color, #333333);
    box-shadow: var(--preview-box-shadow, 0 2px 5px rgba(0,0,0,0.1));
    transition: all 0.3s ease;
    font-size: 14px;
}
.wpfed-preview-entry-header {
    margin-bottom: 15px;
    color: var(--preview-header-color, #444444);
    font-weight: 600;
    font-size: 13px;
    opacity: 0.8;
}
.wpfed-preview-field {
    margin-bottom: 10px;
}
.wpfed-preview-label {
    font-weight: 600;
    color: var(--preview-header-color, #444444);
}

/* Submit Button */
.wpfed-admin-main .submit {
    padding: 20px 25px;
    background: var(--wpfed-card-bg);
    border-top: 1px solid var(--wpfed-border-color);
    margin-top: -30px; /* Pull it up to the card */
    border-radius: 0 0 var(--wpfed-border-radius) var(--wpfed-border-radius);
}
.wpfed-admin-main .button-primary {
    background: var(--wpfed-accent-color);
    border-color: var(--wpfed-accent-color);
    padding: 8px 20px;
    height: auto;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s, border-color 0.2s;
}
.wpfed-admin-main .button-primary:hover {
    background: var(--wpfed-accent-color-hover);
    border-color: var(--wpfed-accent-color-hover);
}

/* Typography Controls */
.wpfed-typography-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    align-items: start;
}

.wpfed-typography-control {
    display: flex;
    flex-direction: column;
}

.wpfed-typography-control label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--wpfed-text-color);
}

.wpfed-typography-control select {
    width: 100%;
    max-width: none;
    background-color: #f0f0f0;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--wpfed-text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wpfed-typography-control select:focus {
    border-color: var(--wpfed-accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
    outline: none;
    background-color: var(--wpfed-card-bg);
}

/* Typography preview enhancement */
.wpfed-preview-date {
    font-size: var(--preview-date-font-size, 13px) !important;
    font-weight: var(--preview-date-font-weight, 600) !important;
    font-style: var(--preview-date-font-style, normal) !important;
}

.wpfed-preview-label,
.wpfed-preview-value {
    font-size: var(--preview-content-font-size, 14px) !important;
    font-weight: var(--preview-content-font-weight, normal) !important;
    font-style: var(--preview-content-font-style, normal) !important;
}

/* Color picker improvements */
.wpfed-color-picker {
    width: 100px !important;
    max-width: 100px !important;
}

/* Responsive */
@media screen and (max-width: 1200px) {
    .wpfed-admin-container {
        flex-direction: column;
    }
    .wpfed-admin-main, .wpfed-admin-sidebar {
        width: 100%;
        max-width: 100%;
        min-width: auto;
    }
}
@media screen and (max-width: 782px) {
    .form-table th, .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    .form-table th {
        padding-bottom: 5px;
    }
    .wpfed-admin-header {
        padding: 15px 20px;
        margin-left: -10px;
    }
    .wpfed-admin-header h1 {
        font-size: 22px;
    }
    .wpfed-admin-container {
        padding: 0 10px;
    }
}