* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #1E88E5 0%, #0D47A1 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.toolbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.toolbar-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(45deg, #1E88E5, #0D47A1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: #f5f5f5;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

#zoomLevel {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.tabs {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0;
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
    background: white;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.tab-btn:hover:not(.active) {
    background: rgba(100, 181, 246, 0.1);
}

.tab-btn.drag-over {
    background: linear-gradient(145deg, #64B5F6, #42A5F5);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.4);
    animation: slideGlow 0.8s ease-in-out infinite alternate;
}

@keyframes slideGlow {
    0% {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(100, 181, 246, 0.4);
        background: linear-gradient(145deg, #64B5F6, #42A5F5);
    }
    100% {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(100, 181, 246, 0.6);
        background: linear-gradient(155deg, #42A5F5, #2196F3);
    }
}

.board-wrapper {
    flex: 1;
    position: relative;
    overflow: auto;
}

.board {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 2000px;
    height: 2000px;
    background: 
        radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    transform-origin: 0 0;
    transition: transform 0.3s ease;
}

.board.active {
    display: block;
}

.board:not(.active) {
    display: none;
}

.todo-group {
    position: absolute;
    width: 280px;
    min-height: 150px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    cursor: move;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    will-change: transform;
}

.todo-group:hover {
    box-shadow: var(--shadow-lg);
}

.todo-group.dragging {
    opacity: 0.8;
    z-index: 1000;
    transition: none;
    transform: scale(1.05);
}

.todo-group.highlighted {
    box-shadow: 0 0 20px rgba(30, 136, 229, 0.8);
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 20px rgba(30, 136, 229, 0.8);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(30, 136, 229, 1);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 20px rgba(30, 136, 229, 0.8);
        transform: scale(1);
    }
}

.group-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.group-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
    margin-right: 0.5rem;
}

.group-actions {
    display: flex;
    gap: 0.25rem;
}

.group-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.group-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.group-btn.delete:hover {
    background: var(--danger-color);
    color: white;
}

.group-items {
    padding: 1rem;
    min-height: 50px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    transition: var(--transition);
}

.todo-item:hover {
    background: rgba(255, 255, 255, 0.95);
}

.todo-item:last-child {
    margin-bottom: 0;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.item-checkbox.checked {
    background: var(--primary-color);
}

.item-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.item-content {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    border: none;
    background: transparent;
    outline: none;
}

.item-content.completed {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.item-delete {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.item-delete:hover {
    background: var(--danger-color);
    color: white;
}

.add-item-btn {
    width: 100%;
    padding: 0.5rem;
    border: 2px dashed var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.add-item-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    background: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* iOS设备优化 */
@supports (-webkit-touch-callout: none) {
    .form-input {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 1rem;
        background-color: white;
        border-radius: 12px;
    }
}

/* 下拉箭头自定义 */
.form-input::-ms-expand {
    display: none;
}

.form-input::-webkit-calendar-picker-indicator {
    display: none;
}

/* 移动设备下拉菜单优化 */
select.form-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

/* iOS下拉菜单特殊优化 */
@supports (-webkit-touch-callout: none) {
    select.form-input {
        background-image: none;
        padding-right: 1rem;
        -webkit-appearance: menulist-text;
        -webkit-appearance: none;
        appearance: none;
        border: 2px solid var(--border-color);
        border-radius: 12px;
    }
}

.item-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-input .form-input {
    flex: 1;
}

.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 3px solid transparent;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-primary);
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.color-input {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
}

.color-input:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.color-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.color-label:hover {
    color: var(--primary-color);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

@media (max-width: 1024px) {
    .toolbar {
        padding: 0.75rem 1rem;
    }
    
    .toolbar-left h1 {
        font-size: 1.25rem;
    }
    
    .toolbar-right {
        gap: 0.75rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .todo-group {
        width: 260px;
    }
    
    .board {
        width: 1500px;
        height: 1500px;
    }
}

@media (max-width: 768px) {
    .toolbar {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .toolbar-left h1 {
        font-size: 1.125rem;
    }
    
    .todo-group {
        width: 280px;
        min-height: 120px;
    }
    
    .group-header {
        padding: 0.75rem;
    }
    
    .group-title {
        font-size: 0.9rem;
    }
    
    .group-items {
        padding: 0.75rem;
    }
    
    .todo-item {
        padding: 0.4rem;
        margin-bottom: 0.4rem;
    }
    
    .item-content {
        font-size: 0.8rem;
    }
    
    .board {
        width: 1200px;
        height: 1200px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
    
    .tab-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .toolbar {
        padding: 0.5rem;
    }
    
    .toolbar-left h1 {
        font-size: 1rem;
    }
    
    .toolbar-right {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .todo-group {
        width: calc(100vw - 2rem);
        max-width: 320px;
        min-height: 100px;
    }
    
    .group-header {
        padding: 0.6rem;
    }
    
    .group-title {
        font-size: 0.85rem;
        margin-right: 0.25rem;
    }
    
    .group-btn {
        width: 24px;
        height: 24px;
        font-size: 0.875rem;
        padding: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: var(--transition);
    }
    
    .group-actions {
        gap: 0.3rem;
    }
    
    .group-items {
        padding: 0.6rem;
    }
    
    .todo-item {
        padding: 0.4rem;
        margin-bottom: 0.4rem;
        flex-direction: row;
        align-items: center;
        gap: 0.4rem;
        position: relative;
    }
    
    .item-checkbox {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .item-checkbox.checked::after {
        font-size: 10px;
    }
    
    .item-content {
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
    }
    
    .item-delete {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        position: static;
    }
    
    .add-item-btn {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .board {
        width: 1000px;
        height: 1000px;
    }
    
    .zoom-controls {
        padding: 0.2rem;
        gap: 0.25rem;
    }
    
    .zoom-controls span {
        display: none;
    }
    
    .modal-content {
        width: 98%;
        margin: 0.5rem;
        max-height: 90vh;
    }
    
    .modal-header h2 {
        font-size: 1.125rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-input {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    .tab-btn {
        padding: 0.6rem;
        font-size: 0.75rem;
    }
    
    .color-option {
        width: 32px;
        height: 32px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .todo-group:hover {
        box-shadow: var(--shadow-md);
        transform: none;
    }
    
    .group-btn:hover {
        background: transparent;
        color: var(--text-secondary);
        transform: none;
    }
    
    .btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .tab-btn:hover:not(.active) {
        background: transparent;
    }
    
    .todo-item:hover {
        background: rgba(255, 255, 255, 0.8);
    }
    
    .add-item-btn:hover {
        background: transparent;
        border-color: var(--border-color);
        color: var(--text-secondary);
    }
}
