/* ==============================================================================
   Nepal News CMS — User Login & Reader Account Module Styles
   ============================================================================== */

/* Inline Email Field & "Send Code" Option */
.contact-email-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.contact-email-field-wrap input[type="email"] {
    width: 100%;
    padding-right: 110px !important;
}

.contact-inline-send-code {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--brand, #bd2434);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
    z-index: 2;
    line-height: 1.2;
}

.contact-inline-send-code:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-50%) scale(1.02);
}

.contact-inline-send-code:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(30%);
}

.contact-inline-verified-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: #15803d;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 4px 8px;
    pointer-events: none;
    z-index: 2;
}

/* Inline OTP Verification Box */
.contact-otp-box {
    margin: 12px 0 16px;
    padding: 16px 18px;
    background: var(--card-bg, rgba(255, 255, 255, 0.85));
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    animation: otpSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes otpSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.contact-otp-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.contact-otp-inputs input {
    font-size: 1.15rem;
    letter-spacing: 0.25em;
    text-align: center;
    max-width: 240px;
    font-weight: 700;
    padding: 8px 12px;
}

.contact-verify-otp-btn {
    white-space: nowrap;
    padding: 10px 18px;
    font-weight: 600;
    height: 42px;
}

.contact-otp-status {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 20px;
}

.status-success { color: #15803d; font-weight: 600; }
.status-error { color: #dc2626; font-weight: 600; }
.status-info { color: #2563eb; }

/* Locked / Disabled Submit Button */
button[data-contact-submit]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(40%);
    pointer-events: auto;
}

button[data-contact-submit]:disabled:hover {
    transform: none;
    filter: grayscale(40%);
}

/* Signed in badge on contact form */
.contact-signed-in-badge {
    margin-bottom: 18px;
}

.badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ecfdf5;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-role {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Header Topline Account Link */
.topline-account-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    margin-left: 12px;
}

.badge-unread {
    background: var(--brand, #bd2434);
    color: #ffffff;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 800;
    line-height: 1.2;
}

/* ==============================================================================
   Reader Account Dashboard (/account)
   ============================================================================== */
.account-dashboard {
    max-width: 1200px;
    margin: 0 auto 48px;
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 24px 28px;
    margin-bottom: 32px;
    border-radius: 12px;
}

.account-profile-summary {
    display: flex;
    align-items: center;
    gap: 18px;
}

.account-avatar-circle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--brand, #bd2434);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(189, 36, 52, 0.25);
}

.account-info h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
    line-height: 1.2;
}

.account-meta-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
}

.account-email {
    color: var(--muted, #64748b);
    font-weight: 500;
}

.account-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.account-logout-form {
    display: inline-block;
    margin: 0;
}

/* Dashboard Columns */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 900px) {
    .account-grid {
        grid-template-columns: 1fr;
    }
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--line, #e2e8f0);
}

.section-title-row h2 {
    margin: 0;
    font-size: 1.25rem;
}

/* Conversational Chat Container */
.chat-thread-container {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
}

.chat-thread {
    max-height: 520px;
    min-height: 220px;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: var(--surface, #ffffff);
}

.chat-empty-intro {
    text-align: center;
    padding: 36px 20px;
    margin: auto 0;
}

.chat-empty-icon {
    font-size: 2.2rem;
    display: inline-block;
    margin-bottom: 8px;
}

.chat-empty-intro h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.chat-empty-intro p {
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Chat Bubbles */
.chat-bubble-wrap {
    display: flex;
    width: 100%;
}

.chat-bubble-wrap--user {
    justify-content: flex-end;
}

.chat-bubble-wrap--admin {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 82%;
    padding: 12px 16px;
    font-size: 0.925rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.chat-bubble--user {
    background: var(--brand, #bd2434);
    color: #ffffff;
    border-radius: 14px 14px 2px 14px;
    box-shadow: 0 2px 8px rgba(189, 36, 52, 0.2);
}

.chat-bubble-subject {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.92;
    letter-spacing: 0.2px;
}

.chat-bubble--user .chat-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.725rem;
    color: rgba(255, 255, 255, 0.82);
}

.chat-status-badge {
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.chat-status--awaiting {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.chat-status--replied {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Admin / Editorial Reply Bubble */
.chat-bubble--admin {
    background: var(--bg, #f8fafc);
    color: var(--text, #1e293b);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 14px 14px 14px 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.chat-author-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.775rem;
    font-weight: 700;
    color: var(--brand, #bd2434);
    margin-bottom: 6px;
}

.chat-author-pill {
    background: var(--brand, #bd2434);
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.chat-bubble--admin .chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.725rem;
    color: var(--muted, #64748b);
}

.chat-official-label {
    background: var(--line, #e2e8f0);
    color: var(--muted, #475569);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Chat Lock Banner */
.chat-lock-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed var(--line, #cbd5e1);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.chat-lock-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.chat-lock-text strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text, #0f172a);
    font-size: 0.9rem;
}

.chat-lock-text p {
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 0.825rem;
    line-height: 1.4;
}

/* Chat Composer Bar */
.chat-composer {
    border-top: 1px solid var(--line, #e2e8f0);
    padding: 16px 20px;
    background: var(--surface, #ffffff);
}

.chat-composer-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-subject-input {
    width: 100%;
    border: 1px solid var(--line, #cbd5e1);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg, #f8fafc);
}

.chat-composer textarea {
    width: 100%;
    border: 1px solid var(--line, #cbd5e1);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 72px;
    background: var(--bg, #f8fafc);
    color: var(--text, #1e293b);
    box-sizing: border-box;
}

.chat-composer textarea:focus,
.chat-subject-input:focus {
    outline: 2px solid var(--brand, #bd2434);
    background: #ffffff;
}

.chat-composer-locked textarea:disabled {
    background: rgba(0, 0, 0, 0.04);
    cursor: not-allowed;
    color: var(--muted, #94a3b8);
    resize: none;
    border-color: var(--line, #e2e8f0);
}

.chat-composer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.chat-composer-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Saved Stories Sidebar Preview */
.saved-preview-list {
    padding: 16px 18px;
    border-radius: 10px;
}

.saved-preview-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line, #e2e8f0);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.saved-preview-item:last-child {
    border-bottom: none;
}

.saved-preview-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--line, #f1f5f9);
}

.saved-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.saved-preview-body {
    flex-grow: 1;
    min-width: 0;
}

.saved-preview-title {
    display: block;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
    color: var(--text, #1e293b);
    text-decoration: none;
    font-size: 0.925rem;
}

.saved-preview-title:hover {
    color: var(--brand, #bd2434);
    text-decoration: underline;
}

.saved-preview-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.775rem;
}

.account-saved-remove-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted, #94a3b8);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.15s, background-color 0.15s;
}

.account-saved-remove-btn:hover {
    color: #e04b37;
    background-color: rgba(224, 75, 55, 0.1);
}

.account-saved-remove-btn:focus-visible {
    outline: 2px solid var(--brand, #bd2434);
    outline-offset: 1px;
}

.saved-preview-footer {
    margin-top: 14px;
    padding-top: 10px;
}

.full-width {
    width: 100%;
    text-align: center;
}

.view-all-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand, #bd2434);
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Reader Login Page */
.reader-login-page {
    max-width: 520px;
    margin: 0 auto 48px;
}

.reader-login-panel {
    padding: 28px 32px;
    border-radius: 12px;
}

.reader-login-otp-section {
    margin: 16px 0 20px;
}


/* OTP Input Error & Success Styling */
.otp-input-error {
    border-color: #e02424 !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 3px rgba(224, 36, 36, 0.15) !important;
    color: #e02424;
}

.otp-input-error::placeholder {
    color: #e02424 !important;
    opacity: 0.85;
    font-size: 0.85rem;
}

.otp-input-success {
    border-color: #057a55 !important;
    background-color: #f3faf7 !important;
    box-shadow: 0 0 0 3px rgba(5, 122, 85, 0.15) !important;
}

/* Subtle Horizontal Shake Animation */
@keyframes otpShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.otp-shake {
    animation: otpShake 0.4s ease-in-out;
}

/* Status Message Formatting */
.otp-status-message {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.otp-status-message--error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.otp-status-message--success {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #31c48d;
}

/* Dark mode overrides */
body.theme-dark .otp-input-error {
    border-color: #f87171 !important;
    background-color: rgba(224, 36, 36, 0.12) !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2) !important;
    color: #fca5a5;
}

body.theme-dark .otp-input-error::placeholder {
    color: #fca5a5 !important;
}

body.theme-dark .otp-input-success {
    border-color: #34d399 !important;
    background-color: rgba(16, 185, 129, 0.12) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
}

body.theme-dark .otp-status-message--error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: #b91c1c;
}

body.theme-dark .otp-status-message--success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: #047857;
}


/* ==============================================================================
   Reader Account Lockout Security Modal
   ============================================================================== */
.reader-lockout-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
}

.reader-lockout-modal {
    background: #ffffff;
    border-radius: 12px;
    max-width: 440px;
    width: 100%;
    padding: 32px 28px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.reader-lockout-icon {
    font-size: 42px;
    margin-bottom: 12px;
    line-height: 1;
}

.reader-lockout-modal h2 {
    font-size: 1.25rem;
    font-weight: 750;
    color: #111827;
    margin: 0 0 10px;
}

.reader-lockout-msg {
    font-size: 0.95rem;
    color: #b91c1c;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 16px;
    background: #fef2f2;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.reader-lockout-timer {
    font-family: ui-monospace, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    color: #374151;
    background: #f3f4f6;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.reader-lockout-note {
    font-size: 0.825rem;
    color: #6b7280;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Dark theme support */
body.theme-dark .reader-lockout-modal {
    background: #1f2937;
    color: #f9fafb;
    border: 1px solid #374151;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

body.theme-dark .reader-lockout-modal h2 {
    color: #f9fafb;
}

body.theme-dark .reader-lockout-msg {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
    border-color: #991b1b;
}

body.theme-dark .reader-lockout-timer {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #374151;
}

body.theme-dark .reader-lockout-note {
    color: #9ca3af;
}
