/* ============================================
   时光邮局 - 前端样式 v2.0
   ============================================ */

/* ---- 全局容器 ---- */
.tpo-form-wrap {
    max-width: 720px;
    margin: 30px auto;
    padding: 40px 45px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.tpo-form-wrap h2 {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 18px;
    border-bottom: 3px solid;
    border-image: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-image-slice: 1;
    border-bottom-style: solid;
}

/* ---- 表单组 ---- */
.tpo-form-group {
    margin-bottom: 22px;
}

.tpo-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.tpo-form-group .required {
    color: #e74c3c;
    margin-left: 4px;
}

.tpo-form-group input[type="email"],
.tpo-form-group input[type="text"],
.tpo-form-group input[type="datetime-local"],
.tpo-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.tpo-form-group input:focus,
.tpo-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12);
}

.tpo-form-group textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
}

.tpo-form-group input[type="datetime-local"] {
    width: auto;
    min-width: 220px;
}

.tpo-hint {
    display: block;
    margin-top: 4px;
    color: #718096;
    font-size: 13px;
}

/* ---- 复选框 ---- */
.tpo-checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
}

.tpo-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: #667eea;
    cursor: pointer;
}

/* ---- 字数统计 ---- */
.tpo-char-counter {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #718096;
    text-align: right;
}

/* ---- 提交按钮 ---- */
.tpo-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 14px 40px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.tpo-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
}

.tpo-submit-btn:active {
    transform: translateY(0);
}

/* ---- 提示消息 ---- */
.notice {
    padding: 16px 20px;
    margin: 0 0 25px 0;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    animation: tpoSlideDown 0.4s ease;
}

.notice-success {
    background: #d4edda;
    color: #155724;
    border-left: 5px solid #28a745;
}

.notice-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 5px solid #dc3545;
}

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

/* ---- 登录提示 ---- */
.tpo-login-prompt {
    text-align: center;
    padding: 40px 20px;
    background: #f7fafc;
    border-radius: 16px;
    border: 2px dashed #cbd5e0;
}

.tpo-login-prompt a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

/* ============================================
   公开信广场
   ============================================ */
.tpo-public-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tpo-public-header {
    text-align: center;
    padding: 30px 0 40px 0;
}

.tpo-public-header h2 {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tpo-public-subtitle {
    color: #718096;
    font-size: 16px;
    margin-top: 8px;
}

.tpo-public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
}

.tpo-public-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid #edf2f7;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tpo-public-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.12);
    border-color: #c3dafe;
}

.tpo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.tpo-card-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tpo-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.tpo-avatar-default {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tpo-username {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

.tpo-card-date {
    font-size: 13px;
    color: #a0aec0;
}

.tpo-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpo-card-content {
    color: #4a5568;
    line-height: 1.7;
    font-size: 15px;
    flex: 1;
    margin-bottom: 16px;
}

.tpo-card-content p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpo-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

.tpo-card-tag {
    background: #ebf4ff;
    color: #4c51bf;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
}

.tpo-card-time {
    font-size: 12px;
    color: #a0aec0;
}

.tpo-read-more {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tpo-read-more:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* ---- 空状态 ---- */
.tpo-public-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f7fafc;
    border-radius: 16px;
    border: 2px dashed #cbd5e0;
}

.tpo-public-empty p {
    font-size: 18px;
    color: #718096;
}

.tpo-public-empty a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

/* ---- 弹窗 ---- */
.tpo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: tpoFadeIn 0.3s ease;
}

@keyframes tpoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tpo-modal-content {
    background: #ffffff;
    max-width: 650px;
    width: 100%;
    max-height: 80vh;
    border-radius: 20px;
    padding: 40px 45px;
    position: relative;
    overflow-y: auto;
    animation: tpoSlideUp 0.4s ease;
}

@keyframes tpoSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.tpo-modal-close {
    position: sticky;
    top: 0;
    float: right;
    font-size: 32px;
    font-weight: 300;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.3s;
    background: #ffffff;
    padding: 0 0 0 12px;
    z-index: 1;
}

.tpo-modal-close:hover {
    color: #2c3e50;
}

.tpo-modal-body {
    margin-top: 10px;
}

.tpo-modal-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #718096;
}

