/* =========================================================
   ACF Layout Preview — Settings Page Styles
   ========================================================= */

/* ---- Reset & Base ---- */
.acflp-wrap * { box-sizing: border-box; }
.acflp-wrap { max-width: 100%; margin: 0; padding: 20px 20px 60px; }

/* ---- Header ---- */
.acflp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: #fff;
    border-radius: 14px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
    border: 1px solid #e8edf3;
    margin-top: 20px;
}
.acflp-header-inner { display: flex; align-items: center; gap: 16px; }
.acflp-logo {
    width: 48px; height: 48px;
    background: #eff6ff;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.acflp-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 2px !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}
.acflp-subtitle { margin: 0; font-size: 13px; color: #64748b; }
.acflp-version {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

/* ---- Tabs ---- */
.acflp-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    width: fit-content;
}
.acflp-tab {
    border: 0;
    background: transparent;
    color: #475569;
    padding: 8px 14px;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
}
.acflp-tab.is-active {
    background: #2563eb;
    color: #fff;
}
.acflp-tab-panel { display: none; }
.acflp-tab-panel.is-active { display: block; }

/* ---- Notices ---- */
.acflp-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 24px;
}
.acflp-notice--warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.acflp-notice .dashicons { font-size: 20px; flex-shrink: 0; }

/* ---- Toolbar ---- */
.acflp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.acflp-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.acflp-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
}
.acflp-search {
    width: 100%;
    padding: 9px 12px 9px 36px !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: none !important;
}
.acflp-search:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
    outline: none !important;
}

/* ---- Buttons ---- */
.acflp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    border: 1.5px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.acflp-btn .dashicons { font-size: 16px; width: 16px; height: 16px; }
.acflp-btn--primary {
    background: #2563eb;
    color: #fff !important;
    border-color: #2563eb;
}
.acflp-btn--primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff !important;
}
.acflp-btn--ghost {
    background: #fff;
    color: #475569 !important;
    border-color: #e2e8f0;
}
.acflp-btn--ghost:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b !important;
}
.acflp-btn--danger {
    background: #fff;
    color: #dc2626 !important;
    border-color: #fecaca;
}
.acflp-btn--danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}
.acflp-btn--sm { padding: 5px 10px; font-size: 12px; }

/* ---- Grid ---- */
.acflp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ---- Loading ---- */
.acflp-loading {
    grid-column: 1/-1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: #64748b;
}
.acflp-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: acflp-spin .7s linear infinite;
}
@keyframes acflp-spin { to { transform: rotate(360deg); } }

/* ---- Card ---- */
.acflp-card {
    background: #fff;
    border: 1.5px solid #e8edf3;
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s, border-color .2s;
    display: flex;
    flex-direction: column;
}
.acflp-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

/* Preview area */
.acflp-card-preview {
    aspect-ratio: 16/9;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.acflp-card-preview img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.acflp-card:hover .acflp-card-preview img { transform: scale(1.03); }
.acflp-card-preview-empty {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 12px;
}
.acflp-card-preview-empty .dashicons { font-size: 32px; color: #cbd5e1; }

/* Upload overlay */
.acflp-card-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity .2s;
}
.acflp-card-preview:hover .acflp-card-preview-overlay { opacity: 1; }
.acflp-card-preview-overlay span {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.acflp-card-preview-overlay span:hover { background: rgba(255,255,255,.25); }

/* Card body */
.acflp-card-body {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #f1f5f9;
}
.acflp-card-info { flex: 1; min-width: 0; }
.acflp-card-label {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.acflp-card-name {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'SFMono-Regular', Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.acflp-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Status badge */
.acflp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.acflp-badge--set { background: #dcfce7; color: #166534; }
.acflp-badge--missing { background: #f1f5f9; color: #94a3b8; }
.acflp-badge--default { background: #dbeafe; color: #1d4ed8; }

/* ---- Settings and documentation ---- */
.acflp-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.acflp-settings-box,
.acflp-docs {
    background: #fff;
    border: 1.5px solid #e8edf3;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.acflp-settings-box h2,
.acflp-docs h2 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #0f172a;
}
.acflp-settings-box p {
    margin: 0 0 16px;
    color: #64748b;
}
.acflp-settings-box label {
    display: block;
    margin-bottom: 14px;
    font-weight: 700;
    color: #374151;
}
.acflp-settings-box select {
    display: block;
    width: 100%;
    margin-top: 6px;
    max-width: none;
}
.acflp-settings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.acflp-default-preview-card {
    width: 100%;
    aspect-ratio: 16/9;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    color: #64748b;
}
.acflp-default-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.acflp-docs {
    max-width: 900px;
    color: #475569;
    line-height: 1.6;
}
.acflp-docs ol,
.acflp-docs ul {
    margin-left: 22px;
}
.acflp-docs code {
    background: #f1f5f9;
    padding: 2px 5px;
    border-radius: 4px;
}
@media (max-width: 800px) {
    .acflp-settings-grid { grid-template-columns: 1fr; }
    .acflp-tabs { width: 100%; overflow-x: auto; }
}

/* ---- Empty state ---- */
.acflp-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}
.acflp-empty .dashicons { font-size: 48px; display: block; margin: 0 auto 12px; }
.acflp-empty p { margin: 0; font-size: 14px; }

/* ---- Hidden file input ---- */
.acflp-file-input { display: none; }

/* ---- Modal ---- */
.acflp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.acflp-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(3px);
    cursor: pointer;
}
.acflp-modal-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: calc(100% - 40px);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    z-index: 1;
}
.acflp-modal-box h2 { margin: 0 0 8px; font-size: 18px; color: #0f172a; }
.acflp-modal-box p { margin: 0 0 20px; color: #64748b; font-size: 13px; }
.acflp-modal-box label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.acflp-modal-box .regular-text {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color .15s;
}
.acflp-modal-box .regular-text:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    outline: none;
}
.acflp-modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.acflp-modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: #f1f5f9;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.acflp-modal-close:hover { background: #e2e8f0; }

/* ---- Toast ---- */
#acflp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.acflp-toast-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    animation: acflp-toast-in .25s ease;
    pointer-events: auto;
}
.acflp-toast-item--success { background: #059669; }
.acflp-toast-item--error   { background: #dc2626; }
.acflp-toast-item--info    { background: #2563eb; }
@keyframes acflp-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Drag-over state on card ---- */
.acflp-card.acflp-dragover {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
