/* 我爱写作业应用 - 全局样式 */

/* 嫩橘色和燕青色配色方案 + 童趣字体 */
:root {
    --orange-primary: #FF8C42;
    --orange-light: #FFB366;
    --orange-dark: #E6762B;
    --teal-primary: #20B2AA;
    --teal-light: #4ECDC4;
    --teal-dark: #008B8B;
    --gradient-orange-teal: linear-gradient(135deg, #FF8C42 0%, #20B2AA 100%);
    --gradient-teal-orange: linear-gradient(135deg, #20B2AA 0%, #FF8C42 100%);
    --kid-font-primary: 'Fredoka One', cursive;
    --kid-font-secondary: 'Nunito', sans-serif;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--kid-font-secondary), -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #FF8C42 0%, #20B2AA 100%);
    min-height: 100vh;
    font-weight: 600;
}

/* 头部导航 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--kid-font-primary);
    font-size: 1.5rem;
    font-weight: bold;
    color: #FF8C42;
    text-decoration: none;
    transition: color 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.logo:hover {
    color: #20B2AA;
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: #FF8C42;
    color: white;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 主卡片 */
.main-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.main-card:hover {
    transform: translateY(-5px);
}

.main-title {
    font-family: var(--kid-font-primary);
    font-size: 2.8rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #FF8C42, #20B2AA, #FF6B9D, #4ECDC4);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-family: var(--kid-font-secondary);
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #5A5A5A;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    margin: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #FF8C42, #20B2AA);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 140, 66, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #333;
    border: 2px solid #FF8C42;
}

.btn-secondary:hover {
    background: #FF8C42;
    color: white;
}

/* 按钮组居中样式 */
.btn-group-center {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn-group-center .btn {
    margin: 0;
    white-space: nowrap;
}

/* 内容网格 */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.content-card {
    background: rgba(255, 255, 255, 0.8);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 140, 66, 0.2);
}

.content-card:hover {
    transform: translateY(-5px);
}

.content-card h3 {
    color: #FF8C42;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.content-card p {
    color: #666;
    line-height: 1.6;
}

/* 作业内容图片样式 */
.content-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.content-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 图片预览容器 */
.content-image-container {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

/* 历史记录样式 */
.history-section {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #fafafa;
    border-radius: 12px;
    border: 1px solid #eaeaea;
}

.history-title {
    color: #666;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-history {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    border-left: 3px solid #f77f00;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.history-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-message {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 4.2em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.history-time {
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.history-time:before {
    content: "🕒";
}

.history-status {
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    background-color: rgba(76, 175, 80, 0.1);
}

.history-status[style*="#f44336"] {
    background-color: rgba(244, 67, 54, 0.1);
}

.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    cursor: pointer;
    transform: translateY(-1px);
}

/* 响应式图片 */
@media (max-width: 768px) {
    .content-image {
        max-width: 100%;
        max-height: 250px;
    }
    
    .content-image-container {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content-image {
        max-height: 200px;
        border-radius: 8px;
    }
    
    .history-item img {
        width: 50px;
        height: 50px;
    }
}

/* 图片加载状态 */
.content-image:not([src]) {
    background: #f0f0f0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* 图片点击放大预览 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-modal.active {
    display: flex;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: default;
}

/* 图片错误状态 */
.content-image-error {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    font-style: italic;
}

/* 表单样式 */
.content-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.content-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 图片预览容器 */
.content-image-container {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

/* 作业历史图片 */
.history-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 1rem;
    cursor: pointer;
}

/* 响应式图片 */
@media (max-width: 768px) {
    .content-image {
        max-width: 100%;
        max-height: 250px;
    }
    
    .content-image-container {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content-image {
        max-height: 200px;
        border-radius: 8px;
    }
    
    .history-item img {
        width: 50px;
        height: 50px;
    }
}

/* 图片加载状态 */
.content-image:not([src]) {
    background: #f0f0f0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* 图片点击放大预览 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-modal.active {
    display: flex;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: default;
}

/* 图片错误状态 */
.content-image-error {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    font-style: italic;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid rgba(255, 140, 66, 0.3);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FF8C42;
    box-shadow: 0 0 10px rgba(255, 140, 66, 0.3);
}

/* 消息提示 */
.flash-messages {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 350px;
    pointer-events: none;
}

.flash-message {
    padding: 1.2rem 1.5rem;
    border-radius: 15px;
    font-weight: 600;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid transparent;
    background-color: white;
    backdrop-filter: blur(10px);
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.3s ease forwards;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: top right;
}

.flash-message:hover {
    transform: translateX(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 添加图标 */
.flash-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
}

.flash-message.success {
    border-color: rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.flash-message.success::before {
    background: linear-gradient(180deg, #28a745, #20c997);
}

.flash-message.error {
    border-color: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.flash-message.error::before {
    background: linear-gradient(180deg, #dc3545, #fd7e14);
}

.flash-message.warning {
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.flash-message.warning::before {
    background: linear-gradient(180deg, #ffc107, #fd7e14);
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%) translateY(-10px);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 导航栏优化 */
    .nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        gap: 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    /* 容器和卡片优化 */
    .container {
        padding: 0.8rem;
    }
    
    .main-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .main-title {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    /* 网格布局 */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.8rem;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 0.9rem 1.2rem;
        font-size: 1rem;
        margin: 0.5rem 0;
        width: 100%; /* 手机端按钮全宽 */
    }
    
    .btn + .btn {
        margin-left: 0;
    }
    
    /* 按钮组居中优化 */
    .btn-group-center {
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
    }
    
    .btn-group-center .btn {
        width: 100%;
        text-align: center;
    }
    
    /* 图片上传区域优化 */
    .file-label {
        padding: 2rem 1rem;
        font-size: 0.9rem;
    }
    
    /* 内容卡片优化 */
    .content-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .content-card h3 {
        font-size: 1.2rem;
    }
    
    .content-card p {
        font-size: 0.95rem;
    }
}

/* 小屏幕设备优化（480px以下） */
@media (max-width: 480px) {
    body {
        font-size: 16px; /* 防止iOS缩放 */
        line-height: 1.5;
    }
    
    /* 导航栏进一步优化 */
    .nav {
        padding: 0.8rem;
    }
    
    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    /* 容器和卡片进一步优化 */
    .container {
        padding: 0.5rem;
    }
    
    .main-card {
        padding: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .main-title {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    /* 按钮进一步优化 */
    .btn {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        margin: 0.4rem 0;
    }
    
    /* 表单进一步优化 */
    .form-group {
        margin-bottom: 0.8rem;
    }
    
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.7rem;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .auth-card {
        margin: 0.5rem;
        padding: 1.2rem;
    }
    
    .auth-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    /* 内容卡片进一步优化 */
    .content-grid {
        gap: 0.8rem;
    }
    
    .content-card {
        padding: 1rem;
    }
    
    .content-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .content-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* 分享成功页面特殊优化 */
    .share-success {
        padding: 1.5rem 1rem;
    }
    
    .share-success h1 {
        font-size: 1.5rem;
    }
    
    .share-success p {
        font-size: 1rem;
    }
    
    .share-url {
        font-size: 0.9rem;
        padding: 0.8rem;
        word-break: break-all;
        margin-bottom: 1rem;
    }
    
    /* 内容过期页面优化 */
    .expired-container {
        padding: 1.5rem 1rem;
        text-align: center;
    }
    
    .expired-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .expired-message {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .expired-container ul {
        text-align: left;
        font-size: 0.9rem;
    }
    
    /* 列表优化 */
    ol, ul {
        padding-left: 1.2rem;
        font-size: 0.9rem;
    }
    
    ol li, ul li {
        margin-bottom: 0.5rem;
    }
}

/* 工具类 */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* 加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* 新增配色效果 */
.gradient-text {
    background: var(--gradient-orange-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                var(--gradient-orange-teal) border-box;
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 140, 66, 0.2);
}

.orange-accent {
    color: var(--orange-primary);
}

.teal-accent {
    color: var(--teal-primary);
}

.btn-orange {
    background: var(--orange-primary);
    color: white;
    border: none;
}

.btn-orange:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 140, 66, 0.4);
}

.btn-teal {
    background: var(--teal-primary);
    color: white;
    border: none;
}

.btn-teal:hover {
    background: var(--teal-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(32, 178, 170, 0.4);
}

/* 分享成功页面样式 */
.share-success {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.share-url {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.9rem;
    color: #495057;
}

.copy-btn {
    background: var(--orange-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.copy-btn:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.3);
}

/* 内容过期页面样式 */
.expired-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 2rem;
}

.expired-icon {
    font-size: 4rem;
    margin-bottom: 2rem;
}

.expired-message {
    font-size: 2rem;
    color: #f44336;
    margin-bottom: 1rem;
}

/* 移动端额外优化 */
@media (max-width: 480px) {
    .share-success {
        padding: 1.5rem 1rem;
    }
    
    .share-url {
        font-size: 0.85rem;
        padding: 0.7rem;
    }
    
    .copy-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
        width: 100%;
    }
    
    .expired-container {
        padding: 1.5rem 1rem;
    }
    
    .expired-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .expired-message {
        font-size: 1.5rem;
    }
}

/* Kindle特殊样式 */
.kindle-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    font-size: 18px;
    line-height: 1.8;
}

.kindle-image {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

.kindle-message {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    border-left: 4px solid #FF8C42;
}