@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

/* ===================== BASE ===================== */
.wpp-wrap * { box-sizing: border-box; margin: 0; padding: 0; }
.wpp-wrap {
    font-family: 'Nunito', sans-serif;
    min-height: 400px;
    background: var(--wpp-bg, #f0f4ff);
    padding: 24px;
    border-radius: 16px;
    position: relative;
}

/* ===================== LOGIN NOTICE ===================== */
.wpp-login-notice {
    text-align: center;
    padding: 48px 24px;
    font-size: 16px;
    color: #64748b;
    background: #fff;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}
.wpp-login-notice a { color: #3b82f6; font-weight: 700; }

/* ===================== PASSWORD SCREEN ===================== */
.wpp-password-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 400px;
}
.wpp-password-box {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
    max-width: 380px;
    width: 100%;
}
.wpp-pw-icon { font-size: 48px; margin-bottom: 16px; }
.wpp-password-box h2 { font-size: 22px; font-weight: 800; color: #1e293b; margin-bottom: 8px; }
.wpp-password-box p  { color: #64748b; margin-bottom: 24px; font-size: 14px; }
.wpp-pw-error {
    background: #fee2e2; color: #991b1b;
    border-radius: 8px; padding: 10px 14px;
    font-size: 13px; margin-bottom: 16px;
}
.wpp-password-box input {
    width: 100%; padding: 12px 16px;
    border: 2px solid #e2e8f0; border-radius: 10px;
    font-size: 15px; margin-bottom: 16px;
    font-family: inherit;
    transition: border-color .2s;
}
.wpp-password-box input:focus { outline: none; border-color: #3b82f6; }

/* ===================== BOARD HEADER ===================== */
.wpp-board-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.wpp-board-title {
    font-size: 26px; font-weight: 800; color: #1e293b;
    line-height: 1.2;
}
.wpp-board-desc { color: #64748b; font-size: 14px; margin-top: 4px; }
.wpp-board-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.wpp-credits {
    font-size: 11px; color: #94a3b8; font-weight: 600;
}

/* ===================== BUTTONS ===================== */
.wpp-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 10px;
    font-size: 14px; font-weight: 700;
    cursor: pointer; border: none;
    transition: all .2s; font-family: inherit;
}
.wpp-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.wpp-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.45); }
.wpp-btn-ghost {
    background: rgba(0,0,0,0.06); color: #475569;
}
.wpp-btn-ghost:hover { background: rgba(0,0,0,0.1); }

/* ===================== GRID ===================== */
.wpp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    align-items: start;
}
.wpp-loading, .wpp-empty {
    grid-column: 1 / -1;
    text-align: center; padding: 60px 24px;
    color: #94a3b8; font-size: 15px;
    display: flex; align-items: center; justify-content: center; gap: 12px;
}
.wpp-spinner {
    width: 24px; height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: wpp-spin 0.8s linear infinite;
}
@keyframes wpp-spin { to { transform: rotate(360deg); } }

/* ===================== POST CARD ===================== */
.wpp-post-card {
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
    position: relative;
    transition: transform .2s, box-shadow .2s;
    break-inside: avoid;
    word-wrap: break-word;
}
.wpp-post-card:hover {
    transform: translateY(-3px) rotate(0.5deg);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.wpp-card-delete {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.12); border: none;
    border-radius: 50%; width: 24px; height: 24px;
    font-size: 11px; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    color: inherit; font-family: inherit;
    transition: background .15s;
}
.wpp-post-card:hover .wpp-card-delete { display: flex; }
.wpp-card-delete:hover { background: rgba(239,68,68,0.25); }

.wpp-card-image { margin-bottom: 12px; border-radius: 8px; overflow: hidden; }
.wpp-card-image img { width: 100%; height: 160px; object-fit: cover; display: block; }

.wpp-card-title {
    font-size: 16px; font-weight: 800;
    margin-bottom: 8px; line-height: 1.3;
}
.wpp-card-content {
    font-size: 13px; line-height: 1.6;
    opacity: 0.85;
    white-space: pre-wrap;
}
.wpp-card-file {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    margin-top: 10px; opacity: 0.7;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: opacity .15s;
}
.wpp-card-file:hover { opacity: 1; }
.wpp-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.08);
    font-size: 12px;
}
.wpp-card-author { font-weight: 600; }
.wpp-comments-btn {
    background: none; border: none; cursor: pointer;
    font-size: 12px; font-weight: 600;
    font-family: inherit; padding: 4px 8px;
    border-radius: 8px; transition: background .15s;
}
.wpp-comments-btn:hover { background: rgba(0,0,0,0.08); }

