/* =========================================
   Huai Social App - Isolated Styles (v8.2)
   Theme: Tech / Minimal / Premium
   ========================================= */

/* 1. Root Scope & Reset (隔離層) */
#huai-root {
    --h-primary: #0f172a;       /* 深邃科技黑 */
    --h-accent: #3b82f6;        /* 科技藍 */
    --h-accent-hover: #2563eb;
    --h-bg: #ffffff;
    --h-page-bg: #f8fafc;
    --h-text: #334155;
    --h-text-light: #64748b;
    --h-border: #e2e8f0;
    --h-input-bg: #fff;
    --h-radius: 8px;
    --h-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--h-text);
    box-sizing: border-box;
    max-width: 900px;
    margin: 40px auto;
    font-size: 16px;
}

/* 強制重置內部元素 */
#huai-root *, #huai-root *::before, #huai-root *::after {
    box-sizing: border-box;
    outline: none;
}

/* 2. Container & Card */
#huai-root .huai-card {
    background: var(--h-bg);
    border-radius: 12px;
    box-shadow: var(--h-shadow);
    border: 1px solid rgba(255,255,255,0.5);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

/* 3. Typography */
#huai-root h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--h-primary);
    margin: 0 0 10px 0;
    border: none;
}

#huai-root h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--h-primary);
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--h-page-bg);
}

/* 4. Session Info Badge */
#huai-root .session-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--h-text-light);
    margin-bottom: 30px;
}
#huai-root .deadline-badge {
    background: #fff2b5;
    color: #cab036;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid #f5e588;
}
#huai-root .deadline-badge.urgent {
    background: #fef2f2; color: #dc2626; border-color: #fee2e2;
}

/* 5. Tabs */
#huai-root .huai-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 30px;
    background: var(--h-page-bg);
    padding: 5px;
    border-radius: 10px;
}
#huai-root .huai-tab-item {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--h-text-light);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}
#huai-root .huai-tab-item.active {
    background: #fff;
    color: var(--h-accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
#huai-root .huai-tab-content { display: none; animation: fadeIn 0.4s ease; }
#huai-root .huai-tab-content.active { display: block; }

/* 6. Form Layout */
#huai-root .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    #huai-root .form-grid { grid-template-columns: 1fr; }
}

/* 7. Inputs */
#huai-root .huai-field { margin-bottom: 20px; }
#huai-root label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--h-primary);
}
#huai-root input[type="text"],
#huai-root input[type="email"],
#huai-root input[type="password"],
#huai-root input[type="date"],
#huai-root select,
#huai-root textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    background: var(--h-input-bg);
    font-size: 15px;
    color: var(--h-text);
    transition: all 0.2s ease;
    box-shadow: none;
    font-family: inherit;
}
#huai-root input:focus, #huai-root select:focus, #huai-root textarea:focus {
    border-color: var(--h-accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
#huai-root input::placeholder, #huai-root textarea::placeholder {
    color: #cbd5e1;
}

/* 8. Radio & Checkbox (修正：縮小上下行距) */
#huai-root .radio-group,
#huai-root .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    column-gap: 20px; /* 左右寬鬆 */
    row-gap: 8px;     /* 上下緊湊 */
}
#huai-root .radio-label,
#huai-root .check-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--h-text);
    line-height: 1.4; /* 降低行高 */
    margin: 0;
}
#huai-root input[type="radio"],
#huai-root input[type="checkbox"] {
    margin-right: 6px;
    width: 16px;
    height: 16px;
    accent-color: var(--h-accent);
    transform: translateY(-1px);
}

/* 9. Footer Terms (純文字宣告) */
#huai-root .huai-footer-note {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--h-border);
    font-size: 13px;
    color: #94a3b8; /* 淺灰色 */
    line-height: 1.6;
    text-align: justify;
}
#huai-root .huai-footer-note p {
    margin: 0 0 12px 0;
}

/* 10. Buttons */
#huai-root .huai-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: #FDDC43;
    color: #202226;
    padding: 14px;
    border: none;
    border-radius: var(--h-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-top: 10px;
}
#huai-root .huai-btn:hover {
    background: #F4C900;
    color: #202226;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(253, 220, 67, 0.4);
}
#huai-root .huai-btn-secondary {
    display: inline-block;
    background: #64748b;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: var(--h-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
#huai-root .huai-btn-secondary:hover {
    background: #475569;
}

/* 11. File Status */
#huai-root .file-row {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 15px;
    border-radius: var(--h-radius);
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}
#huai-root .file-info { flex: 1; }
#huai-root .file-input { width: 100%; margin-top: 5px; }
#huai-root .status-tag {
    font-size: 12px; padding: 3px 8px; border-radius: 4px; font-weight: 600; margin-left: 8px;
    display: inline-block;
}
#huai-root .status-tag.ok { background: #dcfce7; color: #166534; }
#huai-root .status-tag.ng { background: #fee2e2; color: #991b1b; }
#huai-root .status-tag.wait { background: #e0f2fe; color: #075985; }

/* 12. Messages */
#huai-root .huai-msg {
    padding: 15px; border-radius: var(--h-radius); margin-bottom: 25px; font-size: 14px; line-height: 1.5;
}
#huai-root .huai-msg.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
#huai-root .huai-msg.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
#huai-root .huai-msg.info { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }

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