/* Google Fonts are enqued in PHP: Inter & Fira Code */

:root {
    --psp-primary: #6366f1;
    /* Indigo 500 */
    --psp-primary-hover: #4f46e5;
    /* Indigo 600 */
    --psp-secondary: #0f172a;
    /* Slate 900 */
    --psp-bg: #f8fafc;
    /* Slate 50 */
    --psp-card-bg: #ffffff;
    --psp-text-main: #334155;
    /* Slate 700 */
    --psp-text-light: #64748b;
    /* Slate 500 */
    --psp-code-bg: #1e293b;
    /* Slate 800 */
    --psp-code-text: #e2e8f0;
    /* Slate 200 */
    --psp-border-radius: 12px;
    --psp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --psp-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.psp-dashboard-container {
    max-width: 1280px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Inter', sans-serif;
    color: var(--psp-text-main);
}

/* Category Section */
.psp-category-section {
    margin-bottom: 60px;
}

.psp-category-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--psp-secondary);
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.psp-category-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--psp-primary);
    border-radius: 2px;
}

/* Prompt Grid */
.psp-prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* Prompt Card */
.psp-prompt-card {
    background: var(--psp-card-bg);
    border: 1px solid #e2e8f0;
    border-radius: var(--psp-border-radius);
    padding: 24px;
    box-shadow: var(--psp-shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.psp-prompt-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--psp-shadow-hover);
    border-color: #cbd5e1;
}

.psp-prompt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--psp-primary), #a855f7);
    /* Indigo to Purple */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.psp-prompt-card:hover::before {
    opacity: 1;
}

.psp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.psp-prompt-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--psp-secondary);
    margin: 0;
    line-height: 1.4;
    max-width: 75%;
}

.psp-copy-count {
    font-size: 0.8rem;
    color: var(--psp-text-light);
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.psp-copy-count .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

.psp-prompt-content {
    background: var(--psp-code-bg);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-grow: 1;
    overflow-x: auto;
    /* Allow horizontal scroll for long lines */
    border: 1px solid #334155;
    position: relative;
    min-height: 80px;
    /* Minimum height ensures it looks like a box even if empty */
}

/* Scrollbar styles for code block */
.psp-prompt-content::-webkit-scrollbar {
    height: 8px;
}

.psp-prompt-content::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.psp-prompt-content::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.psp-prompt-text {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--psp-code-text);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Prompt Text Truncation (Click to View) */
.psp-prompt-content {
    max-height: 150px;
    /* Reduced height for preview */
    overflow-y: hidden;
    position: relative;
    cursor: pointer;
    /* Indicate clickable */
    transition: border-color 0.2s;
}

.psp-prompt-content:hover {
    border-color: var(--psp-primary);
}

.psp-prompt-text {
    /* Prevent text selection on preview to encourage clicking */
    user-select: none;
    -webkit-user-select: none;
}

/* Gradient Fade Overlay */
.psp-prompt-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, rgba(30, 41, 59, 0), rgba(30, 41, 59, 1));
    pointer-events: none;
}


/* Copy Button */
.psp-copy-btn {
    align-self: flex-start;
    background-color: transparent;
    color: var(--psp-primary);
    border: 1px solid var(--psp-primary);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.psp-copy-btn:hover {
    background-color: var(--psp-primary);
    color: #fff;
    transform: scale(1.02);
}

.psp-copy-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1.2;
}

/* Modal Styles - Centered */
.psp-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevent body scroll if needed, or auto if modal is long */
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
}

/* Ensure Login Modal is ALWAYS on top of View Modal */
#psp-login-modal {
    z-index: 10005 !important;
}

/* Disable selection in View Modal to force button usage */
#psp-view-text {
    user-select: none !important;
    -webkit-user-select: none !important;
}

.psp-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 450px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Absolute Centering */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    display: flex;
    flex-direction: column;
    max-height: 90vh;
    /* Prevent overflow on small screens */
}

@keyframes pspPopIn {
    from {
        transform: scale(0.95) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.psp-close-modal {
    color: #94a3b8;
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.psp-close-modal:hover {
    color: var(--psp-secondary);
}

.psp-modal-header {
    display: flex;
    background: #fff;
    /* Unified white header */
    padding: 20px 20px 10px 20px;
    border-bottom: 2px solid #f1f5f9;
}

.psp-tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: #94a3b8;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.psp-tab-btn:hover {
    color: var(--psp-primary);
    background: #f8fafc;
}

.psp-tab-btn.active {
    color: var(--psp-primary);
    border-bottom: 2px solid var(--psp-primary);
    border-radius: 8px 8px 0 0;
    /* Attach to bottom */
    margin-bottom: -12px;
    /* Pull down to overlap border */
    background: transparent;
}

.psp-modal-body {
    padding: 30px;
    background: #fff;
}

.psp-modal-body h3 {
    text-align: center;
    margin-top: 0;
    color: var(--psp-secondary);
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.psp-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--psp-text-main);
    font-weight: 500;
}

.psp-modal-body input[type="text"],
.psp-modal-body input[type="email"],
.psp-modal-body input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #f8fafc;
    box-sizing: border-box;
}

.psp-modal-body input:focus {
    outline: none;
    border-color: var(--psp-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.psp-modal-body button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: var(--psp-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 20px;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.psp-modal-body button[type="submit"]:hover {
    background: var(--psp-primary-hover);
    transform: translateY(-1px);
}

.status-msg {
    margin-bottom: 15px;
    font-size: 0.9rem;
    border-radius: 6px;
    padding: 10px 12px;
    display: none;
    text-align: center;
}

.status-msg.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    display: block;
}

.status-msg.success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
    display: block;
}

/* Tab Switching Logic */
.psp-tab-content {
    display: none;
    animation: pspFadeIn 0.3s ease;
}

.psp-tab-content.active {
    display: block;
}

@keyframes pspFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Form */
.psp-search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
    justify-content: center;
}

.psp-search-form input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.psp-search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--psp-primary);
    box-shadow: 0 4px 10px -1px rgba(99, 102, 241, 0.2);
}

.psp-search-form button {
    background: var(--psp-primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.psp-search-form button:hover {
    background: var(--psp-primary-hover);
    transform: scale(1.05);
}

.psp-search-form .psp-clear-search {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    text-decoration: none;
    font-size: 24px;
    line-height: 1;
}

.psp-search-form .psp-clear-search:hover {
    background: #e2e8f0;
    color: #ef4444;
}

.psp-empty-msg {
    text-align: center;
    color: var(--psp-text-light);
    font-size: 1.1rem;
    margin-top: 40px;
}