/**
 * Options Page Builder - Admin Styles
 * Matching Switchboard design system
 *
 * @package Switchboard
 * @since 1.0.0
 */

/* ===================================
   Dashboard View - Stats & Grid
   =================================== */

/* Empty State */
.opb-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 12px;
    margin-top: 24px;
}

.opb-empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-50);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.opb-empty-state-icon svg {
    width: 40px;
    height: 40px;
    color: var(--primary-500);
}

.opb-empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.opb-empty-state-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.opb-empty-state-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-500);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.opb-empty-state-btn:hover {
    background: var(--primary-600);
    color: white;
}

.opb-empty-state-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Use Cases Grid in Empty State */
.opb-use-cases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 32px 0;
    width: 100%;
    max-width: 900px;
}

.opb-use-case-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    transition: all 0.2s ease;
}

.opb-use-case-card:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-500-rgb), 0.1);
}

.opb-use-case-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.opb-use-case-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Options Pages Grid */
.opb-pages-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.opb-page-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 32px 20px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.opb-page-card:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.opb-page-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}

.opb-page-card-slug {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.opb-page-card-badges {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.opb-page-card-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.opb-page-card:hover .opb-page-card-badge {
    background: var(--primary-200);
    color: var(--primary-800);
}

.opb-page-card-status {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 9px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.opb-page-card-status-active {
    background: var(--primary-100);
    color: var(--primary-800);
}

.opb-page-card-status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.opb-page-card-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--primary-500);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.opb-page-card:hover .opb-page-card-overlay {
    opacity: 1;
}

.opb-page-card-overlay .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: white;
}

/* Add New Card */
.opb-page-card-add {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
}

.opb-page-card-add:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.opb-page-card-add-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.opb-page-card-add-desc {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

.opb-page-card-add-icon {
    margin-top: 4px;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.opb-page-card-add-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #cbd5e1;
    transition: color 0.2s ease;
}

.opb-page-card-add:hover .opb-page-card-add-icon {
    background: var(--primary-100);
}

.opb-page-card-add:hover .opb-page-card-add-icon .dashicons {
    color: var(--primary-500);
}

/* Responsive */
@media (max-width: 1400px) {
    .opb-pages-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .opb-pages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .opb-use-cases-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .opb-pages-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Edit View - New 2-Row Layout
   =================================== */

.sb-module-opb-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Row 1: Full-Width Page Settings */
.opb-page-settings-full {
    width: 100%;
}

.opb-page-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Page description spans full width (Row 2) */
.opb-page-description-group {
    grid-column: 1 / -1;
}

.opb-page-description-group textarea {
    min-height: 60px;
    resize: vertical;
}

/* Row 2: Two-Column Layout (Fields + Quick Add) */
.opb-editor-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

.opb-fields-column {
    min-width: 0; /* Prevents grid blowout */
}

.opb-quickadd-column {
    min-width: 280px;
}

.opb-quickadd-column .sb-module-card {
    position: sticky;
    top: 32px;
}

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

.sb-module-form-group:last-child {
    margin-bottom: 0;
}

.sb-module-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

.sb-module-required {
    color: #ef4444;
}

.sb-module-input,
.sb-module-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: white;
    transition: all 0.2s ease;
}

.sb-module-input:focus,
.sb-module-select:focus {
    outline: none;
    border-color: var(--primary-500);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(var(--primary-500-rgb), 0.1);
}

.sb-module-input:hover:not(:focus),
.sb-module-select:hover:not(:focus) {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.sb-module-input:disabled,
.sb-module-select:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.sb-module-help-text {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.5;
}

.sb-module-help-text code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
}

/* Middle Column - Fields Editor */
.sb-module-main-center {
    flex: 1;
    min-width: 0;
}

.opb-fields-list {
    min-height: 200px;
}

.opb-field-item {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.opb-field-item:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    box-shadow: 0 2px 8px rgba(var(--primary-500-rgb), 0.08);
}

.opb-field-item.ui-sortable-helper {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: rotate(2deg);
}

.opb-field-placeholder {
    background: var(--primary-50);
    border: 2px dashed var(--primary-300);
    border-radius: 8px;
    margin-bottom: 12px;
    min-height: 60px;
}

.opb-field-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.opb-field-item.collapsed:hover .opb-field-header {
    background: var(--primary-50);
}

.opb-field-item:not(.collapsed) .opb-field-header {
    background: var(--primary-50);
    border-bottom: 1px solid var(--primary-100);
    border-radius: 8px 8px 0 0;
}

.opb-field-item:not(.collapsed):hover .opb-field-header {
    background: var(--primary-100);
}

.opb-field-drag {
    cursor: grab;
    color: var(--primary-300);
    transition: color 0.2s ease;
}

.opb-field-drag:hover {
    color: var(--primary-500);
}

.opb-field-item:hover .opb-field-drag {
    color: var(--primary-500);
}

.opb-field-drag svg {
    width: 16px;
    height: 16px;
}

.opb-field-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-50);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.opb-field-icon svg {
    width: 18px;
    height: 18px;
    color: var(--primary-500);
}

.opb-field-info {
    flex: 1;
    min-width: 0;
}

.opb-field-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.opb-field-required-badge {
    color: #ef4444;
    font-weight: 700;
    font-size: 16px;
}

.opb-field-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #64748b;
}

