/* 打卡照片管理系统样式 */

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-selector label {
    font-weight: 500;
}

/* 日期选择器 */
.date-picker-wrapper {
    position: relative;
}

.date-picker-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 1rem;
    min-width: 200px;
    transition: all 0.2s;
}

.date-picker-btn:hover {
    border-color: var(--primary-color);
}

.date-picker-btn .arrow {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.date-picker-btn.active .arrow {
    transform: rotate(180deg);
}

/* 日历弹出层 */
.calendar-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 1000;
    min-width: 280px;
    border: 1px solid var(--border-color);
}

.calendar-popup.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 日历头部 */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-header span {
    font-weight: 600;
    font-size: 1rem;
}

.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* 星期标题 */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px;
}

/* 日期格子 */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 50%;
    font-size: 0.9rem;
    transition: all 0.15s;
    color: var(--text-color);
}

.calendar-day:hover:not(:disabled) {
    background: var(--bg-color);
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
}

.calendar-day.has-data {
    font-weight: 600;
    position: relative;
}

.calendar-day.has-data::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
}

.calendar-day.selected.has-data::after {
    background: white;
}

.calendar-day:disabled {
    color: #ccc;
    cursor: default;
}

.calendar-day.other-month {
    color: #ccc;
}

.count-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 200px;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 8px;
}

.sort-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--primary-color);
}

/* 多选工具栏 */
.select-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.select-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.select-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-info label {
    cursor: pointer;
    font-weight: 500;
}

.select-actions {
    display: flex;
    gap: 12px;
}

.select-toolbar .btn-primary {
    background: white;
    color: var(--primary-color);
}

.select-toolbar .btn-primary:hover:not(:disabled) {
    background: #f3f4f6;
}

.select-toolbar .btn-secondary {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.select-toolbar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 图片卡片选择样式 */
.image-card {
    position: relative;
}

.image-card .select-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.2s;
}

.image-card .select-checkbox:hover {
    border-color: var(--primary-color);
}

.image-card .select-checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.image-card.selected {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 图片网格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.image-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.image-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--bg-color);
}

.image-card .info {
    padding: 12px;
}

.image-card .filename {
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.image-card .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1.1rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-info {
    padding: 20px;
}

.modal-info h3 {
    margin-bottom: 8px;
    word-break: break-all;
}

.modal-info p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* 响应式 */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .date-selector {
        flex-wrap: wrap;
    }

    .actions {
        flex-wrap: wrap;
    }

    .search-box {
        width: 100%;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* 右键菜单 */
.context-menu {
    display: none;
    position: fixed;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    z-index: 2000;
    padding: 8px 0;
    border: 1px solid var(--border-color);
}

.context-menu.active {
    display: block;
}

.menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.menu-item:hover {
    background: var(--bg-color);
}

.menu-item.danger {
    color: var(--danger-color);
}

.menu-item.danger:hover {
    background: #fef2f2;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* 重命名弹窗样式 */
.rename-modal {
    width: 400px;
    max-width: 90vw;
    padding: 24px;
}

.rename-modal h3 {
    margin-bottom: 16px;
}

.rename-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 20px;
}

.rename-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Toast 提示框 */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 登录提示样式 */
.login-required {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.login-box {
    background: var(--card-bg);
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
}

.login-box h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
    color: var(--text-color);
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.login-box .btn {
    font-size: 1rem;
    padding: 14px 28px;
}