/* ============================================
   小悟学伴 - 公共组件样式
   导航栏、通知、模态框、加载、表单元素
   ============================================ */

/* === 公共导航栏 === */
.shared-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    height: 60px;
}

.shared-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.shared-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.shared-logo-icon {
    height: 42px;
    width: auto;
}

.shared-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0369a1;
}

.shared-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.shared-nav-link {
    padding: 8px 12px;
    color: #475569;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
}

.shared-nav-link:hover {
    color: #0ea5e9;
    background: #f0f9ff;
}

.shared-nav-highlight {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff !important;
    font-weight: 600;
}

.shared-nav-highlight:hover {
    background: linear-gradient(135deg, #f97316, #ef4444) !important;
    color: #fff !important;
}

.shared-btn-logout {
    padding: 8px 14px;
    background: none;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.shared-btn-logout:hover {
    color: #ef4444;
    border-color: #fecaca;
    background: #fef2f2;
}

/* === 导航栏分隔线 === */
.shared-nav-sep {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    margin: 0 4px;
    flex-shrink: 0;
}

.shared-header-placeholder {
    height: 60px;
}

/* 首页风格导航栏占位 */
.header-placeholder {
    height: 70px;
}

/* === 通知提示 === */
.shared-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 28px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    font-size: 0.95rem;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 400px;
}

.shared-notification-success { background: linear-gradient(135deg, #22c55e, #10b981); }
.shared-notification-error   { background: linear-gradient(135deg, #ef4444, #dc2626); }
.shared-notification-info    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.shared-notification-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }

.shared-notification-in  { animation: notifSlideIn 0.3s ease forwards; }
.shared-notification-out { animation: notifSlideOut 0.3s ease forwards; }

@keyframes notifSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes notifSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* === 模态框 === */
.shared-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.shared-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalSlideUp 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

.shared-modal-header {
    padding: 28px 32px 0;
}

.shared-modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
}

.shared-modal-body {
    padding: 24px 32px 32px;
}

/* 作品详情宽模态框 */
.shared-modal--wide {
    max-width: 65vw;
    padding: 20px 24px;
}
.shared-modal--wide .shared-modal-body {
    padding: 12px 0 0;
}
@media (max-width:768px) {
    .shared-modal--wide {
        max-width: 100vw;
        border-radius: 12px 12px 0 0;
        margin-top: auto;
    }
}

.shared-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.6rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.shared-modal-close:hover { color: #1e293b; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* === 加载状态 === */
.shared-loading {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.shared-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #e2e8f0;
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* === 空状态 === */
.shared-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.shared-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.shared-empty p {
    font-size: 1rem;
    color: #64748b;
}

/* === 表单元素 === */
.shared-form-group {
    margin-bottom: 20px;
}

.shared-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 8px;
}

.shared-form-group input,
.shared-form-group select,
.shared-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: #1e293b;
    transition: all 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.shared-form-group input:focus,
.shared-form-group select:focus,
.shared-form-group textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.shared-form-group input:read-only,
.shared-form-group input[readonly] {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.shared-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.shared-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.shared-select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

/* 行内表单（多元素并排） */
.shared-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.shared-form-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* === 按钮 === */
.shared-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.shared-btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.shared-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14,165,233,0.4);
}

.shared-btn-primary:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.shared-btn-outline {
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.shared-btn-outline:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f0f9ff;
}

.shared-btn-danger {
    background: #fff;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.shared-btn-danger:hover {
    background: #fef2f2;
}

.shared-btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.shared-btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
    border-radius: 12px;
}

/* === 徽章/标签 === */
.shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.shared-badge-pending  { background: #fef3c7; color: #92400e; }
.shared-badge-reviewing{ background: #dbeafe; color: #1e40af; }
.shared-badge-scored   { background: #dcfce7; color: #166534; }
.shared-badge-rejected { background: #fee2e2; color: #991b1b; }
.shared-badge-draft    { background: #f1f5f9; color: #475569; }
.shared-badge-published{ background: #e0f2fe; color: #0369a1; }
.shared-badge-completed{ background: #ede9fe; color: #5b21b6; }

/* === 卡片容器 === */
.shared-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    transition: all 0.2s;
}

.shared-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* === 响应式 === */
@media (max-width: 768px) {
    .shared-nav-link { padding: 6px 10px; font-size: 0.8rem; }
    .shared-form-row { grid-template-columns: 1fr; }
    .shared-form-row-2 { grid-template-columns: 1fr; }
    .shared-modal { width: 95%; max-width: none; margin: 16px; }
    .shared-modal-body { padding: 16px 20px 20px; }
}