.opb-field-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.opb-field-id {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
}

.opb-field-width-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary-100);
    color: var(--primary-700);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.opb-field-actions {
    display: flex;
    gap: 4px;
}

.opb-field-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.opb-field-action-btn:hover {
    background: var(--primary-100);
    color: var(--primary-500);
}

.opb-field-action-btn.delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.opb-field-action-btn svg {
    width: 16px;
    height: 16px;
}

.opb-field-collapse-icon {
    transition: transform 0.2s ease;
}

.opb-field-item.collapsed .opb-field-collapse-icon {
    transform: rotate(-90deg);
}

.opb-field-body {
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--primary-100);
    display: none;
}

.opb-field-item:not(.collapsed) .opb-field-body {
    display: block;
}

.opb-field-config {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 16px;
}

.opb-field-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.opb-field-config-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 1024px) {
    .opb-field-config-row {
        grid-template-columns: 1fr;
    }
    .opb-field-config-row-3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .opb-field-config-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Right Sidebar - Quick Add */
.sb-module-sidebar-right {
    min-width: 240px;
}

.sb-module-sidebar-right .sb-module-card {
    position: sticky;
    top: 32px;
}

.sb-module-quick-add-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sb-module-quick-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sb-module-quick-add-btn:hover {
    background: var(--primary-50);
    border-color: var(--primary-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(var(--primary-500-rgb), 0.1);
}

.sb-module-quick-add-btn svg {
    width: 24px;
    height: 24px;
    color: var(--primary-500);
    transition: transform 0.2s ease;
}

.sb-module-quick-add-btn:hover svg {
    transform: scale(1.1);
}

.sb-module-quick-add-btn span {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* Save Indicator */
.opb-save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.opb-save-indicator.saving {
    color: #f59e0b;
}

.opb-save-indicator.saved {
    color: var(--primary-500);
}

.opb-save-indicator.error {
    color: #ef4444;
}

.opb-save-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Card Footer Actions */
.sb-module-card-footer-actions {
    display: flex;
    gap: 8px;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .opb-pages-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .opb-use-cases-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .opb-pages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sb-module-layout-3col {
        grid-template-columns: 1fr;
    }

    .sb-module-sidebar-left .sb-module-card,
    .sb-module-sidebar-right .sb-module-card {
        position: static;
    }
}

@media (max-width: 640px) {
    .opb-pages-grid {
        grid-template-columns: 1fr;
    }

    .opb-use-cases-grid {
        grid-template-columns: 1fr;
    }

    .sb-module-quick-add-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Stack editor layout on tablets */
    .opb-editor-layout {
        grid-template-columns: 1fr;
    }

    .opb-quickadd-column {
        order: -1; /* Move Quick Add above fields on mobile */
    }

    .opb-quickadd-column .sb-module-card {
        position: static; /* Remove sticky on mobile */
    }

    /* Stack page settings grid on tablets */
    .opb-page-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Toast Notifications
   =================================== */

.opb-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.opb-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.opb-toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.opb-toast-icon svg {
    width: 16px;
    height: 16px;
}

.opb-toast-success .opb-toast-icon {
    background: var(--primary-100);
    color: var(--primary-600);
}

.opb-toast-error .opb-toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.opb-toast-message {
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
}

/* ===================================
   Icon Picker
   =================================== */

.opb-icon-picker-container {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
}

.opb-icon-picker-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.opb-icon-picker-toggle:hover {
    background: var(--primary-100);
    border-color: var(--primary-300);
}

.opb-icon-picker-toggle .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--primary-600);
}

.opb-icon-picker-container .sb-module-input {
    border-radius: 0;
    border-left: none;
    flex: 1;
}

.opb-icon-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 320px;
    background: white;
    border: 1px solid var(--primary-200);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.opb-icon-picker-dropdown.show {
    display: block;
}

.opb-icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 8px;
}

.opb-icon-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.opb-icon-picker-item:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
}