/* ===================== MODAL ===================== */
.wpp-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.wpp-modal {
    background: #fff; border-radius: 20px;
    width: 100%; max-width: 520px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    animation: wpp-modal-in 0.2s ease;
    max-height: 90vh; overflow-y: auto;
}
.wpp-modal-comments { max-width: 480px; }
@keyframes wpp-modal-in {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.wpp-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 0;
}
.wpp-modal-header h3 { font-size: 18px; font-weight: 800; color: #1e293b; }
.wpp-modal-close {
    background: #f1f5f9; border: none; border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer;
    font-size: 14px; color: #64748b;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.wpp-modal-close:hover { background: #fee2e2; color: #ef4444; }
.wpp-modal-body { padding: 20px 24px; }
.wpp-modal-footer {
    padding: 0 24px 20px;
    display: flex; justify-content: flex-end; gap: 10px;
}
.wpp-modal-error {
    background: #fee2e2; color: #991b1b;
    border-radius: 8px; padding: 10px 14px;
    font-size: 13px; margin-top: 12px;
}

/* ===================== FORM ELEMENTS ===================== */
.wpp-input, .wpp-textarea {
    width: 100%; padding: 12px 14px;
    border: 2px solid #e2e8f0; border-radius: 10px;
    font-size: 14px; font-family: inherit;
    transition: border-color .2s; resize: vertical;
    margin-bottom: 12px; color: #1e293b;
}
.wpp-input:focus, .wpp-textarea:focus {
    outline: none; border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ===================== COLOR PICKER ===================== */
.wpp-color-picker { margin-bottom: 14px; }
.wpp-color-picker label { font-size: 13px; font-weight: 600; color: #64748b; display: block; margin-bottom: 8px; }
.wpp-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.wpp-color-dot {
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; border: 3px solid transparent;
    transition: transform .15s, border-color .15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.wpp-color-dot:hover { transform: scale(1.15); }
.wpp-color-dot input { display: none; }
.wpp-color-dot:has(input:checked) { border-color: #3b82f6; transform: scale(1.2); }

/* ===================== UPLOAD ===================== */
.wpp-upload-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.wpp-upload-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f1f5f9; border: 2px dashed #cbd5e1;
    border-radius: 10px; padding: 8px 14px;
    font-size: 13px; font-weight: 600; color: #475569;
    cursor: pointer; transition: all .2s; font-family: inherit;
    white-space: nowrap;
}
.wpp-upload-btn:hover { background: #e0f2fe; border-color: #3b82f6; color: #3b82f6; }
.wpp-upload-name { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== COMMENTI ===================== */
.wpp-comment {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}
.wpp-comment:last-child { border-bottom: none; }
.wpp-comment-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px; font-size: 13px;
}
.wpp-comment-header strong { color: #1e293b; font-weight: 700; }
.wpp-comment-date { color: #94a3b8; font-size: 11px; flex: 1; }
.wpp-comment-delete {
    background: none; border: none; cursor: pointer;
    color: #94a3b8; font-size: 12px; padding: 2px 6px;
    border-radius: 4px; transition: all .15s;
}
.wpp-comment-delete:hover { background: #fee2e2; color: #ef4444; }
.wpp-comment-body { font-size: 14px; color: #475569; line-height: 1.6; }
.wpp-comment-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f1f5f9; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 600px) {
    .wpp-wrap { padding: 16px; }
    .wpp-board-header { flex-direction: column; }
    .wpp-grid { grid-template-columns: 1fr; }
    .wpp-modal { border-radius: 16px; }
}