.tpo-modal-body h3 {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.tpo-modal-meta {
    color: #718096;
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.tpo-modal-content-text {
    color: #2d3748;
    line-height: 1.9;
    font-size: 16px;
}

.tpo-modal-content-text p {
    margin-bottom: 16px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .tpo-form-wrap {
        padding: 25px 20px;
        margin: 15px 10px;
    }
    
    .tpo-form-wrap h2 {
        font-size: 22px;
    }
    
    .tpo-public-grid {
        grid-template-columns: 1fr;
    }
    
    .tpo-modal-content {
        padding: 25px 20px;
    }
    
    .tpo-submit-btn {
        width: 100%;
        justify-content: center;
    }
}




/* ============================================
   投递时空动画
   ============================================ */

.tpo-anim-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: radial-gradient(ellipse at 50% 50%, #1a1a3e 0%, #0a0a1a 60%, #030308 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
}

.tpo-anim-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---- 星空背景 ---- */
.tpo-anim-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, #ffffff, transparent),
        radial-gradient(1px 1px at 60% 70%, #ffffff, transparent),
        radial-gradient(1px 1px at 40% 50%, #a8b8ff, transparent),
        radial-gradient(2px 2px at 80% 20%, #a8b8ff, transparent),
        radial-gradient(1px 1px at 10% 80%, #ffffff, transparent),
        radial-gradient(2px 2px at 90% 90%, #ffffff, transparent),
        radial-gradient(1px 1px at 30% 90%, #a8b8ff, transparent),
        radial-gradient(1px 1px at 70% 10%, #ffffff, transparent),
        radial-gradient(1px 1px at 50% 20%, #ffffff, transparent),
        radial-gradient(2px 2px at 15% 55%, #ffffff, transparent);
    background-size: 200% 200%;
    animation: tpoTwinkle 3s ease-in-out infinite alternate;
}

@keyframes tpoTwinkle {
    0% { opacity: 0.5; background-position: 0% 0%; }
    100% { opacity: 1; background-position: 20% 20%; }
}

/* ---- 时光隧道 ---- */
.tpo-anim-tunnel {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
}

.tpo-tunnel-ring {
    position: absolute;
    top: 0; left: 0;
    width: 100px; height: 100px;
    margin: -50px 0 0 -50px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.7);
    box-shadow:
        0 0 25px rgba(102, 126, 234, 0.6),
        inset 0 0 25px rgba(118, 75, 162, 0.4);
    animation: tpoRingExpand 2.6s ease-out infinite;
    opacity: 0;
}

.tpo-tunnel-ring:nth-child(1) { animation-delay: 0s; }
.tpo-tunnel-ring:nth-child(2) { animation-delay: 0.65s; }
.tpo-tunnel-ring:nth-child(3) { animation-delay: 1.3s; }
.tpo-tunnel-ring:nth-child(4) { animation-delay: 1.95s; }

@keyframes tpoRingExpand {
    0%   { transform: scale(0.15); opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: scale(7); opacity: 0; }
}

/* ---- 飞行信封 ---- */
.tpo-anim-envelope {
    position: absolute;
    top: 50%; left: 50%;
    font-size: 90px;
    line-height: 1;
    transform: translate(-50%, -50%) translateY(320px);
    filter: drop-shadow(0 0 30px rgba(102, 126, 234, 0.9))
            drop-shadow(0 0 60px rgba(118, 75, 162, 0.6));
    animation: tpoFlyEnvelope 2.5s cubic-bezier(0.4, 0.05, 0.6, 0.95) forwards;
    z-index: 10;
}

@keyframes tpoFlyEnvelope {
    0% {
        transform: translate(-50%, -50%) translateY(320px) rotate(-18deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: translate(-50%, -50%) translateY(20px) translateX(-35px) rotate(10deg) scale(1.1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) translateY(-80px) translateX(30px) rotate(-8deg) scale(0.95);
        opacity: 1;
    }
    75% {
        transform: translate(-50%, -50%) translateY(-170px) translateX(-10px) rotate(20deg) scale(0.6);
        opacity: 0.85;
    }
    100% {
        transform: translate(-50%, -50%) translateY(-260px) translateX(0) rotate(60deg) scale(0.05);
        opacity: 0;
    }
}

/* ---- 状态文字 ---- */
.tpo-anim-status {
    position: relative;
    z-index: 5;
    text-align: center;
    margin-top: 260px;
    animation: tpoFadeInUp 0.8s ease 0.3s both;
}

.tpo-anim-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #a8b8ff, #e0c3fc, #a8b8ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px rgba(168, 184, 255, 0.6));
    animation: tpoTextShine 2s linear infinite;
}

@keyframes tpoTextShine {
    to { background-position: 200% center; }
}

.tpo-anim-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 10px;
    letter-spacing: 2px;
}

@keyframes tpoFadeInUp {
    from { opacity: 0; transform: translateY(25px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 成功状态 ---- */
.tpo-anim-success {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    animation: tpoSuccessPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

@keyframes tpoSuccessPop {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.tpo-success-circle {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.tpo-success-circle svg {
    width: 100%;
    height: 100%;
}

.tpo-success-circle circle {
    stroke: #4ade80;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: tpoDrawCircle 0.8s ease-out 0.2s forwards;
    filter: drop-shadow(0 0 12px rgba(74, 222, 128, 0.9));
}

.tpo-success-circle path {
    stroke: #4ade80;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: tpoDrawCheck 0.4s ease-out 1s forwards;
}

@keyframes tpoDrawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes tpoDrawCheck {
    to { stroke-dashoffset: 0; }
}

.tpo-success-title {
    font-size: 30px;
    font-weight: 700;
    color: #4ade80;
    letter-spacing: 4px;
    text-shadow: 0 0 25px rgba(74, 222, 128, 0.7);
}

.tpo-success-sub {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
    letter-spacing: 1px;
}

/* ---- 错误状态 ---- */
.tpo-anim-error {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    animation: tpoSuccessPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

.tpo-error-icon {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid #f87171;
    color: #f87171;
    font-size: 66px;
    line-height: 104px;
    margin: 0 auto 22px;
    box-shadow: 0 0 35px rgba(248, 113, 113, 0.6),
                inset 0 0 20px rgba(248, 113, 113, 0.2);
}

.tpo-error-title {
    font-size: 26px;
    font-weight: 700;
    color: #f87171;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
}

.tpo-error-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 10px;
    max-width: 320px;
    line-height: 1.5;
}

/* ---- 移动端优化 ---- */
@media (max-width: 480px) {
    .tpo-anim-envelope { font-size: 68px; }
    .tpo-anim-title { font-size: 20px; letter-spacing: 2px; }
    .tpo-success-title { font-size: 24px; }
    .tpo-success-circle { width: 90px; height: 90px; }
    .tpo-error-icon { width: 90px; height: 90px; font-size: 52px; line-height: 84px; }
}



/* 查询页输入框微调 */
.tpo-form-wrap input[name="tpo_query_code"] {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    color: #667eea;
}


/* ============================================
   持久成功信卡 (替换表单)
   ============================================ */
.tpo-success-panel {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #edf2f7;
    animation: tpoSlideUp 0.6s ease;
}

.tpo-success-icon {
    font-size: 56px;
    margin-bottom: 15px;
}

.tpo-success-panel h3 {
    font-size: 26px;
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.tpo-success-desc {
    color: #718096;
    font-size: 15px;
    margin-bottom: 25px;
}

.tpo-query-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 16px;
    padding: 25px;
    margin: 0 auto 30px;
    max-width: 400px;
}

.tpo-query-box p {
    margin: 0;
    font-size: 14px;
    color: #4a5568;
}

.tpo-query-code-wrap {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.tpo-code-text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #667eea;
    font-family: monospace;
}

.tpo-copy-btn {
    padding: 6px 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tpo-copy-btn:hover { background: #5a67d8; }
.tpo-copy-btn.copied { background: #48bb78; }

.tpo-query-hint {
    font-size: 12px !important;
    color: #a0aec0 !important;
    line-height: 1.6;
}

.tpo-write-again-btn {
    background: #edf2f7;
    color: #4a5568;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tpo-write-again-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}


/* ⚡️ 确认机制高亮警告 */
.tpo-confirm-alert {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    color: #b45309;
    padding: 15px;
    border-radius: 8px;
    margin: 0 auto 20px;
    max-width: 450px;
    text-align: left;
    font-size: 14px;
    line-height: 1.6;
}