.opb-icon-picker-item .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #64748b;
}

.opb-icon-picker-item:hover .dashicons {
    color: var(--primary-600);
}

/* ===================================
   Sidebar Settings Card
   =================================== */

.opb-sidebar-settings {
    margin-bottom: 16px;
}

.opb-sidebar-settings .sb-module-form-group {
    margin-bottom: 16px;
}

.opb-sidebar-settings .sb-module-form-group:last-child {
    margin-bottom: 0;
}

/* ===================================
   Icon & Position Combined Field
   =================================== */

.opb-icon-position-row {
    display: flex;
    gap: 0;
}

.opb-icon-position-row .opb-icon-input {
    flex: 1;
}

.opb-icon-position-row .opb-position-input {
    width: 80px;
    flex-shrink: 0;
    text-align: center;
    border-radius: 0 8px 8px 0;
    border-left: none;
}

/* Adjust icon picker container for combined layout */
.opb-icon-position-row .opb-icon-picker-container {
    flex: 1;
}

.opb-icon-position-row .opb-icon-picker-container .sb-module-input {
    width: 100%;
}

/* Allow dropdown to overflow the card */
.opb-page-settings-full .sb-module-card {
    overflow: visible;
}

.opb-page-settings-full .sb-module-card-body {
    overflow: visible;
}

/* ===================================
   Options Page Frontend Form Styles
   =================================== */

.sb-module-opb-frontend-form .sb-module-card {
    max-width: 1400px;
}

.sb-module-opb-frontend-form .sb-module-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.sb-module-opb-frontend-form .sb-module-form-group {
    margin-bottom: 0;
}

/* Field Width Classes */
.sb-module-opb-frontend-form .opb-field-width-full {
    width: 100%;
}

.sb-module-opb-frontend-form .opb-field-width-2-3 {
    width: calc(66.666% - 10px);
}

.sb-module-opb-frontend-form .opb-field-width-1-2 {
    width: calc(50% - 10px);
}

.sb-module-opb-frontend-form .opb-field-width-1-3 {
    width: calc(33.333% - 14px);
}

@media (max-width: 768px) {
    .sb-module-opb-frontend-form .opb-field-width-2-3,
    .sb-module-opb-frontend-form .opb-field-width-1-2,
    .sb-module-opb-frontend-form .opb-field-width-1-3 {
        width: 100%;
    }
}

/* Color Picker */
.sb-module-color-picker {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sb-module-color-input {
    width: 48px;
    height: 48px;
    padding: 4px;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    cursor: pointer;
    background: white;
}

.sb-module-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.sb-module-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Radio Group */
.sb-module-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-module-radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sb-module-radio-item:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.sb-module-radio-item.checked,
.sb-module-radio-item:has(input:checked) {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.sb-module-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary-500);
}

.sb-module-radio-label {
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
}

/* Image Upload */
.sb-module-image-upload {
    padding: 0;
}

.sb-module-image-preview {
    margin-bottom: 12px;
}

.sb-module-image-preview img {
    display: block;
    border: 1px solid var(--primary-100);
}

/* Notice Styles */
.sb-module-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

.sb-module-notice-success {
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
}

.sb-module-notice-success .dashicons {
    color: var(--primary-500);
}

/* ===================================
   Quick Add Divider & Group Button
   =================================== */

.opb-quick-add-divider {
    height: 1px;
    background: var(--primary-100);
    margin: 16px 0;
}

.opb-quick-add-layout {
    grid-template-columns: 1fr !important;
}

/* Group button - horizontal layout with icon and title side by side */
.opb-quick-add-group {
    flex-direction: row !important;
    justify-content: center;
    gap: 10px !important;
    padding: 14px 20px !important;
    background: var(--primary-50) !important;
    border-color: var(--primary-200) !important;
    border-width: 2px !important;
    border-style: dashed !important;
}

.opb-quick-add-group:hover {
    background: var(--primary-100) !important;
    border-color: var(--primary-500) !important;
    border-style: solid !important;
}

.opb-quick-add-group svg {
    width: 20px !important;
    height: 20px !important;
}

.opb-quick-add-group span {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--primary-700) !important;
}

/* ===================================
   Group Field Styling (Distinct from regular fields)
   =================================== */

