/**
 * WooCommerce Inspiration Boards - Final UX/UI Styles
 */

/* --- Layout & Reset --- */
.wib-wrapper {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.wib-wrapper *, .wib-wrapper *::before, .wib-wrapper *::after {
    box-sizing: inherit;
}

.wib-icon {
    width: 18px; height: 18px;
    display: inline-block;
    vertical-align: middle;
}

/* --- Header --- */
.wib-my-account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}
.wib-my-account-header h3 { margin: 0; font-weight: 700; color: #1e293b; font-size: 1.25rem; }

/* Primary Action Button (Create) */
#ib-toggle-create-main, .ib-create-btn, .button.alt {
    background-color: #2271b1; /* WordPress Blue */
    color: #fff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#ib-toggle-create-main:hover, .ib-create-btn:hover, .button.alt:hover {
    background-color: #135e96;
    border-color: #135e96;
    color: #fff;
}

.wib-intro-text { color: #64748b; font-size: 14px; margin-bottom: 25px; }

/* --- Forms --- */
.ib-create-main-wrapper {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* --- Grid System --- */
.ib-board-tree, .ib-sub-boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --- Card Styles --- */
.ib-board-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ib-board-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

/* Expanded State */
.ib-board-item.is-open {
    grid-column: 1 / -1;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: #2271b1;
    transform: none;
    z-index: 10;
}

/* --- Card Header --- */
.ib-card-header {
    padding: 20px;
    cursor: pointer;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Fix Duplicate Empty State: Hide header preview when open */
.ib-board-item.is-open .ib-card-preview-images,
.ib-board-item.is-open .ib-card-preview-empty {
    display: none;
}
.ib-board-item.is-open .ib-card-header {
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.ib-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ib-board-title-text {
    margin: 0; font-size: 1.1rem; font-weight: 600; color: #334155;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%;
}
.ib-count {
    font-size: 0.75rem; font-weight: 600; background: #f1f5f9; color: #64748b;
    padding: 4px 10px; border-radius: 99px;
}

/* Images Preview */
.ib-card-preview-images {
    display: flex; gap: 8px; height: 60px;
}
.ib-mini-thumb {
    width: 60px; height: 60px; border-radius: 6px;
    background-size: cover; background-position: center; background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.ib-card-preview-empty {
    height: 60px; display: flex; align-items: center; justify-content: center;
    background: #f8fafc; border-radius: 6px; border: 1px dashed #cbd5e1;
    color: #94a3b8; font-size: 13px;
}

/* --- Actions Bar & Buttons --- */
.ib-card-actions {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 10px; border-top: 1px solid #f1f5f9; position: relative;
}

.ib-left-actions, .ib-right-actions {
    display: flex; gap: 6px; align-items: center;
}

/* Base Icon Button */
.ib-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #64748b; /* Neutral Gray */
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}

/* Secondary Actions (Edit, Share) - Hover Blue */
.ib-edit-btn:hover, .ib-share-toggle-btn:hover {
    background: #eef6ff;
    color: #2271b1;
    border-color: #dcebf9;
}

/* Danger Actions (Delete) - Hover Red */
.ib-delete-btn:hover {
    background: #fef2f2;
    color: #d63638; /* WordPress Red */
    border-color: #fee2e2;
}

.ib-expand-indicator .ib-arrow {
    transition: transform 0.3s; width: 20px; height: 20px; color: #cbd5e1;
}
.ib-board-item.is-open .ib-expand-indicator .ib-arrow {
    transform: rotate(180deg); color: #2271b1;
}

/* --- Full Content --- */
.ib-board-content {
    display: none;
    padding: 25px;
    background: #fff;
    animation: slideDown 0.3s ease-out;
}
.ib-board-item.is-open > .ib-board-content { display: block; }

.ib-expanded-title {
    margin: 0 0 20px 0; font-size: 1.25rem; color: #1e293b;
    border-bottom: 2px solid #2271b1; display: inline-block; padding-bottom: 5px;
}

/* Drop Zone */
.ib-drop-zone {
    display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 30px; min-height: 120px;
    background: #fcfcfc; border: 2px dashed #e2e8f0; border-radius: 8px; padding: 15px;
    align-items: flex-start;
}
.ib-board-item.drag-over .ib-drop-zone {
    background: #eef6ff; border-color: #2271b1;
}

/* Product Cards */
.ib-product-card {
    width: 130px; position: relative;
    border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
    background: #fff; transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: grab;
}
.ib-product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.ib-product-card.dragging { opacity: 0.5; }

.ib-product-img { width: 100%; height: 110px; object-fit: cover; }
.ib-product-name {
    display: block; padding: 10px 8px; font-size: 12px; line-height: 1.4;
    text-align: center; color: #334155;
    background: #fff;
}

/* Remove Product Button (Danger) */
.ib-remove-product-btn {
    position: absolute; top: 5px; right: 5px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    color: #d63638; /* Red Icon */
    cursor: pointer; opacity: 0; transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ib-product-card:hover .ib-remove-product-btn { opacity: 1; }
.ib-remove-product-btn:hover { background: #d63638; color: #fff; border-color: #d63638; }

.ib-empty-state {
    width: 100%; text-align: center; margin: auto;
    color: #94a3b8; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.ib-empty-icon { font-size: 24px; opacity: 0.5; }

/* Sub Boards */
.ib-sub-boards-wrapper {
    background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid #f1f5f9;
}
.ib-sub-boards-wrapper h4 { margin: 0 0 15px 0; font-size: 0.85rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }

/* Inline Forms */
.ib-inline-form { display: flex; gap: 10px; }
.ib-inline-form input {
    flex: 1; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px;
}
.ib-inline-form input:focus { outline: none; border-color: #2271b1; box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2); }
.ib-rename-input { width: 100%; padding: 4px; font-size: 1.1rem; border: 1px solid #2271b1; border-radius: 4px; }

/* Share Popup */
.ib-share-popup {
    position: absolute; bottom: 100%; right: 0; margin-bottom: 10px;
    background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    padding: 15px; border-radius: 8px; width: 280px; z-index: 50; display: none;
}
.ib-share-popup.active { display: block; animation: fadeIn 0.2s; }
.ib-share-row { display: flex; gap: 5px; margin-bottom: 10px; }
.ib-share-input { width: 100%; padding: 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; font-size: 12px; }


/* Brand Button: WhatsApp */
.ib-wa-btn {
    display: block; text-align: center; background: #25D366; color: #fff !important;
    padding: 8px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 13px;
    transition: background 0.2s;
}
.ib-wa-btn:hover { background: #128C7E; text-decoration: none; }

/* Copy Button */
.ib-copy-btn {
    background: #334155; color: #fff; border: none; padding: 0 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.ib-copy-btn:hover { background: #1e293b; }

/* Loader */
.ib-loader-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7); z-index: 9999;
    backdrop-filter: blur(2px);
    display: flex; justify-content: center; align-items: center;
}
.ib-spinner {
    width: 40px; height: 40px; border: 3px solid #e2e8f0;
    border-top-color: #2271b1; border-radius: 50%; animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Mobile */
@media (max-width: 768px) {
    .ib-board-tree { grid-template-columns: 1fr; }
    .ib-card-preview-images { display: none; }
}