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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 区域样式 */
.section {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #667eea;
}

/* 表单元素 */
.select-box {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.select-box:focus {
    outline: none;
    border-color: #667eea;
}

.date-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    margin-top: 10px;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-outline:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* WebView 状态 */
.webview-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-dot.connected {
    background: #28a745;
    animation: none;
}

.status-dot.error {
    background: #dc3545;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* WebView 嵌入区域 */
.webview-container {
    width: 100%;
    height: 600px;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.webview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.webview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.help-text {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

.help-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.help-text li {
    margin-bottom: 5px;
}

.btn-success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* 提示文本 */
.hint {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* 课程列表 */
.course-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.course-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

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

.course-name {
    font-weight: 600;
    color: #333;
}

.course-detail {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* 操作按钮区域 */
.actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* 分享链接 */
.share-link {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-link input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* 状态提示 */
.status {
    padding: 15px;
    margin-top: 20px;
    border-radius: 6px;
    display: none;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status.loading {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
    display: block;
}

/* 底部样式 */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}



/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 2em;
    }

    .section {
        padding: 20px;
    }

    .actions {
        flex-direction: column;
    }

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

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* 分步卡片（识别流程） */
.step-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fcfcfd;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}

/* 内嵌浏览器工具栏 */
.embed-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #eef0f4;
    border: 1px solid #e2e5ea;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.embed-address {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.embed-frame-wrap {
    height: 480px;
    margin-bottom: 0;
    border-radius: 0 0 8px 8px;
}

/* 禁止内嵌学校说明 */
.noembed-note {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #fdecea;
    border: 1px solid #f5b7b1;
    border-radius: 8px;
    color: #7b241c;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
    word-break: break-all;
}

.btn-success:disabled {
    background: #ccc;
    color: #fff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 导入兜底 */
.import-box {
    margin-top: 16px;
    padding: 14px;
    background: #fff8e6;
    border: 1px solid #f0d68a;
    border-radius: 8px;
}

.import-title {
    font-weight: 600;
    color: #8a6d1a;
    margin-bottom: 8px;
}

.import-steps {
    margin: 0 0 12px 0;
    padding-left: 20px;
    font-size: 13px;
    color: #6b5b2a;
}

.import-steps li {
    margin-bottom: 4px;
}

.import-textarea {
    width: 100%;
    min-height: 140px;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.5;
    box-sizing: border-box;
}

.import-box .button-group {
    align-items: center;
}

label.btn {
    cursor: pointer;
}

/* 书签一键识别 */
.bookmark-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.bookmark-drag {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #7a4a00;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    user-select: none;
}

.bookmark-drag:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.bookmark-drag:active {
    cursor: grabbing;
}

.bookmark-bar .hint {
    width: 100%;
}

@media (max-width: 768px) {
    .embed-frame-wrap {
        height: 400px;
    }
}