.opb-field-group {
    background: linear-gradient(135deg, var(--primary-50) 0%, white 100%);
    border: 2px dashed var(--primary-300);
    border-radius: 12px;
    position: relative;
    margin-top: 24px;
    margin-bottom: 16px;
}

.opb-field-group:first-child {
    margin-top: 0;
}

.opb-field-group::before {
    content: 'SECTION';
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--primary-500);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 4px;
}

.opb-field-group:hover {
    background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-50) 100%);
    border-color: var(--primary-500);
    border-style: solid;
}

.opb-field-group .opb-field-header {
    padding: 20px 16px 16px 16px;
}

.opb-field-group-header {
    background: transparent;
}

.opb-field-group-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-100);
    border: 2px solid var(--primary-200);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.opb-field-group:hover .opb-field-group-icon {
    background: var(--primary-200);
    border-color: var(--primary-400);
}

.opb-field-group-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary-600);
}

.opb-field-type-group {
    background: var(--primary-500) !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Group field title styling */
.opb-field-group .opb-field-title {
    font-size: 16px;
    color: var(--primary-700);
}

/* Group field body area */
.opb-field-group .opb-field-body {
    border-top: 1px dashed var(--primary-200);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 10px 10px;
}

/* Group Info Notice */
.opb-group-info-notice {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: 8px;
    margin-bottom: 20px;
}

.opb-group-info-notice .dashicons {
    color: var(--primary-500);
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.opb-group-info-notice strong {
    display: block;
    font-size: 13px;
    color: var(--primary-700);
    margin-bottom: 4px;
}

.opb-group-info-notice p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* ===================================
   Grouped Form Layout with Sidebar
   =================================== */

.opb-form-with-groups .sb-module-card {
    max-width: none;
}

.opb-grouped-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    max-width: 1400px;
}

/* Sidebar Navigation */
.opb-groups-sidebar {
    position: sticky;
    top: 32px;
    height: fit-content;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.opb-groups-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.opb-group-nav-item {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.opb-group-nav-item:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    transform: translateX(2px);
}

.opb-group-nav-item.active {
    background: var(--primary-50);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-500-rgb), 0.1);
}

.opb-group-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-500);
    border-radius: 0 4px 4px 0;
}

.opb-group-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.opb-group-nav-item:hover .opb-group-nav-title,
.opb-group-nav-item.active .opb-group-nav-title {
    color: var(--primary-700);
}

.opb-group-nav-desc {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

/* Bottom Action Bar for Grouped Forms */
.opb-form-actions-bar {
    margin-top: 24px;
    margin-left: calc(280px + 24px); /* Sidebar width + gap */
}

.opb-form-actions-bar .sb-module-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 1024px) {
    .opb-form-actions-bar {
        margin-left: 0;
    }
}

/* Content Sections */
.opb-groups-content {
    min-width: 0;
}

.opb-group-section {
    display: none;
}

.opb-group-section.active {
    display: block;
}

.opb-group-section .sb-module-card {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .opb-grouped-layout {
        grid-template-columns: 1fr;
    }

    .opb-groups-sidebar {
        position: static;
        max-height: none;
    }

    .opb-groups-nav {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
        padding-right: 0;
        padding-bottom: 4px;
    }

    .opb-group-nav-item {
        flex: 0 0 auto;
        min-width: 150px;
    }

    .opb-group-nav-item.active::before {
        display: none;
    }

    .opb-groups-sidebar-footer {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .opb-groups-nav {
        flex-direction: column;
    }

    .opb-group-nav-item {
        min-width: 100%;
    }
}

/* ===================================
   How to Use Modal (Frontend Options Pages)
   =================================== */

.opb-usage-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
}

.opb-usage-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.opb-usage-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.opb-usage-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.opb-usage-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

.opb-usage-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.opb-usage-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.opb-usage-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.opb-usage-section {
    margin-bottom: 24px;
}

.opb-usage-section:last-child {
    margin-bottom: 0;
}

.opb-usage-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 12px 0;
}

.opb-usage-section h3 .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: var(--primary-500);
}

.opb-usage-code-block {
    position: relative;
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
}

.opb-usage-code-block pre {
    margin: 0;
    padding: 16px;
    padding-right: 80px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.opb-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.opb-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.opb-copy-btn.copied {
    background: var(--primary-500);
    color: white;
}

/* Available Fields List */
.opb-usage-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.opb-usage-field-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.opb-usage-field-item code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 12px;
    background: var(--primary-50);
    color: var(--primary-700);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.opb-usage-field-label {
    flex: 1;
    font-size: 13px;
    color: #0f172a;
}

.opb-usage-field-type {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
}
