/* Shared Styles for Poetry Studio Pro - Phase 4 */

/* ============================================================================
   NAVIGATION BAR
   ============================================================================ */

.main-navigation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    padding: 0 30px;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 600;
    color: white;
    margin-right: 50px;
}

.brand-icon {
    font-size: 32px;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

.nav-icon {
    font-size: 20px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ============================================================================
   GLOBAL GENERATION BADGE
   ============================================================================ */

.gen-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    animation: pulse 2s infinite;
}

.gen-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6); }
}

.badge-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
}

/* ============================================================================
   LOADING OVERLAY
   ============================================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* ============================================================================
   PSP TOAST NOTIFICATIONS — dark theme, top-right, auto-dismiss
   Use: window.PSPToast.show('message', 'success'|'error'|'warning'|'info')
   ============================================================================ */

#psp-toast-container {
    position: fixed;
    top: 72px; /* below nav */
    right: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.psp-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(22, 22, 40, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 260px;
    max-width: 400px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    backdrop-filter: blur(12px);
}

.psp-toast.psp-toast--show {
    opacity: 1;
    transform: translateX(0);
}

.psp-toast.psp-toast--hide {
    opacity: 0;
    transform: translateX(24px);
}

.psp-toast-icon {
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1;
}

.psp-toast-msg {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    line-height: 1.4;
}

.psp-toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
    cursor: pointer;
    padding: 0 0 0 6px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.psp-toast-close:hover { color: rgba(255, 255, 255, 0.7); }

/* Tappable action link inside toast (PSPToast.showWithAction).
   Sized to meet 44px mobile hit target via padding. */
.psp-toast-action {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    min-height: 32px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.psp-toast-action:hover {
    background: rgba(102, 126, 234, 0.28);
    border-color: rgba(102, 126, 234, 0.7);
    color: #ffffff;
}
.psp-toast-action:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
@media (pointer: coarse) {
    /* Hit target expands to full 44px on touch devices without visual change. */
    .psp-toast-action {
        min-height: 44px;
        padding: 12px 14px;
    }
}

.psp-toast--success { border-left: 3px solid #10b981; }
.psp-toast--error   { border-left: 3px solid #ef4444; }
.psp-toast--warning { border-left: 3px solid #f59e0b; }
.psp-toast--info    { border-left: 3px solid #667eea; }

/* Legacy .toast/.bulk-toast compatibility — redirect to same container */
.bulk-toast { display: none !important; }

/* ============================================================================
   PSPPrompt — inline text-input modal (replaces native prompt())
   Used by ProjectPicker createNew/editName and other sites migrating
   off native dialogs. Dark-theme, keyboard-first, accessible.
   ============================================================================ */

.psp-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 150ms ease;
    padding: 20px;
}
.psp-prompt-overlay.psp-prompt--show { opacity: 1; }

.psp-prompt {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #1f2230, #15171f);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    transform: translateY(6px);
    transition: transform 180ms cubic-bezier(.2, .9, .3, 1.2);
}
.psp-prompt-overlay.psp-prompt--show .psp-prompt { transform: translateY(0); }

.psp-prompt-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 14px;
}

.psp-prompt-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;   /* 16px to prevent iOS zoom on focus */
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    color: #fff;
    outline: none;
    transition: border-color 120ms ease, background 120ms ease;
}
.psp-prompt-input:focus {
    border-color: rgba(102, 126, 234, 0.7);
    background: rgba(255, 255, 255, 0.06);
}

.psp-prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.psp-prompt-cancel,
.psp-prompt-submit {
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    min-height: 40px;
}

.psp-prompt-cancel {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
}
.psp-prompt-cancel:hover {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.22);
}

.psp-prompt-submit {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}
.psp-prompt-submit:hover { filter: brightness(1.08); }
.psp-prompt-submit:active { transform: scale(0.98); }

@media (pointer: coarse) {
    .psp-prompt-cancel,
    .psp-prompt-submit { min-height: 44px; padding: 11px 18px; }
}

/* ============================================================================
   MODAL DIALOG
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.modal-body {
    padding: 20px;
    color: #6c757d;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c82333;
}

/* ========== PSP Badges (PRJ / COL) ========== */
.psp-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    vertical-align: middle;
    flex-shrink: 0;
}
.psp-badge-project {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}
.psp-badge-collection {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}
