/* CSS 变量 - 主题色 */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-card: #252b4a;
    --bg-input: #1e2341;
    --text-primary: #ffffff;
    --text-secondary: #b8c2cc;
    --text-muted: #7a8299;
    --border-color: #3a4060;
    --accent-blue: #00d4ff;
    --accent-purple: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    --glow-blue: 0 0 20px rgba(0, 212, 255, 0.5);
    --glow-purple: 0 0 20px rgba(139, 92, 246, 0.5);
    --priority-high: #ef4444;
    --priority-medium: #f59e0b;
    --priority-low: #10b981;
    --font-tech: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(0, 212, 255, 0.1) 1px, transparent 0),
        radial-gradient(circle at 20px 20px, rgba(139, 92, 246, 0.05) 1px, transparent 0);
    background-size: 40px 40px;
    overflow-x: hidden;
}

/* 页面加载动画 */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease, visibility 1s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    position: relative;
}

.loader-glow {
    width: 150px;
    height: 150px;
    background: var(--accent-gradient);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(30px);
    opacity: 0.5;
    animation: pulse 2s ease-in-out infinite;
}

.loader h2 {
    font-family: var(--font-tech);
    font-size: 2.5rem;
    color: var(--text-primary);
    text-shadow: var(--glow-blue);
    position: relative;
    z-index: 2;
    animation: fadeIn 1s ease-out;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 主内容区域 */
.main-content {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out 0.5s forwards;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--glow-blue);
}

.app-title {
    font-family: var(--font-tech);
    font-size: 2rem;
    color: var(--text-primary);
}

.title-glow {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: var(--glow-blue);
}

/* 搜索容器 */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 12px 40px 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    width: 300px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
    background: var(--bg-card);
}

.search-icon {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.search-input:focus + .search-icon {
    color: var(--accent-blue);
}

/* 新增备忘录区域 */
.add-note-section {
    margin-bottom: 40px;
}

.add-note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.add-note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), var(--glow-blue);
    border-color: var(--accent-blue);
}

.add-note-card h2 {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
}

.note-input,
.note-textarea,
.priority-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.note-input:focus,
.note-textarea:focus,
.priority-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
    background: var(--bg-card);
}

.note-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.priority-group {
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
}

.priority-group label {
    color: var(--text-secondary);
    font-weight: 500;
}

.priority-select {
    width: 120px;
    cursor: pointer;
}

/* 按钮样式 */
.add-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--glow-blue);
    position: relative;
    overflow: hidden;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-blue), var(--glow-purple);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
}

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

.btn-icon {
    font-size: 1.5rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.add-btn:hover .btn-icon {
    transform: rotate(90deg);
}

/* 备忘录列表区域 */
.notes-section {
    margin-bottom: 30px;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.notes-header h2 {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    color: var(--text-primary);
}

.notes-stats {
    color: var(--text-muted);
    font-size: 1rem;
}

#notesCount {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 1.2rem;
}

/* 备忘录网格布局 */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* 备忘录卡片样式 */
.note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), var(--glow-purple);
    border-color: var(--accent-purple);
}

.note-card:hover::before {
    transform: scaleX(1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.note-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.note-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.priority-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-high {
    background: rgba(239, 68, 68, 0.2);
    color: var(--priority-high);
}

.priority-medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--priority-medium);
}

.priority-low {
    background: rgba(16, 185, 129, 0.2);
    color: var(--priority-low);
}

.note-content {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.note-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--accent-gradient);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--glow-blue);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-tech);
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.save-btn {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn:hover {
    box-shadow: var(--glow-blue);
    transform: translateY(-1px);
}

.delete-btn {
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--priority-high);
    border-radius: 8px;
    color: var(--priority-high);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: var(--priority-high);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* 空状态样式 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* 动画关键帧 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

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

    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .search-input {
        width: 100%;
        max-width: 300px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .priority-group {
        justify-content: flex-start;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .notes-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .loader h2 {
        font-size: 2rem;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .add-note-card,
    .note-card {
        padding: 16px;
    }

    .note-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .note-actions {
        flex-direction: column;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
    box-shadow: var(--glow-blue);
}

/* 选择文本样式 */
::selection {
    background: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}